summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index b66d64b05..b73211dd7 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -1000,15 +1000,11 @@ int32 CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1, uint3
if (CmdFailed(ret)) return ret;
st->train_tile = finalvalues[0];
- if (!st->facilities) st->xy = finalvalues[0];
- st->facilities |= FACIL_TRAIN;
- st->owner = _current_player;
+ st->AddFacility(FACIL_TRAIN, finalvalues[0]);
st->trainst_w = finalvalues[1];
st->trainst_h = finalvalues[2];
- st->build_date = _date;
-
st->rect.BeforeAddRect(tile_org, w_org, h_org, StationRect::ADD_TRY);
tile_delta = (axis == AXIS_X ? TileDiffXY(1, 0) : TileDiffXY(0, 1));
@@ -1415,11 +1411,7 @@ int32 CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
//initialize an empty station
road_stop->prev = prev;
- if (!st->facilities) st->xy = tile;
- st->facilities |= (type) ? FACIL_TRUCK_STOP : FACIL_BUS_STOP;
- st->owner = _current_player;
-
- st->build_date = _date;
+ st->AddFacility((type) ? FACIL_TRUCK_STOP : FACIL_BUS_STOP, tile);
st->rect.BeforeAddTile(tile, StationRect::ADD_TRY);
@@ -1674,15 +1666,11 @@ int32 CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
cost += _price.build_airport * w * h;
if (flags & DC_EXEC) {
- st->owner = _current_player;
st->airport_tile = tile;
- if (!st->facilities) st->xy = tile;
- st->facilities |= FACIL_AIRPORT;
+ st->AddFacility(FACIL_AIRPORT, tile);
st->airport_type = (byte)p1;
st->airport_flags = 0;
- st->build_date = _date;
-
st->rect.BeforeAddRect(tile, w, h, StationRect::ADD_TRY);
/* if airport was demolished while planes were en-route to it, the
@@ -1953,11 +1941,7 @@ int32 CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (flags & DC_EXEC) {
st->dock_tile = tile;
- if (!st->facilities) st->xy = tile;
- st->facilities |= FACIL_DOCK;
- st->owner = _current_player;
-
- st->build_date = _date;
+ st->AddFacility(FACIL_DOCK, tile);
st->rect.BeforeAddRect(tile, _dock_w_chk[direction], _dock_h_chk[direction], StationRect::ADD_TRY);