--- deliantra/server/common/loader.C 2010/01/16 13:41:37 1.151 +++ deliantra/server/common/loader.C 2010/04/30 20:43:18 1.158 @@ -2,8 +2,8 @@ * This file is part of Deliantra, the Roguelike Realtime MMORPG. * * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team - * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team - * Copyright (©) 1992,2007 Frank Tore Johansen + * Copyright (©) 2002 Mark Wedel & Crossfire Development Team + * Copyright (©) 1992 Frank Tore Johansen * * Deliantra is free software: you can redistribute it and/or modify it under * the terms of the Affero GNU General Public License as published by the @@ -396,7 +396,7 @@ #endif } - /* old style spellcasting object (pretty common) - need to load in the appropiate object */ + /* old style spellcasting object (pretty common) - need to load in the appropriate object */ /* (schmorp) old really doesn't mean old, imho, just a more compact way to store such objects */ if ((type == ROD || type == WAND @@ -431,7 +431,7 @@ value = arch->value * inv->value; } - if (QUERY_FLAG (this, FLAG_MONSTER)) + if (this->flag [FLAG_MONSTER]) { if (stats.hp > stats.maxhp) { @@ -444,7 +444,7 @@ move_type = MOVE_WALK; } - if ((QUERY_FLAG (this, FLAG_GENERATOR) && QUERY_FLAG (this, FLAG_CONTENT_ON_GEN)) || type == CREATOR || type == CONVERTER) + if ((this->flag [FLAG_GENERATOR] && this->flag [FLAG_CONTENT_ON_GEN]) || type == CREATOR || type == CONVERTER) /* Object will duplicate it's content as part of the * generation process. To do this, we must flag inventory * so it remains unevaluated concerning the randomitems and @@ -524,7 +524,7 @@ str++; } - for (const flagstr *f = move_flags; f < move_flags + sizeof (move_flags) / sizeof (move_flags [0]); ++f) + for (const flagstr *f = move_flags; f < move_flags + array_length (move_flags); ++f) { if (!strcmp (f->name, str)) { @@ -590,8 +590,8 @@ // also, appending instead of prepending keeps the // save ordering the same between repeated load/saves. // and finally we do not want any funny effects - CLEAR_FLAG (tmp, FLAG_OBJ_ORIGINAL); - CLEAR_FLAG (tmp, FLAG_REMOVED); + tmp->clr_flag (FLAG_OBJ_ORIGINAL); + tmp->clr_flag (FLAG_REMOVED); if (!op_inv) { @@ -634,11 +634,11 @@ case KW_animation: { - CLEAR_FLAG (this, FLAG_ANIMATE); + this->clr_flag (FLAG_ANIMATE); animation_id = 0; if (f.has_value () && (animation_id = find_animation (f.get_str ()))) - SET_FLAG (this, FLAG_ANIMATE); //TODO: should not be forced to true here + this->set_flag (FLAG_ANIMATE); //TODO: should not be forced to true here } break; @@ -738,14 +738,7 @@ case KW_state: f.get (state); break; case KW_move_slow_penalty: f.get (move_slow_penalty); break; case KW_material: f.get (materials); break; //TODO: nuke - - case KW_materialname: - { - shstr sh; - f.get (sh); - material = name_to_material (sh); - } - break; + case KW_materialname: f.get (material); break; /* These are the new values */ case KW_move_block: set_move (move_block, f); break; @@ -826,8 +819,8 @@ case KW_identified: GET_FLAG (this, FLAG_IDENTIFIED); //TODO: move to check_object or so - if (QUERY_FLAG (this, FLAG_IDENTIFIED)) - CLEAR_FLAG (this, FLAG_KNOWN_MAGICAL); + if (this->flag [FLAG_IDENTIFIED]) + this->clr_flag (FLAG_KNOWN_MAGICAL); break; @@ -1342,7 +1335,8 @@ CMP_OUT (custom_name); if (object *owner = op->owner) - f.put (KW(owner), static_cast(owner->ref ())); + if (const char *ref = owner->ref ()) + f.put (KW(owner), ref); // memory, attacked_by, chosen_skill, spellitem, spell, current_weapon, arch not saved @@ -1452,6 +1446,7 @@ object::flags_t diff = (op->flag ^ arch->flag) & flagmask; +#if stdcpp // we need gcc, sorry if (diff [FLAG_OBJ_ORIGINAL]) f.put (flag_names [FLAG_OBJ_ORIGINAL], op->flag [FLAG_OBJ_ORIGINAL] ? CS(1) : CS(0)); @@ -1462,6 +1457,11 @@ for (int i = 0; i < NUM_FLAGS; i++) if (expect_false (diff [i])) f.put (flag_names [i], op->flag [i] ? CS(1) : CS(0)); +#else + // use sgi extensions + for (int i = diff._Find_first (); i < diff.size (); i = diff._Find_next (i)) + f.put (flag_names [i], op->flag [i] ? CS(1) : CS(0)); +#endif // save body locations. gcc's memcmp does an abysmal job when used for (int i = 0; i < NUM_BODY_LOCATIONS; i++)