summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-12-26 18:01:15 +0000
committersmatz <smatz@openttd.org>2008-12-26 18:01:15 +0000
commit419f6e099f3b32a8b1f988dd7c912754589bf6d5 (patch)
treec063679e6b2160162b5c0ab232ae441833698e1d /src/station_cmd.cpp
parent2e2086f3f884487b4f456bd4b4c1e21f96987b59 (diff)
downloadopenttd-419f6e099f3b32a8b1f988dd7c912754589bf6d5.tar.xz
(svn r14743) -Codechange: use INVALID_TILE to indicate station doesn't have queried facility (or station/roadstop is invalid) instead of 0 (Yexo)
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index b39fa40c7..d43e89283 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -573,19 +573,19 @@ static void UpdateStationAcceptance(Station *st, bool show_msg)
uint old_acc = GetAcceptanceMask(st);
/* Put all the tiles that span an area in the table. */
- if (st->train_tile != 0) {
+ if (st->train_tile != INVALID_TILE) {
MergePoint(&rect, st->train_tile);
MergePoint(&rect, st->train_tile + TileDiffXY(st->trainst_w - 1, st->trainst_h - 1));
}
- if (st->airport_tile != 0) {
+ if (st->airport_tile != INVALID_TILE) {
const AirportFTAClass *afc = st->Airport();
MergePoint(&rect, st->airport_tile);
MergePoint(&rect, st->airport_tile + TileDiffXY(afc->size_x - 1, afc->size_y - 1));
}
- if (st->dock_tile != 0) {
+ if (st->dock_tile != INVALID_TILE) {
MergePoint(&rect, st->dock_tile);
if (IsDockTile(st->dock_tile)) {
MergePoint(&rect, st->dock_tile + TileOffsByDiagDir(GetDockDirection(st->dock_tile)));
@@ -986,7 +986,7 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1,
if (st->owner != _current_company)
return_cmd_error(STR_3009_TOO_CLOSE_TO_ANOTHER_STATION);
- if (st->train_tile != 0) {
+ if (st->train_tile != INVALID_TILE) {
/* check if we want to expanding an already existing station? */
if (_is_old_ai_company || !_settings_game.station.join_stations)
return_cmd_error(STR_3005_TOO_CLOSE_TO_ANOTHER_RAILROAD);
@@ -1177,7 +1177,7 @@ restart:
}
}
} else {
- tile = 0;
+ tile = INVALID_TILE;
}
st->trainst_w = w;
@@ -1281,7 +1281,7 @@ CommandCost CmdRemoveFromRailroadStation(TileIndex tile, uint32 flags, uint32 p1
}
/* if we deleted the whole station, delete the train facility. */
- if (st->train_tile == 0) {
+ if (st->train_tile == INVALID_TILE) {
st->facilities &= ~FACIL_TRAIN;
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_TRAINS);
UpdateStationVirtCoordDirty(st);
@@ -1348,7 +1348,7 @@ static CommandCost RemoveRailroadStation(Station *st, TileIndex tile, uint32 fla
if (flags & DC_EXEC) {
st->rect.AfterRemoveRect(st, st->train_tile, st->trainst_w, st->trainst_h);
- st->train_tile = 0;
+ st->train_tile = INVALID_TILE;
st->trainst_w = st->trainst_h = 0;
st->facilities &= ~FACIL_TRAIN;
@@ -1803,7 +1803,7 @@ void UpdateAirportsNoise()
FOR_ALL_TOWNS(t) t->noise_reached = 0;
FOR_ALL_STATIONS(st) {
- if (st->airport_tile != 0) {
+ if (st->airport_tile != INVALID_TILE) {
st->town->noise_reached += GetAirportNoiseLevelForTown(GetAirport(st->airport_type), st->town->xy, st->airport_tile);
}
}
@@ -1881,7 +1881,7 @@ CommandCost CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (!st->rect.BeforeAddRect(tile, w, h, StationRect::ADD_TEST)) return CMD_ERROR;
- if (st->airport_tile != 0) {
+ if (st->airport_tile != INVALID_TILE) {
return_cmd_error(STR_300D_TOO_CLOSE_TO_ANOTHER_AIRPORT);
}
} else {
@@ -1991,7 +1991,7 @@ static CommandCost RemoveAirport(Station *st, uint32 flags)
st->rect.AfterRemoveRect(st, tile, w, h);
- st->airport_tile = 0;
+ st->airport_tile = INVALID_TILE;
st->facilities &= ~FACIL_AIRPORT;
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_PLANES);
@@ -2087,7 +2087,7 @@ static CommandCost RemoveBuoy(Station *st, uint32 flags)
if (!(flags & DC_BANKRUPT) && !EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
if (flags & DC_EXEC) {
- st->dock_tile = 0;
+ st->dock_tile = INVALID_TILE;
/* Buoys are marked in the Station struct by this flag. Yes, it is this
* braindead.. */
st->facilities &= ~FACIL_DOCK;
@@ -2178,7 +2178,7 @@ CommandCost CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
tile + ToTileIndexDiff(_dock_tileoffs_chkaround[direction]),
_dock_w_chk[direction], _dock_h_chk[direction], StationRect::ADD_TEST)) return CMD_ERROR;
- if (st->dock_tile != 0) return_cmd_error(STR_304C_TOO_CLOSE_TO_ANOTHER_DOCK);
+ if (st->dock_tile != INVALID_TILE) return_cmd_error(STR_304C_TOO_CLOSE_TO_ANOTHER_DOCK);
} else {
/* allocate and initialize new station */
/* allocate and initialize new station */
@@ -2234,7 +2234,7 @@ static CommandCost RemoveDock(Station *st, uint32 flags)
MarkTileDirtyByTile(tile2);
- st->dock_tile = 0;
+ st->dock_tile = INVALID_TILE;
st->facilities &= ~FACIL_DOCK;
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_SHIPS);
@@ -3050,7 +3050,7 @@ void BuildOilRig(TileIndex tile)
st->truck_stops = NULL;
st->airport_tile = tile;
st->dock_tile = tile;
- st->train_tile = 0;
+ st->train_tile = INVALID_TILE;
st->had_vehicle_of_type = 0;
st->time_since_load = 255;
st->time_since_unload = 255;
@@ -3080,8 +3080,8 @@ void DeleteOilRig(TileIndex tile)
MakeWaterKeepingClass(tile, OWNER_NONE);
MarkTileDirtyByTile(tile);
- st->dock_tile = 0;
- st->airport_tile = 0;
+ st->dock_tile = INVALID_TILE;
+ st->airport_tile = INVALID_TILE;
st->facilities &= ~(FACIL_AIRPORT | FACIL_DOCK);
st->airport_flags = 0;