mirror of https://github.com/OpenTTD/OpenTTD
(svn r14456) -Fix: Obiwan in catchment-area and station-spread of docks.
parent
a34bd150fe
commit
70e1e83eb2
|
@ -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));
|
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) {
|
for (const RoadStop *rs = st->bus_stops; rs != NULL; rs = rs->next) {
|
||||||
MergePoint(&rect, rs->xy);
|
MergePoint(&rect, rs->xy);
|
||||||
|
@ -559,7 +564,12 @@ static void UpdateStationAcceptance(Station *st, bool show_msg)
|
||||||
|
|
||||||
/* And retrieve the acceptance. */
|
/* And retrieve the acceptance. */
|
||||||
AcceptedCargo accepts;
|
AcceptedCargo accepts;
|
||||||
|
assert((rect.right >= rect.left) == !st->rect.IsEmpty());
|
||||||
if (rect.right >= rect.left) {
|
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(
|
GetAcceptanceAroundTiles(
|
||||||
accepts,
|
accepts,
|
||||||
TileXY(rect.left, rect.bottom),
|
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);
|
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);
|
if (st->dock_tile != 0) return_cmd_error(STR_304C_TOO_CLOSE_TO_ANOTHER_DOCK);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2150,7 +2162,9 @@ CommandCost CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
st->dock_tile = tile;
|
st->dock_tile = tile;
|
||||||
st->AddFacility(FACIL_DOCK, 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);
|
MakeDock(tile, st->owner, st->index, direction, wc);
|
||||||
|
|
||||||
|
|
|
@ -165,6 +165,11 @@ static inline bool IsDock(TileIndex t)
|
||||||
return GetStationType(t) == STATION_DOCK;
|
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)
|
static inline bool IsBuoy(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetStationType(t) == STATION_BUOY;
|
return GetStationType(t) == STATION_BUOY;
|
||||||
|
|
Loading…
Reference in New Issue