summaryrefslogtreecommitdiff
path: root/disaster_cmd.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
commit0461d896123b918b492a3d16439bb46b041528cd (patch)
tree618708068f10739a382af83313db9c96b4744ef5 /disaster_cmd.c
parent4c2abf1de53e28a5c3c6c6920efabc4653693c4c (diff)
downloadopenttd-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 'disaster_cmd.c')
-rw-r--r--disaster_cmd.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/disaster_cmd.c b/disaster_cmd.c
index b580403d1..ea1f3cf97 100644
--- a/disaster_cmd.c
+++ b/disaster_cmd.c
@@ -724,7 +724,7 @@ static void Disaster0_Init(void)
x = TileX(Random()) * TILE_SIZE + TILE_SIZE / 2;
FOR_ALL_STATIONS(st) {
- if (st->xy && st->airport_tile != 0 &&
+ if (st->airport_tile != 0 &&
st->airport_type <= 1 &&
IS_HUMAN_PLAYER(st->owner)) {
x = (TileX(st->xy) + 2) * TILE_SIZE;
@@ -774,8 +774,7 @@ static void Disaster2_Init(void)
found = NULL;
FOR_ALL_INDUSTRIES(i) {
- if (i->xy != 0 &&
- i->type == IT_OIL_REFINERY &&
+ if (i->type == IT_OIL_REFINERY &&
(found == NULL || CHANCE16(1, 2))) {
found = i;
}
@@ -808,8 +807,7 @@ static void Disaster3_Init(void)
found = NULL;
FOR_ALL_INDUSTRIES(i) {
- if (i->xy != 0 &&
- i->type == IT_FACTORY &&
+ if (i->type == IT_FACTORY &&
(found==NULL || CHANCE16(1,2))) {
found = i;
}
@@ -919,7 +917,7 @@ static void Disaster7_Init(void)
const Industry* i;
FOR_ALL_INDUSTRIES(i) {
- if (i->xy != 0 && i->type == IT_COAL_MINE && --index < 0) {
+ if (i->type == IT_COAL_MINE && --index < 0) {
SetDParam(0, i->town->index);
AddNewsItem(STR_B005_COAL_MINE_SUBSIDENCE_LEAVES,
NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy + TileDiffXY(1, 1), 0);