--- deliantra/server/common/object.C 2007/05/14 19:56:45 1.149 +++ deliantra/server/common/object.C 2007/05/17 21:11:01 1.153 @@ -475,9 +475,15 @@ if (current_weapon == ob) return true; + if (chosen_skill) + chosen_skill->flag [FLAG_APPLIED] = false; + current_weapon = ob; chosen_skill = !ob || ob->type == SKILL ? ob : find_skill_by_name (this, ob->skill); + if (chosen_skill) + chosen_skill->flag [FLAG_APPLIED] = true; + update_stats (); if (ob) @@ -501,6 +507,13 @@ else ;//new_draw_info_format (NDI_UNIQUE, 0, this, "You unwield your weapons."); + if (ob && !ob->flag [FLAG_APPLIED] && ob->type != SPELL) + { + LOG (llevError | logBacktrace, "%s changed to unapplied weapon %s", + &name, ob->debug_desc ()); + return false; + } + return true; } @@ -1656,7 +1669,7 @@ if (where->head) { - LOG (llevDebug, "Warning: Tried to insert object into wrong part of multipart object.\n"); + LOG (llevError | logBacktrace, "Warning: Tried to insert object into wrong part of multipart object.\n"); where = where->head; } @@ -1997,19 +2010,6 @@ } /* - * set_cheat(object) sets the cheat flag (WAS_WIZ) in the object and in - * all it's inventory (recursively). - * If checksums are used, a player will get set_cheat called for - * him/her-self and all object carried by a call to this function. - */ -void -set_cheat (object *op) -{ - SET_FLAG (op, FLAG_WAS_WIZ); - flag_inv (op, FLAG_WAS_WIZ); -} - -/* * find_free_spot(object, map, x, y, start, stop) will search for * a spot at the given map and coordinates which will be able to contain * the given object. start and stop specifies how many squares