--- deliantra/server/common/object.C 2007/04/21 17:34:22 1.139 +++ deliantra/server/common/object.C 2007/05/03 10:39:46 1.144 @@ -1,5 +1,5 @@ /* - * CrossFire, A Multiplayer game for X-windows + * CrossFire, A Multiplayer game * * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team * Copyright (C) 2001 Mark Wedel & Crossfire Development Team @@ -326,10 +326,11 @@ long sum; object *inv; - for (sum = 0, inv = op->inv; inv != NULL; inv = inv->below) + for (sum = 0, inv = op->inv; inv; inv = inv->below) { if (inv->inv) sum_weight (inv); + sum += inv->carrying + inv->weight * (inv->nrof ? inv->nrof : 1); } @@ -450,6 +451,17 @@ this->owner = owner; } +void +object::set_weapon (object *ob) +{ + if (current_weapon == ob) + return; + + current_weapon = ob; + new_draw_info_format (NDI_UNIQUE, 0, this, "You switch to your %s.", &ob->name); + update_stats (); +} + /* Zero the key_values on op, decrementing the shared-string * refcounts and freeing the links. */ @@ -837,15 +849,7 @@ remove_button_link (this); if (flag [FLAG_FRIENDLY]) - { - remove_friendly_object (this); - - if (type == GOLEM - && owner - && owner->type == PLAYER - && owner->contr->ranges[range_golem] == this) - owner->contr->ranges[range_golem] = 0; - } + remove_friendly_object (this); if (!flag [FLAG_REMOVED]) remove (); @@ -2593,15 +2597,10 @@ const char * object::debug_desc () const { - static char info[256 * 4]; - return debug_desc (info); -} + static char info[3][256 * 4]; + static int info_idx; -const char * -object::debug_desc2 () const -{ - static char info[256 * 4]; - return debug_desc (info); + return debug_desc (info [++info_idx % 3]); } struct region *