summaryrefslogtreecommitdiff
path: root/oldloader.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2006-08-22 15:33:35 +0000
committertruelight <truelight@openttd.org>2006-08-22 15:33:35 +0000
commit505566da5ca515428eed3b618f2f67aac2077f32 (patch)
tree618708068f10739a382af83313db9c96b4744ef5 /oldloader.c
parent650b9be724863bb91a2bd0b25d4e26858bc8b3fa (diff)
downloadopenttd-505566da5ca515428eed3b618f2f67aac2077f32.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.c12
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));
}