summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--aircraft_gui.c24
-rw-r--r--clear_cmd.c5
-rw-r--r--pathfind.c16
-rw-r--r--rail_cmd.c3
-rw-r--r--road_cmd.c3
-rw-r--r--roadveh_cmd.c9
-rw-r--r--roadveh_gui.c28
-rw-r--r--ship_gui.c26
-rw-r--r--train_cmd.c6
-rw-r--r--train_gui.c34
10 files changed, 59 insertions, 95 deletions
diff --git a/aircraft_gui.c b/aircraft_gui.c
index 2fd970443..df8ba122d 100644
--- a/aircraft_gui.c
+++ b/aircraft_gui.c
@@ -641,7 +641,7 @@ static void DrawAircraftDepotWindow(Window *w)
num = 0;
FOR_ALL_VEHICLES(v) {
if (v->type == VEH_Aircraft && v->subtype <= 2 && v->vehstatus&VS_HIDDEN &&
- v->tile == (TileIndex)tile)
+ v->tile == tile)
num++;
}
SetVScrollCount(w, (num + w->hscroll.cap - 1) / w->hscroll.cap);
@@ -657,7 +657,7 @@ static void DrawAircraftDepotWindow(Window *w)
if (v->type == VEH_Aircraft &&
v->subtype <= 2 &&
v->vehstatus&VS_HIDDEN &&
- v->tile == (TileIndex)tile &&
+ v->tile == tile &&
--num < 0 && num >= -w->vscroll.cap * w->hscroll.cap) {
DrawAircraftImage(v, x+12, y, WP(w,traindepot_d).sel);
@@ -695,20 +695,14 @@ static int GetVehicleFromAircraftDepotWndPt(Window *w, int x, int y, Vehicle **v
tile = w->window_number;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Aircraft &&
- v->subtype <= 2 &&
- v->vehstatus&VS_HIDDEN &&
- v->tile == (TileIndex)tile &&
+ if (v->type == VEH_Aircraft && v->subtype <= 2 &&
+ v->vehstatus & VS_HIDDEN && v->tile == tile &&
--pos < 0) {
- *veh = v;
- if (xm >= 12)
- return 0;
-
- if (ym <= 12)
- return -1; /* show window */
-
- return -2; /* start stop */
- }
+ *veh = v;
+ if (xm >= 12) return 0;
+ if (ym <= 12) return -1; /* show window */
+ return -2; /* start stop */
+ }
}
return 1; /* outside */
}
diff --git a/clear_cmd.c b/clear_cmd.c
index 6223c9a3d..17ad83849 100644
--- a/clear_cmd.c
+++ b/clear_cmd.c
@@ -167,13 +167,12 @@ static bool TerraformTileHeight(TerraformerState *ts, TileIndex tile, int height
ts->modheight_count++;
break;
}
- if (mod->tile == (TileIndex)tile)
- break;
+ if (mod->tile == tile) break;
mod++;
count--;
}
- mod->tile = (TileIndex)tile;
+ mod->tile = tile;
mod->height = (byte)height;
ts->cost += _price.terraform;
diff --git a/pathfind.c b/pathfind.c
index 9134b3030..376c584fd 100644
--- a/pathfind.c
+++ b/pathfind.c
@@ -22,12 +22,12 @@ static bool TPFSetTileBit(TrackPathFinder *tpf, TileIndex tile, int dir)
/* unused hash entry, set the appropriate bit in it and return true
* to indicate that a bit was set. */
tpf->hash_head[hash] = bits;
- tpf->hash_tile[hash] = (TileIndex)tile;
+ tpf->hash_tile[hash] = tile;
return true;
} else if (!(val & 0x8000)) {
/* single tile */
- if ( (TileIndex)tile == tpf->hash_tile[hash] ) {
+ if (tile == tpf->hash_tile[hash]) {
/* found another bit for the same tile,
* check if this bit is already set, if so, return false */
if (val & bits)
@@ -65,7 +65,7 @@ static bool TPFSetTileBit(TrackPathFinder *tpf, TileIndex tile, int dir)
offs = tpf->hash_tile[hash];
do {
link = PATHFIND_GET_LINK_PTR(tpf, offs);
- if ( (TileIndex)tile == link->tile) {
+ if (tile == link->tile) {
/* found the tile in the link list,
* check if the bit was alrady set, if so return false to indicate that the
* bit was already set */
@@ -86,7 +86,7 @@ static bool TPFSetTileBit(TrackPathFinder *tpf, TileIndex tile, int dir)
/* then fill the link with the new info, and establish a ptr from the old
* link to the new one */
- new_link->tile = (TileIndex)tile;
+ new_link->tile = tile;
new_link->flags = bits;
new_link->next = 0xFFFF;
@@ -531,7 +531,7 @@ static bool NtpVisit(NewTrackPathFinder *tpf, TileIndex tile, uint dir, uint len
}
if (head != 0xffff) {
- if ( (TileIndex)tile == tpf->hash_tile[hash] && (head & 0x3) == dir ) {
+ if (tile == tpf->hash_tile[hash] && (head & 0x3) == dir) {
// longer length
if (length >= (head >> 2)) return false;
@@ -563,7 +563,7 @@ static bool NtpVisit(NewTrackPathFinder *tpf, TileIndex tile, uint dir, uint len
uint offs = tpf->hash_tile[hash];
do {
link = NTP_GET_LINK_PTR(tpf, offs);
- if ( (TileIndex)tile == link->tile && (uint)(link->typelength & 0x3) == dir) {
+ if (tile == link->tile && (uint)(link->typelength & 0x3) == dir) {
if (length >= (uint)(link->typelength >> 2)) return false;
link->typelength = dir | (length << 2);
return true;
@@ -580,7 +580,7 @@ static bool NtpVisit(NewTrackPathFinder *tpf, TileIndex tile, uint dir, uint len
/* then fill the link with the new info, and establish a ptr from the old
* link to the new one */
- new_link->tile = (TileIndex)tile;
+ new_link->tile = tile;
new_link->typelength = dir | (length << 2);
new_link->next = 0xFFFF;
@@ -607,7 +607,7 @@ static bool NtpCheck(NewTrackPathFinder *tpf, TileIndex tile, uint dir, uint len
offs = tpf->hash_tile[hash];
for(;;) {
link = NTP_GET_LINK_PTR(tpf, offs);
- if ( (TileIndex)tile == link->tile && (uint)(link->typelength & 0x3) == dir) {
+ if (tile == link->tile && (uint)(link->typelength & 0x3) == dir) {
assert( (uint)(link->typelength >> 2) <= length);
return length == (uint)(link->typelength >> 2);
}
diff --git a/rail_cmd.c b/rail_cmd.c
index 0d36421b5..a4ea4c21b 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -663,8 +663,7 @@ int32 CmdBuildTrainDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2)
return CMD_ERROR;
if (flags & DC_EXEC) {
- if (_current_player == _local_player)
- _last_built_train_depot_tile = (TileIndex)tile;
+ if (_current_player == _local_player) _last_built_train_depot_tile = tile;
ModifyTile(tile,
MP_SETTYPE(MP_RAILWAY) |
diff --git a/road_cmd.c b/road_cmd.c
index f5c1beac4..2b954ed23 100644
--- a/road_cmd.c
+++ b/road_cmd.c
@@ -644,8 +644,7 @@ int32 CmdBuildRoadDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2)
return CMD_ERROR;
if (flags & DC_EXEC) {
- if (_current_player == _local_player)
- _last_built_road_depot_tile = (TileIndex)tile;
+ if (_current_player == _local_player) _last_built_road_depot_tile = tile;
dep->xy = tile;
dep->town_index = ClosestTownFromTile(tile, (uint)-1)->index;
diff --git a/roadveh_cmd.c b/roadveh_cmd.c
index cf88344c6..f8854ead1 100644
--- a/roadveh_cmd.c
+++ b/roadveh_cmd.c
@@ -907,11 +907,8 @@ typedef struct OvertakeData {
static void *EnumFindVehToOvertake(Vehicle *v, OvertakeData *od)
{
- if (v->tile != (TileIndex)od->tile ||
- v->type != VEH_Road ||
- v == od->u ||
- v == od->v)
- return NULL;
+ if (v->tile != od->tile || v->type != VEH_Road || v == od->u || v == od->v)
+ return NULL;
return v;
}
@@ -1079,7 +1076,7 @@ static int RoadFindPathToDest(Vehicle *v, TileIndex tile, int enterdir)
if (v->u.road.reverse_ctr != 0) {
/* What happens here?? */
v->u.road.reverse_ctr = 0;
- if (v->tile != (TileIndex)tile) {
+ if (v->tile != tile) {
return_track(_road_reverse_table[enterdir]);
}
}
diff --git a/roadveh_gui.c b/roadveh_gui.c
index bb97d9289..e715cd9f3 100644
--- a/roadveh_gui.c
+++ b/roadveh_gui.c
@@ -540,9 +540,8 @@ static void DrawRoadDepotWindow(Window *w)
/* determine amount of items for scroller */
num = 0;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Road && v->u.road.state == 254 &&
- v->tile == (TileIndex)tile)
- num++;
+ if (v->type == VEH_Road && v->u.road.state == 254 && v->tile == tile)
+ num++;
}
SetVScrollCount(w, (num + w->hscroll.cap - 1) / w->hscroll.cap);
@@ -558,11 +557,8 @@ static void DrawRoadDepotWindow(Window *w)
num = w->vscroll.pos * w->hscroll.cap;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Road &&
- v->u.road.state == 254 &&
- v->tile == (TileIndex)tile &&
+ if (v->type == VEH_Road && v->u.road.state == 254 && v->tile == tile &&
--num < 0 && num >= -w->vscroll.cap * w->hscroll.cap) {
-
DrawRoadVehImage(v, x+24, y, WP(w,traindepot_d).sel);
SetDParam(0, v->unitnumber);
@@ -598,19 +594,13 @@ static int GetVehicleFromRoadDepotWndPt(Window *w, int x, int y, Vehicle **veh)
tile = w->window_number;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Road &&
- v->u.road.state == 254 &&
- v->tile == (TileIndex)tile &&
+ if (v->type == VEH_Road && v->u.road.state == 254 && v->tile == tile &&
--pos < 0) {
- *veh = v;
- if (xm >= 24)
- return 0;
-
- if (xm <= 16)
- return -1; /* show window */
-
- return -2; /* start stop */
- }
+ *veh = v;
+ if (xm >= 24) return 0;
+ if (xm <= 16) return -1; /* show window */
+ return -2; /* start stop */
+ }
}
return 1; /* outside */
diff --git a/ship_gui.c b/ship_gui.c
index 392526dce..f27bf458c 100644
--- a/ship_gui.c
+++ b/ship_gui.c
@@ -616,9 +616,8 @@ static void DrawShipDepotWindow(Window *w)
/* determine amount of items for scroller */
num = 0;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Ship && v->u.ship.state == 0x80 &&
- v->tile == (TileIndex)tile)
- num++;
+ if (v->type == VEH_Ship && v->u.ship.state == 0x80 && v->tile == tile)
+ num++;
}
SetVScrollCount(w, (num + w->hscroll.cap - 1) / w->hscroll.cap);
@@ -634,11 +633,8 @@ static void DrawShipDepotWindow(Window *w)
num = w->vscroll.pos * w->hscroll.cap;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Ship &&
- v->u.ship.state == 0x80 &&
- v->tile == (TileIndex)tile &&
+ if (v->type == VEH_Ship && v->u.ship.state == 0x80 && v->tile == tile &&
--num < 0 && num >= -w->vscroll.cap * w->hscroll.cap) {
-
DrawShipImage(v, x+19, y, WP(w,traindepot_d).sel);
SetDParam(0, v->unitnumber);
@@ -675,17 +671,13 @@ static int GetVehicleFromShipDepotWndPt(Window *w, int x, int y, Vehicle **veh)
tile = w->window_number;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Ship &&
- v->vehstatus&VS_HIDDEN &&
- v->tile == (TileIndex)tile &&
+ if (v->type == VEH_Ship && v->vehstatus & VS_HIDDEN && v->tile == tile &&
--pos < 0) {
- *veh = v;
- if (xm >= 19)
- return 0;
- if (ym <= 10)
- return -1; /* show window */
- return -2; /* start stop */
- }
+ *veh = v;
+ if (xm >= 19) return 0;
+ if (ym <= 10) return -1; /* show window */
+ return -2; /* start stop */
+ }
}
return 1; /* outside */
diff --git a/train_cmd.c b/train_cmd.c
index 1e230bc14..b40d70c23 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -445,7 +445,7 @@ static int32 CmdBuildRailWagon(uint engine, TileIndex tile, uint32 flags)
u = NULL;
FOR_ALL_VEHICLES(w) {
- if (w->type == VEH_Train && w->tile == (TileIndex)tile &&
+ if (w->type == VEH_Train && w->tile == tile &&
w->subtype == TS_Free_Car && w->engine_type == engine) {
u = GetLastVehicleInChain(w);
break;
@@ -457,7 +457,7 @@ static int32 CmdBuildRailWagon(uint engine, TileIndex tile, uint32 flags)
dir = _map5[tile] & 3;
v->direction = (byte)(dir*2+1);
- v->tile = (TileIndex)tile;
+ v->tile = tile;
x = TileX(tile) * TILE_SIZE | _vehicle_initial_x_fract[dir];
y = TileY(tile) * TILE_SIZE | _vehicle_initial_y_fract[dir];
@@ -633,7 +633,7 @@ int32 CmdBuildRailVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2)
dir = _map5[tile] & 3;
v->direction = (byte)(dir*2+1);
- v->tile = (TileIndex)tile;
+ v->tile = tile;
v->owner = _current_player;
v->x_pos = (x |= _vehicle_initial_x_fract[dir]);
v->y_pos = (y |= _vehicle_initial_y_fract[dir]);
diff --git a/train_gui.c b/train_gui.c
index 70d3f31c9..fe0492646 100644
--- a/train_gui.c
+++ b/train_gui.c
@@ -370,17 +370,17 @@ static void DrawTrainDepotWindow(Window *w)
hnum = 1;
FOR_ALL_VEHICLES(v) {
if (v->type == VEH_Train &&
- (v->subtype == TS_Front_Engine || v->subtype == TS_Free_Car) &&
- v->tile == (TileIndex)tile &&
+ (v->subtype == TS_Front_Engine || v->subtype == TS_Free_Car) &&
+ v->tile == tile &&
v->u.rail.track == 0x80) {
- num++;
- // determine number of items in the X direction.
- if (v->subtype == TS_Front_Engine) {
- i = 0;
- u = v;
- do i++; while ( (u=u->next) != NULL);
- if (i > hnum) hnum = i;
- }
+ num++;
+ // determine number of items in the X direction.
+ if (v->subtype == TS_Front_Engine) {
+ i = 0;
+ u = v;
+ do i++; while ((u = u->next) != NULL);
+ if (i > hnum) hnum = i;
+ }
}
}
@@ -403,12 +403,9 @@ static void DrawTrainDepotWindow(Window *w)
// draw all trains
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train &&
- v->subtype == TS_Front_Engine &&
- v->tile == (TileIndex)tile &&
- v->u.rail.track == 0x80 &&
+ if (v->type == VEH_Train && v->subtype == TS_Front_Engine &&
+ v->tile == tile && v->u.rail.track == 0x80 &&
--num < 0 && num >= -w->vscroll.cap) {
-
DrawTrainImage(v, x+21, y, w->hscroll.cap, w->hscroll.pos, WP(w,traindepot_d).sel);
/* Draw the train number */
SetDParam(0, v->unitnumber);
@@ -433,12 +430,9 @@ static void DrawTrainDepotWindow(Window *w)
// draw all remaining vehicles
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train &&
- v->subtype == TS_Free_Car &&
- v->tile == (TileIndex)tile &&
- v->u.rail.track == 0x80 &&
+ if (v->type == VEH_Train && v->subtype == TS_Free_Car &&
+ v->tile == tile && v->u.rail.track == 0x80 &&
--num < 0 && num >= -w->vscroll.cap) {
-
DrawTrainImage(v, x+50, y, w->hscroll.cap - 1, 0, WP(w,traindepot_d).sel);
DrawString(x, y+2, STR_8816, 0);