diff options
author | truelight <truelight@openttd.org> | 2006-08-22 15:33:35 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2006-08-22 15:33:35 +0000 |
commit | 0461d896123b918b492a3d16439bb46b041528cd (patch) | |
tree | 618708068f10739a382af83313db9c96b4744ef5 /oldloader.c | |
parent | 4c2abf1de53e28a5c3c6c6920efabc4653693c4c (diff) | |
download | openttd-0461d896123b918b492a3d16439bb46b041528cd.tar.xz |
(svn r6047) -Codechange: FOR_ALL now _only_ loops valid items, and skips invalid ones
-Codechange: use IsValidXXX where ever possible
Note: both changes to prepare for new pool system, which needs those changes.
For every pool there are 2 ugly lines, which will be removed when done
implementing new pool system.
Based on FS#13 by blathijs, partly implemented.
Diffstat (limited to 'oldloader.c')
-rw-r--r-- | oldloader.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/oldloader.c b/oldloader.c index 9bb33eb1f..8a8a4c59d 100644 --- a/oldloader.c +++ b/oldloader.c @@ -294,8 +294,6 @@ static void FixOldTowns(void) /* Convert town-names if needed */ FOR_ALL_TOWNS(town) { - if (town->xy == 0) continue; - if (IS_INT_INSIDE(town->townnametype, 0x20C1, 0x20C3)) { town->townnametype = SPECSTR_TOWNNAME_ENGLISH + _opt.town_name; town->townnameparts = GetOldTownName(town->townnameparts, _opt.town_name); @@ -346,11 +344,7 @@ static void FixOldVehicles(void) FOR_ALL_VEHICLES(v) { Vehicle *u; - if (v->type == 0) continue; - FOR_ALL_VEHICLES_FROM(u, v->index + 1) { - if (u->type == 0) continue; - /* If a vehicle has the same orders, add the link to eachother * in both vehicles */ if (v->orders == u->orders) { @@ -532,7 +526,7 @@ static bool LoadOldDepot(LoadgameState *ls, int num) if (!LoadChunk(ls, GetDepot(num), depot_chunk)) return false; - if (GetDepot(num)->xy != 0) { + if (IsValidDepot(GetDepot(num))) { GetDepot(num)->town_index = REMAP_TOWN_IDX(_old_town_index); } @@ -650,7 +644,7 @@ static bool LoadOldStation(LoadgameState *ls, int num) if (!LoadChunk(ls, st, station_chunk)) return false; - if (st->xy != 0) { + if (IsValidStation(st)) { if (st->train_tile) { /* Calculate the trainst_w and trainst_h */ uint w = GB(_old_platforms, 3, 3); @@ -721,7 +715,7 @@ static bool LoadOldIndustry(LoadgameState *ls, int num) i = GetIndustry(num); if (!LoadChunk(ls, i, industry_chunk)) return false; - if (i->xy != 0) { + if (IsValidIndustry(i)) { i->town = GetTown(REMAP_TOWN_IDX(_old_town_index)); } |