diff options
author | smatz <smatz@openttd.org> | 2009-01-03 16:06:58 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-01-03 16:06:58 +0000 |
commit | 254e19da91309da11416c69ae7899dc11e608df0 (patch) | |
tree | cfe8a97df4f219709152bb304eee65541e9ab8db /src/oldloader.cpp | |
parent | 21308de6cb2995912d67af4ae704a8870d90e156 (diff) | |
download | openttd-254e19da91309da11416c69ae7899dc11e608df0.tar.xz |
(svn r14807) -Codechange: use INVALID_TILE instead of 0 to mark invalid depots, industries, towns and waypoints
Diffstat (limited to 'src/oldloader.cpp')
-rw-r--r-- | src/oldloader.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/oldloader.cpp b/src/oldloader.cpp index a94824978..cb55afc50 100644 --- a/src/oldloader.cpp +++ b/src/oldloader.cpp @@ -490,7 +490,12 @@ static const OldChunks town_chunk[] = { }; static bool LoadOldTown(LoadgameState *ls, int num) { - return LoadChunk(ls, new (num) Town(), town_chunk); + Town *t = new (num) Town(); + if (!LoadChunk(ls, t, town_chunk)) return false; + + if (t->xy == 0) t->xy = INVALID_TILE; + + return true; } static uint16 _old_order; @@ -545,10 +550,13 @@ static const OldChunks depot_chunk[] = { static bool LoadOldDepot(LoadgameState *ls, int num) { - if (!LoadChunk(ls, new (num) Depot(), depot_chunk)) return false; + Depot *d = new (num) Depot(); + if (!LoadChunk(ls, d, depot_chunk)) return false; - if (IsValidDepotID(num)) { + if (d->xy != 0) { GetDepot(num)->town_index = REMAP_TOWN_IDX(_old_town_index); + } else { + d->xy = INVALID_TILE; } return true; @@ -732,9 +740,11 @@ static bool LoadOldIndustry(LoadgameState *ls, int num) Industry *i = new (num) Industry(); if (!LoadChunk(ls, i, industry_chunk)) return false; - if (i->IsValid()) { + if (i->xy != 0) { i->town = GetTown(REMAP_TOWN_IDX(_old_town_index)); IncIndustryTypeCount(i->type); + } else { + i->xy = INVALID_TILE; } return true; |