summaryrefslogtreecommitdiff
path: root/src/station.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/station.cpp')
-rw-r--r--src/station.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/station.cpp b/src/station.cpp
index f1bf4b2bd..09204ec0a 100644
--- a/src/station.cpp
+++ b/src/station.cpp
@@ -38,6 +38,8 @@ BaseStation::~BaseStation()
Station::Station(TileIndex tile) :
SpecializedStation<Station, false>(tile),
+ bus_station(INVALID_TILE, 0, 0),
+ truck_station(INVALID_TILE, 0, 0),
airport_tile(INVALID_TILE),
dock_tile(INVALID_TILE),
indtype(IT_INVALID),
@@ -511,6 +513,33 @@ TileArea::TileArea(TileIndex start, TileIndex end)
this->h = ey - sy + 1;
}
+void TileArea::Add(TileIndex to_add)
+{
+ if (this->tile == INVALID_TILE) {
+ this->tile = to_add;
+ this->w = 1;
+ this->h = 1;
+ return;
+ }
+
+ uint sx = TileX(this->tile);
+ uint sy = TileY(this->tile);
+ uint ex = sx + this->w - 1;
+ uint ey = sy + this->h - 1;
+
+ uint ax = TileX(to_add);
+ uint ay = TileY(to_add);
+
+ sx = min(ax, sx);
+ sy = min(ay, sy);
+ ex = max(ax, ex);
+ ey = max(ay, ey);
+
+ this->tile = TileXY(sx, sy);
+ this->w = ex - sx + 1;
+ this->h = ey - sy + 1;
+}
+
void InitializeStations()
{