ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/c_object.C
(Generate patch)

Comparing deliantra/server/server/c_object.C (file contents):
Revision 1.31 by root, Fri Dec 22 16:34:00 2006 UTC vs.
Revision 1.36 by root, Tue Jan 9 21:32:42 2007 UTC

1/* 1/*
2 CrossFire, A Multiplayer game for X-windows 2 CrossFire, A Multiplayer game for X-windows
3 3
4 Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
4 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 5 Copyright (C) 2002 Mark Wedel & Crossfire Development Team
5 Copyright (C) 1992 Frank Tore Johansen 6 Copyright (C) 1992 Frank Tore Johansen
6 7
7 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
24*/ 25*/
25 26
26#include <global.h> 27#include <global.h>
27#include <loader.h> 28#include <loader.h>
28#include <skills.h> 29#include <skills.h>
29#ifndef __CEXTRACT__
30# include <sproto.h> 30#include <sproto.h>
31#endif
32#include <living.h> 31#include <living.h>
33#include <math.h> 32#include <math.h>
34 33
35/* 34/*
36 * Object id parsing functions 35 * Object id parsing functions
510 if (tmp->invisible) 509 if (tmp->invisible)
511 { 510 {
512 tmp = next; 511 tmp = next;
513 continue; 512 continue;
514 } 513 }
514
515 /* This following two if and else if could be merged into line 515 /* This following two if and else if could be merged into line
516 * but that probably will make it more difficult to read, and 516 * but that probably will make it more difficult to read, and
517 * not make it any more efficient 517 * not make it any more efficient
518 */ 518 */
519 if (params && item_matched_string (op, tmp, params)) 519 if (params && item_matched_string (op, tmp, params))
520 {
521 pick_up (op, tmp); 520 pick_up (op, tmp);
522 }
523 else if (can_pick (op, tmp) && !params) 521 else if (can_pick (op, tmp) && !params)
524 { 522 {
525 pick_up (op, tmp); 523 pick_up (op, tmp);
526 break; 524 break;
527 } 525 }
526
528 tmp = next; 527 tmp = next;
529 /* Might as well just skip over the player immediately -
530 * we know it can't be picked up
531 */
532 if (tmp == op)
533 tmp = tmp->below;
534 } 528 }
529
535 if (!params && !tmp) 530 if (!params && !tmp)
536 { 531 {
537 for (tmp = op->below; tmp != NULL; tmp = tmp->next) 532 for (tmp = op->below; tmp; tmp = tmp->below)
538 if (!tmp->invisible) 533 if (!tmp->invisible)
539 { 534 {
540 char buf[MAX_BUF]; 535 char buf[MAX_BUF];
541 536
542 sprintf (buf, "You can't pick up a %s.", &tmp->name); 537 sprintf (buf, "You can't pick up a %s.", &tmp->name);
543 new_draw_info (NDI_UNIQUE, 0, op, buf); 538 new_draw_info (NDI_UNIQUE, 0, op, buf);
544 break; 539 break;
545 } 540 }
541
546 if (!tmp) 542 if (!tmp)
547 new_draw_info (NDI_UNIQUE, 0, op, "There is nothing to pick up."); 543 new_draw_info (NDI_UNIQUE, 0, op, "There is nothing to pick up.");
548 } 544 }
545
549 return 0; 546 return 0;
550} 547}
551 548
552 549
553/* 550/*
710 707
711 tmp->destroy (); 708 tmp->destroy ();
712 op->update_stats (); 709 op->update_stats ();
713 return; 710 return;
714 } 711 }
715
716/* If SAVE_INTERVAL is commented out, we never want to save
717 * the player here.
718 */
719#ifdef SAVE_INTERVAL
720 /* I'm not sure why there is a value check - since the save
721 * is done every SAVE_INTERVAL seconds, why care the value
722 * of what he is dropping?
723 */
724 if (op->type == PLAYER && !QUERY_FLAG (tmp, FLAG_UNPAID) &&
725 (tmp->nrof ? tmp->value * tmp->nrof : tmp->value > 2000) && (op->contr->last_save_time + SAVE_INTERVAL) <= time (NULL))
726 {
727 op->contr->save ();
728 op->contr->last_save_time = time (NULL);
729 }
730#endif /* SAVE_INTERVAL */
731 712
732 if (op->type == PLAYER) 713 if (op->type == PLAYER)
733 esrv_del_item (op->contr, tmp->count); 714 esrv_del_item (op->contr, tmp->count);
734 715
735 /* Call this before we update the various windows/players. At least 716 /* Call this before we update the various windows/players. At least
994{ 975{
995 if (!params) 976 if (!params)
996 { 977 {
997 object *tmp = op->below; 978 object *tmp = op->below;
998 979
999 while (tmp && !LOOK_OBJ (tmp)) 980 while (tmp && !tmp->client_visible ())
1000 tmp = tmp->below; 981 tmp = tmp->below;
1001 if (tmp) 982 if (tmp)
1002 examine (op, tmp); 983 examine (op, tmp);
1003 } 984 }
1004 else 985 else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines