summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/travel.cc19
-rw-r--r--crawl-ref/source/travel.h3
2 files changed, 16 insertions, 6 deletions
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index 939d4e8adc..0bc14a2134 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -2993,9 +2993,9 @@ void LevelInfo::load(FILE *file)
travel_hell_entry = si.destination;
}
+ stair_distances.clear();
if (stair_count)
{
- stair_distances.clear();
stair_distances.reserve(stair_count * stair_count);
for (int i = stair_count * stair_count - 1; i >= 0; --i)
stair_distances.push_back( readShort(file) );
@@ -3211,10 +3211,18 @@ void TravelCache::save(FILE *file) const
writeByte(file, TC_MAJOR_VERSION);
writeByte(file, TC_MINOR_VERSION);
- // How many levels do we have?
- writeShort(file, levels.size());
+ int level_count = 0;
+ for (travel_levels_map::const_iterator i = levels.begin();
+ i != levels.end(); ++i)
+ {
+ if (i->first.level_type == LEVEL_DUNGEON)
+ ++level_count;
+ }
+
+ // Write level count:
+ writeShort(file, level_count);
- // Save all the levels we have
+ // Save all the LEVEL_DUNGEON levels we have
std::map<level_id, LevelInfo>::const_iterator i =
levels.begin();
for ( ; i != levels.end(); ++i)
@@ -3240,7 +3248,8 @@ void TravelCache::load(FILE *file)
// Check version. If not compatible, we just ignore the file altogether.
unsigned char major = readByte(file),
minor = readByte(file);
- if (major != TC_MAJOR_VERSION || minor != TC_MINOR_VERSION) return ;
+ if (major != TC_MAJOR_VERSION || minor != TC_MINOR_VERSION)
+ return ;
int level_count = readShort(file);
for (int i = 0; i < level_count; ++i)
diff --git a/crawl-ref/source/travel.h b/crawl-ref/source/travel.h
index 1375b4caf6..ecda8e5a12 100644
--- a/crawl-ref/source/travel.h
+++ b/crawl-ref/source/travel.h
@@ -447,7 +447,8 @@ private:
void fixup_levels();
private:
- std::map<level_id, LevelInfo> levels;
+ typedef std::map<level_id, LevelInfo> travel_levels_map;
+ travel_levels_map levels;
level_pos waypoints[TRAVEL_WAYPOINT_COUNT];
};