--- deliantra/server/common/object.C 2007/04/24 12:32:14 1.140 +++ deliantra/server/common/object.C 2007/05/07 03:05:58 1.145 @@ -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. */ @@ -539,7 +551,8 @@ * values for the body_used info, so when items are created * for it, they can be properly equipped. */ - memcpy (body_used, body_info, sizeof (body_used)); + for (int i = NUM_BODY_LOCATIONS; i--; ) + slot[i].used = slot[i].info; attachable::instantiate (); } @@ -2585,15 +2598,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 *