--- deliantra/server/common/loader.C 2007/05/07 07:47:32 1.79 +++ deliantra/server/common/loader.C 2007/06/06 05:41:25 1.89 @@ -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,18 +262,21 @@ 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) { - LOG (llevInfo, "%s: body_range %d != -1\n", debug_desc (), slot [body_range].info); + LOG (llevError, "%s: body_range %d != -1\n", debug_desc (), slot [body_range].info); slot [body_range].info = -1; } break; @@ -281,7 +284,7 @@ case WEAPON: if (slot [body_combat].info != -1) { - LOG (llevInfo, "%s: body_combat %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; } break; @@ -289,7 +292,7 @@ case SHIELD: 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; } break; @@ -297,19 +300,19 @@ 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_combat %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 (llevInfo, "%s: body_range %d != 1\n", debug_desc (), slot [body_range].info); + LOG (llevError, "%s: body_range %d != 1\n", debug_desc (), slot [body_range].info); slot [body_range].info = 1; } break; @@ -324,7 +327,7 @@ * Otherwise, what happens is that the the plural name will lose * information (appear as just 'hearts' and not 'goblins heart') */ - if (arch && name != arch->clone.name && name_pl == arch->clone.name_pl) + if (arch && name != arch->object::name && name_pl == arch->object::name_pl) name_pl = 0; if (!name_pl) @@ -383,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 */ @@ -407,7 +412,7 @@ insert_ob_in_ob (tmp, this); randomitems = NULL; /* So another spell isn't created for this object */ /* without this, value is all screwed up */ - value = arch->clone.value * inv->value; + value = arch->value * inv->value; } if (QUERY_FLAG (this, FLAG_MONSTER)) @@ -514,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) @@ -773,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); @@ -829,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; @@ -1042,7 +1026,7 @@ object *op = object::create (); op->map = map; - arch->clone.copy_to (op); + arch->copy_to (op); // copy_to activates, this should be fixed properly op->deactivate (); @@ -1139,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, @@ -1435,8 +1419,8 @@ archetype *at = arch ? (archetype *)arch : empty_archetype; - f.put (KW_arch, at->name); - write_diff (f, this, &at->clone); + f.put (KW_arch, at->archname); + write_diff (f, this, at); for (object *tmp = inv; tmp; tmp = tmp->below) tmp->write (f);