--- deliantra/server/common/object.C 2007/04/30 04:25:29 1.142 +++ deliantra/server/common/object.C 2007/05/11 21:07:13 1.146 @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -451,6 +452,26 @@ this->owner = owner; } +void +object::set_weapon (object *ob) +{ + if (current_weapon == ob) + return; + + new_draw_info_format (NDI_UNIQUE, 0, this, "You switch to your %s.", &ob->name); + + if (chosen_skill) + chosen_skill->flag [FLAG_APPLIED] = false; + + current_weapon = ob; + chosen_skill = ob->type == SKILL ? ob : find_skill_by_name (this, ob->skill); + + if (chosen_skill) + chosen_skill->flag [FLAG_APPLIED] = true; + + update_stats (); +} + /* Zero the key_values on op, decrementing the shared-string * refcounts and freeing the links. */ @@ -540,7 +561,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 (); } @@ -2586,15 +2608,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 *