--- deliantra/server/common/loader.C 2007/04/17 18:24:29 1.69 +++ deliantra/server/common/loader.C 2007/05/07 03:05:58 1.76 @@ -1,5 +1,5 @@ /* - * CrossFire, A Multiplayer game for X-windows + * CrossFire, A Multiplayer game * * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team * Copyright (C) 2002 Mark Wedel & Crossfire Development Team @@ -295,9 +295,9 @@ { if (!op->skill) LOG (llevError, "Weapon %s lacks a skill.\n", op->debug_desc ()); - else if ((!strcmp (op->skill, "one handed weapons") && op->body_info[1] != -1) || - (!strcmp (op->skill, "two handed weapons") && op->body_info[1] != -2)) - LOG (llevError, "weapon %s arm usage does not match skill: %d, %s\n", op->debug_desc (), op->body_info[1], &op->skill); + else if ((!strcmp (op->skill, "one handed weapons") && op->slot[1].info != -1) || + (!strcmp (op->skill, "two handed weapons") && op->slot[1].info != -2)) + LOG (llevError, "weapon %s arm usage does not match skill: %d, %s\n", op->debug_desc (), op->slot[1].info, &op->skill); } /* We changed last_heal to gen_sp_armour, which is what it @@ -420,6 +420,7 @@ { "fly_high", MOVE_FLY_HIGH }, { "swim" , MOVE_SWIM }, { "boat" , MOVE_BOAT }, + { "ship" , MOVE_SHIP }, { "all" , MOVE_ALL }, }; @@ -475,13 +476,6 @@ bool object::parse_kv (object_thawer &f) { - assert (f.kw == KW_object || f.kw == KW_arch); - - if (f.kw == KW_object) - f.get (name); // preset name from object name - - f.next (); - object *op_inv = inv; for (;;) @@ -841,6 +835,8 @@ case KW_berserk: GET_FLAG (this, FLAG_BERSERK); break; case KW_is_buildable: GET_FLAG (this, FLAG_IS_BUILDABLE); break; case KW_destroy_on_death: GET_FLAG (this, FLAG_DESTROY_ON_DEATH); break; + case KW_treasure_env: GET_FLAG (this, FLAG_TREASURE_ENV); break; + case KW_precious: GET_FLAG (this, FLAG_PRECIOUS); break; case KW_armour: f.get (resist[ATNR_PHYSICAL]); break; case KW_resist_physical: f.get (resist[ATNR_PHYSICAL]); break; @@ -896,18 +892,18 @@ //TODO: mechanism to ensure that KW_xxx is consecutive needed from include/preprocess //TODO: parse from other include files - case KW_body_range: f.get (body_info[0]); break; - case KW_body_arm: f.get (body_info[1]); break; - case KW_body_torso: f.get (body_info[2]); break; - case KW_body_head: f.get (body_info[3]); break; - case KW_body_neck: f.get (body_info[4]); break; - case KW_body_skill: f.get (body_info[5]); break; - case KW_body_finger: f.get (body_info[6]); break; - case KW_body_shoulder: f.get (body_info[7]); break; - case KW_body_foot: f.get (body_info[8]); break; - case KW_body_hand: f.get (body_info[9]); break; - case KW_body_wrist: f.get (body_info[10]); break; - case KW_body_waist: f.get (body_info[11]); break; + case KW_body_range: slot[ 0].info = f.get_sint32 (); break; + case KW_body_arm: slot[ 1].info = f.get_sint32 (); break; + case KW_body_torso: slot[ 2].info = f.get_sint32 (); break; + case KW_body_head: slot[ 3].info = f.get_sint32 (); break; + case KW_body_neck: slot[ 4].info = f.get_sint32 (); break; + case KW_body_skill: slot[ 5].info = f.get_sint32 (); break; + case KW_body_finger: slot[ 6].info = f.get_sint32 (); break; + case KW_body_shoulder: slot[ 7].info = f.get_sint32 (); break; + case KW_body_foot: slot[ 8].info = f.get_sint32 (); break; + case KW_body_hand: slot[ 9].info = f.get_sint32 (); break; + case KW_body_wrist: slot[10].info = f.get_sint32 (); break; + case KW_body_waist: slot[11].info = f.get_sint32 (); break; case KW_can_apply: break; @@ -926,6 +922,8 @@ if (!randomitems) LOG (llevError, "%s uses unknown randomitems '%s'.\n", debug_desc (), f.get_str ()); } + else + randomitems = 0; break; case KW_msg: @@ -992,6 +990,8 @@ assert (arch); //D maybe use exception handling of sorts? + f.next (); + object *op = object::create (); op->map = map; @@ -1019,7 +1019,7 @@ { object_thawer f (buf, (AV *)0); - f.kw = KW_arch; // special hack so that parse_kv skips + f.next (); return op->parse_kv (f); } @@ -1110,7 +1110,7 @@ KW_generator, KW_is_thrown, KW_auto_apply, - KW_NULL, // was KW_treasure + KW_treasure_env, KW_player_sold, /* 20 */ KW_see_invisible, @@ -1181,7 +1181,7 @@ /* 80 */ KW_has_ready_scroll, KW_can_use_rod, - KW_NULL, + KW_precious, KW_can_use_horn, KW_make_invisible, KW_inv_locked, @@ -1367,8 +1367,8 @@ /* Save body locations */ for (i = 0; i < NUM_BODY_LOCATIONS; i++) - if (op->body_info[i] != tmp->body_info[i]) - f.put (body_locations[i].save_name, op->body_info[i]); + if (op->slot[i].info != tmp->slot[i].info) + f.put (body_locations[i].save_name, op->slot[i].info); } /* @@ -1402,11 +1402,14 @@ ///////////////////////////////////////////////////////////////////////////// // generic resource file load, -// currently supports: region, treasures +// currently supports: region, treasures, archetypes bool load_resource_file (const char *filename) { object_thawer f (filename); + bool success = false; + bool seen_arch = false; + f.next (); for (;;) @@ -1415,22 +1418,38 @@ { case KW_region: if (!region::read (f)) - return false; + goto finish; break; case KW_treasure: case KW_treasureone: if (!treasurelist::read (f)) - return false; + goto finish; + break; + + case KW_object: + seen_arch = true; + if (!archetype::read (f)) + goto finish; break; case KW_EOF: - return true; + success = true; + goto finish; default: if (!f.parse_error ("resource file")) - return false; + goto finish; + + f.next (); + break; } } + +finish: + if (seen_arch) + init_archetype_pointers (); + + return success; }