(svn r17000) -Change: allow overbuilding/extending waypoints

This commit is contained in:
rubidium
2009-07-30 22:06:54 +00:00
parent 7bb48f437e
commit d31e84b68c
6 changed files with 112 additions and 26 deletions

View File

@@ -638,7 +638,7 @@ static void DeleteStationIfEmpty(BaseStation *st)
UpdateStationSignCoord(st);
}
static CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags);
CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags);
/** Tries to clear the given area.
* @param tile TileIndex to start check
@@ -727,7 +727,7 @@ CommandCost CheckFlatLandBelow(TileIndex tile, uint w, uint h, DoCommandFlag fla
* @param axis the axis of the newly build rail
* @return true if we are allowed to extend
*/
static bool CanExpandRailStation(const Station *st, TileArea &new_ta, Axis axis)
bool CanExpandRailStation(const BaseStation *st, TileArea &new_ta, Axis axis)
{
TileArea cur_ta = st->train_station;
@@ -889,6 +889,20 @@ CommandCost FindJoiningStation(StationID existing_station, StationID station_to_
return cost;
}
/**
* Find a nearby waypoint that joins this waypoint.
* @param existing_waypoint an existing waypoint we build over
* @param waypoint_to_join the waypoint to join to
* @param adjacent whether adjacent waypoints are allowed
* @param ta the area of the newly build waypoint
* @param st 'return' pointer for the found waypoint
* @return command cost with the error or 'okay'
*/
CommandCost FindJoiningWaypoint(StationID existing_waypoint, StationID waypoint_to_join, bool adjacent, TileArea ta, Waypoint **wp)
{
return FindJoiningBaseStation<Waypoint, STR_MUST_REMOVE_RAILWAYPOINT_FIRST>(existing_waypoint, waypoint_to_join, adjacent, ta, wp);
}
/**
* Build rail station
* @param tile_org northern most position of station dragging/placement
@@ -3099,7 +3113,7 @@ static bool CanRemoveRoadWithStop(TileIndex tile, DoCommandFlag flags)
return road_owner != OWNER_TOWN || CheckAllowRemoveRoad(tile, GetAnyRoadBits(tile, ROADTYPE_ROAD), OWNER_TOWN, ROADTYPE_ROAD, flags);
}
static CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags)
CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags)
{
if (flags & DC_AUTO) {
switch (GetStationType(tile)) {