--- deliantra/server/common/loader.C 2008/09/11 12:43:17 1.120 +++ deliantra/server/common/loader.C 2009/01/08 03:03:23 1.127 @@ -259,7 +259,7 @@ { if (type >= NUM_TYPES) { - LOG (llevError, "%s: type out of range, resetting to 0.\n", debug_desc ()); + LOG (llevError, "ITEMBUG: %s: type out of range, resetting to 0.\n", debug_desc ()); type = 0; } @@ -271,7 +271,7 @@ case HORN: if (slot [body_range].info != -1) { - LOG (llevError, "%s: body_range %d != -1\n", debug_desc (), slot [body_range].info); + LOG (llevError, "ITEMBUG: %s: body_range %d != -1\n", debug_desc (), slot [body_range].info); slot [body_range].info = -1; } break; @@ -279,7 +279,7 @@ case WEAPON: if (slot [body_combat].info != -1) { - LOG (llevError, "%s: body_combat %d != -1\n", debug_desc (), slot [body_combat].info); + LOG (llevError, "ITEMBUG: %s: body_combat %d != -1\n", debug_desc (), slot [body_combat].info); slot [body_combat].info = -1; } break; @@ -287,7 +287,7 @@ case SHIELD: if (slot [body_shield].info != -1) { - LOG (llevError, "%s: body_shield %d != -1\n", debug_desc (), slot [body_shield].info); + LOG (llevError, "ITEMBUG: %s: body_shield %d != -1\n", debug_desc (), slot [body_shield].info); slot [body_shield].info = -1; } break; @@ -295,19 +295,19 @@ case PLAYER: if (slot [body_shield].info != 1) { - LOG (llevError, "%s: body_shield %d != 1\n", debug_desc (), slot [body_shield].info); + LOG (llevError, "ITEMBUG: %s: body_shield %d != 1\n", debug_desc (), slot [body_shield].info); slot [body_shield].info = 1; } if (slot [body_combat].info != 1) { - LOG (llevError, "%s: body_combat %d != 1\n", debug_desc (), slot [body_combat].info); + LOG (llevError, "ITEMBUG: %s: body_combat %d != 1\n", debug_desc (), slot [body_combat].info); slot [body_combat].info = 1; } if (slot [body_range].info != 1) { - LOG (llevError, "%s: body_range %d != 1\n", debug_desc (), slot [body_range].info); + LOG (llevError, "ITEMBUG: %s: body_range %d != 1\n", debug_desc (), slot [body_range].info); slot [body_range].info = 1; } break; @@ -340,10 +340,10 @@ if (loading_arch && (type == WEAPON || type == BOW || type == ROD || type == HORN || type == WAND)) { if (!skill) - LOG (llevError, "Weapon %s lacks a skill.\n", debug_desc ()); - else if ((!strcmp (skill, "one handed weapons") && slot[body_arm].info != -1) || - (!strcmp (skill, "two handed weapons") && slot[body_arm].info != -2)) - LOG (llevError, "weapon %s arm usage does not match skill: %d, %s\n", debug_desc (), slot[body_arm].info, &skill); + LOG (llevError, "ITEMBUG: weapon %s lacks a skill.\n", debug_desc ()); + else if ((skill == shstr_one_handed_weapons && slot[body_arm].info != -1) || + (skill == shstr_two_handed_weapons && slot[body_arm].info != -2)) + LOG (llevError, "ITEMBUG: weapon %s arm usage does not match skill: %d, %s\n", debug_desc (), slot[body_arm].info, &skill); } /* We changed last_heal to gen_sp_armour, which is what it @@ -359,7 +359,7 @@ { if (last_heal) { - LOG (llevError, "Object %s still has last_heal set, not gen_sp_armour\n", debug_desc ()); + LOG (llevError, "ITEMBUG: object %s still has last_heal set, not gen_sp_armour\n", debug_desc ()); gen_sp_armour = last_heal; last_heal = 0; } @@ -370,7 +370,7 @@ if (!item_power && ip) { if (ip > 3) - LOG (llevDebug, "Object %s had no item power, using %d\n", debug_desc (), ip); + LOG (llevDebug, "ITEMBUG: Object %s had no item power, using %d\n", debug_desc (), ip); item_power = ip; } @@ -414,7 +414,7 @@ /* spellbooks & runes use slaying. But not to arch name, but to spell name */ if ((type == SPELLBOOK || type == RUNE) && slaying && !inv && !loading_arch) { - LOG (llevError, "spellbook/rune found without inv but slaying: %s", debug_desc ()); + LOG (llevError, "ITEMBUG: spellbook/rune found without inv but slaying: %s", debug_desc ()); object *tmp = get_archetype_by_object_name (slaying); insert_ob_in_ob (tmp, this); randomitems = 0; /* So another spell isn't created for this object */ @@ -426,7 +426,7 @@ { if (stats.hp > stats.maxhp) { - LOG (llevInfo, "Monster %s has hp set higher than maxhp (%d>%d)\n", debug_desc (), stats.hp, stats.maxhp); + LOG (llevInfo, "ITEMBUG: monster %s has hp set higher than maxhp (%d>%d)\n", debug_desc (), stats.hp, stats.maxhp); stats.maxhp = stats.hp; } @@ -562,11 +562,10 @@ case KW_tag: f.get_ornull (tag); break; case KW_arch: - { - object *tmp = object::read (f); - tmp->deactivate (); - + if (object *tmp = object::read (f)) { + tmp->deactivate (); + // was: insert_ob_in_ob (tmp, op); // but manually adding it can improve map loading times a lot // also, appending instead of prepending keeps the @@ -593,7 +592,9 @@ tmp->env = this; op_inv = tmp; } - } + else + LOG (llevError, "ERROR: couldn't load inventory object, file corrupted?\n"); + continue; case KW_other_arch: @@ -931,7 +932,6 @@ case KW_expmul: f.get (expmul); break; case KW_glow_radius: f.get (glow_radius); break; case KW_weapontype: f.get (weapontype); break; - case KW_tooltype: f.get (tooltype); break; case KW_casting_time: f.get (casting_time); break; // elevation is deprecated @@ -965,7 +965,12 @@ break; case KW_connected: - add_button_link (this, map, f.get_sint32 ()); + { + shstr connected; + + f.get (connected); + add_link (map, connected); + } break; case KW_randomitems: @@ -1060,7 +1065,7 @@ if (!op->parse_kv (f)) { - op->destroy (true); + op->destroy (); return 0; } @@ -1380,8 +1385,8 @@ CMP_OUT (glow_radius); if (op->flag [FLAG_IS_LINKED]) - if (int i = get_button_value (op)) - f.put (KW_connected, i); + if (auto (ol, op->find_link ())) + f.put (KW_connected, ol->id); CMP_OUT (randomitems); CMP_OUT2 (container, weight_limit); @@ -1391,7 +1396,6 @@ CMP_OUT (will_apply); CMP_OUT (smoothlevel); CMP_OUT (weapontype); - CMP_OUT (tooltype); CMP_OUT (client_type); CMP_OUT (item_power); CMP_OUT (duration);