summaryrefslogtreecommitdiff
path: root/smallmap_gui.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 /smallmap_gui.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 'smallmap_gui.c')
-rw-r--r--smallmap_gui.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/smallmap_gui.c b/smallmap_gui.c
index 96ef78a13..337ac4e05 100644
--- a/smallmap_gui.c
+++ b/smallmap_gui.c
@@ -696,7 +696,7 @@ skip_column:
byte color;
FOR_ALL_VEHICLES(v) {
- if (v->type != 0 && v->type != VEH_Special &&
+ if (v->type != VEH_Special &&
(v->vehstatus & (VS_HIDDEN | VS_UNCLICKABLE)) == 0) {
// Remap into flat coordinates.
Point pt = RemapCoords(
@@ -742,24 +742,22 @@ skip_column:
const Town *t;
FOR_ALL_TOWNS(t) {
- if (t->xy != 0) {
- // Remap the town coordinate
- Point pt = RemapCoords(
- (int)(TileX(t->xy) * TILE_SIZE - WP(w, smallmap_d).scroll_x) / TILE_SIZE,
- (int)(TileY(t->xy) * TILE_SIZE - WP(w, smallmap_d).scroll_y) / TILE_SIZE,
- 0);
- x = pt.x - WP(w,smallmap_d).subscroll + 3 - (t->sign.width_2 >> 1);
- y = pt.y;
-
- // Check if the town sign is within bounds
- if (x + t->sign.width_2 > dpi->left &&
- x < dpi->left + dpi->width &&
- y + 6 > dpi->top &&
- y < dpi->top + dpi->height) {
- // And draw it.
- SetDParam(0, t->index);
- DrawString(x, y, STR_2056, 12);
- }
+ // Remap the town coordinate
+ Point pt = RemapCoords(
+ (int)(TileX(t->xy) * TILE_SIZE - WP(w, smallmap_d).scroll_x) / TILE_SIZE,
+ (int)(TileY(t->xy) * TILE_SIZE - WP(w, smallmap_d).scroll_y) / TILE_SIZE,
+ 0);
+ x = pt.x - WP(w,smallmap_d).subscroll + 3 - (t->sign.width_2 >> 1);
+ y = pt.y;
+
+ // Check if the town sign is within bounds
+ if (x + t->sign.width_2 > dpi->left &&
+ x < dpi->left + dpi->width &&
+ y + 6 > dpi->top &&
+ y < dpi->top + dpi->height) {
+ // And draw it.
+ SetDParam(0, t->index);
+ DrawString(x, y, STR_2056, 12);
}
}
}