--- deliantra/server/common/map.C 2007/08/24 00:40:31 1.118 +++ deliantra/server/common/map.C 2007/09/04 05:43:20 1.124 @@ -385,21 +385,21 @@ for (int i = 0; i < size (); ++i) { - int unique = 0; + bool unique = 0; + for (object *op = spaces [i].bot; op; op = op->above) { - if (op->flag [FLAG_UNIQUE] && op->flag [FLAG_IS_FLOOR]) - unique = 1; + unique |= op->flag [FLAG_UNIQUE] && op->flag [FLAG_IS_FLOOR]; - if (!op->can_map_save ()) + if (expect_false (!op->can_map_save ())) continue; - if (unique || op->flag [FLAG_UNIQUE]) + if (expect_false (unique || op->flag [FLAG_UNIQUE])) { if (flags & IO_UNIQUES) op->write (f); } - else if (flags & IO_OBJECTS) + else if (expect_true (flags & IO_OBJECTS)) op->write (f); } } @@ -410,28 +410,6 @@ } bool -maptile::_load_objects (const char *path, bool skip_header) -{ - object_thawer f (path); - - if (!f) - return false; - - f.next (); - - if (skip_header) - for (;;) - { - keyword kw = f.kw; - f.skip (); - if (kw == KW_end) - break; - } - - return _load_objects (f); -} - -bool maptile::_save_objects (const char *path, int flags) { object_freezer freezer; @@ -613,8 +591,6 @@ { for (;;) { - thawer.next (); - switch (thawer.kw) { case KW_msg: @@ -679,10 +655,11 @@ case KW_tile_path_4: thawer.get (tile_path [3]); break; case KW_ERROR: - set_key (thawer.kw_str, thawer.value); + set_key_text (thawer.kw_str, thawer.value); break; case KW_end: + thawer.next (); return true; default: @@ -690,22 +667,13 @@ return false; break; } + + thawer.next (); } abort (); } -bool -maptile::_load_header (const char *path) -{ - object_thawer thawer (path); - - if (!thawer) - return false; - - return _load_header (thawer); -} - /****************************************************************************** * This is the start of unique map handling code *****************************************************************************/ @@ -891,7 +859,6 @@ if (QUERY_FLAG (op, FLAG_IS_FLOOR) || QUERY_FLAG (op, FLAG_OBJ_ORIGINAL) - || QUERY_FLAG (op, FLAG_OBJ_SAVE_ON_OVL) || QUERY_FLAG (op, FLAG_UNIQUE) || QUERY_FLAG (op, FLAG_OVERLAY_FLOOR) || QUERY_FLAG (op, FLAG_UNPAID) @@ -1261,7 +1228,7 @@ if (x < 0) { - if (!m->tile_available (3, 0)) + if (!m->tile_available (3)) return 1; return out_of_map (m->tile_map[3], x + m->tile_map[3]->width, y); @@ -1269,7 +1236,7 @@ if (x >= m->width) { - if (!m->tile_available (1, 0)) + if (!m->tile_available (1)) return 1; return out_of_map (m->tile_map[1], x - m->width, y); @@ -1277,7 +1244,7 @@ if (y < 0) { - if (!m->tile_available (0, 0)) + if (!m->tile_available (0)) return 1; return out_of_map (m->tile_map[0], x, y + m->tile_map[0]->height); @@ -1285,7 +1252,7 @@ if (y >= m->height) { - if (!m->tile_available (2, 0)) + if (!m->tile_available (2)) return 1; return out_of_map (m->tile_map[2], x, y - m->height); @@ -1310,7 +1277,7 @@ { if (x < 0) { - if (!tile_available (3, 1)) + if (!tile_available (3)) return 0; x += tile_map[3]->width; @@ -1319,7 +1286,7 @@ if (x >= width) { - if (!tile_available (1, 1)) + if (!tile_available (1)) return 0; x -= width; @@ -1328,7 +1295,7 @@ if (y < 0) { - if (!tile_available (0, 1)) + if (!tile_available (0)) return 0; y += tile_map[0]->height; @@ -1337,7 +1304,7 @@ if (y >= height) { - if (!tile_available (2, 1)) + if (!tile_available (2)) return 0; y -= height; @@ -1360,7 +1327,7 @@ if (!map1 || !map2) return 0; - //TODO: this doesn't actually check corretcly when intermediate maps are not loaded + //TODO: this doesn't actually check correctly when intermediate maps are not loaded //fix: compare paths instead (this is likely faster, too!) if (map1 == map2) {