--- deliantra/server/common/loader.C 2007/05/07 06:01:47 1.78 +++ deliantra/server/common/loader.C 2007/05/28 21:21:40 1.86 @@ -1,25 +1,25 @@ /* - * CrossFire, A Multiplayer game + * This file is part of Crossfire TRT, the Multiplayer Online Role Playing Game. * - * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team - * Copyright (C) 2002 Mark Wedel & Crossfire Development Team - * Copyright (C) 1992 Frank Tore Johansen + * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team + * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team + * Copyright (©) 1992,2007 Frank Tore Johansen * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Crossfire TRT is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * The authors can be reached via e-mail at + * You should have received a copy of the GNU General Public License along + * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * The authors can be reached via e-mail to */ /* Eneq(@csd.uu.se): Added weight-modifiers in environment of objects. @@ -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 @@ -382,8 +386,10 @@ * similarly, it item_power is 0, the first check will always pass, * but not the second one. */ +#if 0 //TODO if (ip > 2 * item_power && ip > (item_power + 3)) LOG (llevDebug, "Object %s seems to have too low item power? %d > %d\n", debug_desc (), ip, item_power); +#endif } /* Old spellcasting object - need to load in the appropiate object */ @@ -513,11 +519,7 @@ } } -#define GET_FLAG(op,flag) \ - if (f.get_sint32 ()) \ - SET_FLAG (op, flag); \ - else \ - CLEAR_FLAG (op, flag) \ +#define GET_FLAG(op,flg) op->flag [flg] = f.get_bool () bool object::parse_kv (object_thawer &f) @@ -772,24 +774,8 @@ 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 (f.get_bool ()) if (type != PLAYER) add_friendly_object (this); @@ -828,7 +814,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 +1123,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,