--- deliantra/server/common/loader.C 2007/05/07 06:01:47 1.78 +++ deliantra/server/common/loader.C 2007/05/19 00:08:11 1.83 @@ -262,50 +262,59 @@ void object::post_load_check () { - // as a kind of a hack, we now adjust the range, shield and combat slots + if (type >= NUM_TYPES) + { + LOG (llevError, "%s: type out of range, resetting to 0.\n", debug_desc ()); + type = 0; + } + switch (type) { case BOW: case WAND: case ROD: case HORN: - case SKILL: // maybe have to think about this one, as skills get applied togethr with their governing weapons - case SKILL_TOOL: - if (slot [body_range].info != 1) + if (slot [body_range].info != -1) { - LOG (llevInfo, "%s: body_range %d != 1\n", debug_desc (), slot [body_range].info); - slot [body_range].info = 1; + LOG (llevError, "%s: body_range %d != -1\n", debug_desc (), slot [body_range].info); + slot [body_range].info = -1; } break; case WEAPON: - if (slot [body_combat].info != 1) + if (slot [body_combat].info != -1) { - LOG (llevInfo, "%s: body_combat %d != 1\n", debug_desc (), slot [body_combat].info); - slot [body_combat].info = 1; + LOG (llevError, "%s: body_combat %d != -1\n", debug_desc (), slot [body_combat].info); + slot [body_combat].info = -1; } break; case SHIELD: - if (slot [body_shield].info != 1) + if (slot [body_shield].info != -1) { - LOG (llevInfo, "%s: body_shield %d != 1\n", debug_desc (), slot [body_shield].info); - slot [body_shield].info = 1; + LOG (llevError, "%s: body_shield %d != -1\n", debug_desc (), slot [body_shield].info); + slot [body_shield].info = -1; } break; case PLAYER: if (slot [body_shield].info != 1) { - LOG (llevInfo, "%s: body_shield %d != 1\n", debug_desc (), slot [body_shield].info); + LOG (llevError, "%s: body_shield %d != 1\n", debug_desc (), slot [body_shield].info); slot [body_shield].info = 1; } if (slot [body_combat].info != 1) { - LOG (llevInfo, "%s: body_shield %d != 1\n", debug_desc (), slot [body_combat].info); + LOG (llevError, "%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); + slot [body_range].info = 1; + } break; } @@ -326,12 +335,7 @@ /* objects now have a materialname. try to patch it in */ if (!(is_weapon () && level > 0)) - { - if (map != NULL) - set_materialname (this, map->difficulty, NULL); - else - set_materialname (this, 5, NULL); - } + set_materialname (this, map ? map->difficulty : 5, 0); /* only do these when program is first run - a bit * excessive to do this at every run - most of this is @@ -772,22 +776,6 @@ break; - case KW_wiz: - GET_FLAG (this, FLAG_WIZ); - //TODO: move to check_object - if (QUERY_FLAG (this, FLAG_WIZ)) - { - SET_FLAG (this, FLAG_WAS_WIZ); - SET_FLAG (this, FLAG_WIZPASS); - SET_FLAG (this, FLAG_WIZCAST); - } - else - { - CLEAR_FLAG (this, FLAG_WIZPASS); - CLEAR_FLAG (this, FLAG_WIZCAST); - } - break; - case KW_friendly: if (f.get_sint32 ()) if (type != PLAYER) @@ -828,7 +816,6 @@ case KW_no_magic: GET_FLAG (this, FLAG_NO_MAGIC); break; case KW_no_drop: GET_FLAG (this, FLAG_NO_DROP); break; case KW_random_movement: GET_FLAG (this, FLAG_RANDOM_MOVE); break; - case KW_was_wiz: GET_FLAG (this, FLAG_WAS_WIZ); break; case KW_no_fix_player: GET_FLAG (this, FLAG_NO_FIX_PLAYER); break; case KW_is_lightable: GET_FLAG (this, FLAG_IS_LIGHTABLE); break; case KW_tear_down: GET_FLAG (this, FLAG_TEAR_DOWN); break; @@ -1138,10 +1125,10 @@ */ static const keyword flag_names [NUM_FLAGS] = { KW_alive, - KW_wiz, KW_NULL, KW_NULL, - KW_was_wiz, + KW_NULL, + KW_NULL, KW_applied, KW_unpaid, KW_can_use_shield,