summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2008-10-10 20:09:29 +0000
committerfrosch <frosch@openttd.org>2008-10-10 20:09:29 +0000
commit921bdf783f29558c0ba229dd437b9cb4d26dca61 (patch)
treee5d47c944dcf6707557d2c96043d1d5f5705974b /src
parent75e3d49df36fcaeabe7bbcaf965aea2393655e72 (diff)
downloadopenttd-921bdf783f29558c0ba229dd437b9cb4d26dca61.tar.xz
(svn r14456) -Fix: Obiwan in catchment-area and station-spread of docks.
Diffstat (limited to 'src')
-rw-r--r--src/station_cmd.cpp20
-rw-r--r--src/station_map.h5
2 files changed, 22 insertions, 3 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 15fca6f33..96e1e1cca 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -547,7 +547,12 @@ static void UpdateStationAcceptance(Station *st, bool show_msg)
MergePoint(&rect, st->airport_tile + TileDiffXY(afc->size_x - 1, afc->size_y - 1));
}
- if (st->dock_tile != 0) MergePoint(&rect, st->dock_tile);
+ if (st->dock_tile != 0) {
+ MergePoint(&rect, st->dock_tile);
+ if (IsDockTile(st->dock_tile)) {
+ MergePoint(&rect, st->dock_tile + TileOffsByDiagDir(GetDockDirection(st->dock_tile)));
+ } // else OilRig
+ }
for (const RoadStop *rs = st->bus_stops; rs != NULL; rs = rs->next) {
MergePoint(&rect, rs->xy);
@@ -559,7 +564,12 @@ static void UpdateStationAcceptance(Station *st, bool show_msg)
/* And retrieve the acceptance. */
AcceptedCargo accepts;
+ assert((rect.right >= rect.left) == !st->rect.IsEmpty());
if (rect.right >= rect.left) {
+ assert(rect.left == st->rect.left);
+ assert(rect.top == st->rect.bottom);
+ assert(rect.right == st->rect.right);
+ assert(rect.bottom == st->rect.top);
GetAcceptanceAroundTiles(
accepts,
TileXY(rect.left, rect.bottom),
@@ -2126,7 +2136,9 @@ CommandCost CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
return_cmd_error(STR_3009_TOO_CLOSE_TO_ANOTHER_STATION);
}
- if (!st->rect.BeforeAddRect(tile, _dock_w_chk[direction], _dock_h_chk[direction], StationRect::ADD_TEST)) return CMD_ERROR;
+ if (!st->rect.BeforeAddRect(
+ 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);
} else {
@@ -2150,7 +2162,9 @@ CommandCost CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
st->dock_tile = tile;
st->AddFacility(FACIL_DOCK, tile);
- st->rect.BeforeAddRect(tile, _dock_w_chk[direction], _dock_h_chk[direction], StationRect::ADD_TRY);
+ st->rect.BeforeAddRect(
+ tile + ToTileIndexDiff(_dock_tileoffs_chkaround[direction]),
+ _dock_w_chk[direction], _dock_h_chk[direction], StationRect::ADD_TRY);
MakeDock(tile, st->owner, st->index, direction, wc);
diff --git a/src/station_map.h b/src/station_map.h
index 77d427958..0f3ff0721 100644
--- a/src/station_map.h
+++ b/src/station_map.h
@@ -165,6 +165,11 @@ static inline bool IsDock(TileIndex t)
return GetStationType(t) == STATION_DOCK;
}
+static inline bool IsDockTile(TileIndex t)
+{
+ return IsTileType(t, MP_STATION) && GetStationType(t) == STATION_DOCK;
+}
+
static inline bool IsBuoy(TileIndex t)
{
return GetStationType(t) == STATION_BUOY;