|
|
@ -827,10 +827,10 @@ static CommandCost CheckFlatLandRailStation(TileArea tile_area, DoCommandFlag fl
|
|
|
|
* @param is_truck_stop True when building a truck stop, false otherwise.
|
|
|
|
* @param is_truck_stop True when building a truck stop, false otherwise.
|
|
|
|
* @param axis Axis of a drive-through road stop.
|
|
|
|
* @param axis Axis of a drive-through road stop.
|
|
|
|
* @param station StationID to be queried and returned if available.
|
|
|
|
* @param station StationID to be queried and returned if available.
|
|
|
|
* @param rts Road types to build. Bits already built at the tile will be removed.
|
|
|
|
* @param rts Road types to build.
|
|
|
|
* @return The cost in case of success, or an error code if it failed.
|
|
|
|
* @return The cost in case of success, or an error code if it failed.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static CommandCost CheckFlatLandRoadStop(TileArea tile_area, DoCommandFlag flags, uint invalid_dirs, bool is_drive_through, bool is_truck_stop, Axis axis, StationID *station, RoadTypes &rts)
|
|
|
|
static CommandCost CheckFlatLandRoadStop(TileArea tile_area, DoCommandFlag flags, uint invalid_dirs, bool is_drive_through, bool is_truck_stop, Axis axis, StationID *station, RoadTypes rts)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CommandCost cost(EXPENSES_CONSTRUCTION);
|
|
|
|
CommandCost cost(EXPENSES_CONSTRUCTION);
|
|
|
|
int allowed_z = -1;
|
|
|
|
int allowed_z = -1;
|
|
|
@ -906,7 +906,7 @@ static CommandCost CheckFlatLandRoadStop(TileArea tile_area, DoCommandFlag flags
|
|
|
|
num_roadbits += CountBits(GetRoadBits(cur_tile, ROADTYPE_TRAM));
|
|
|
|
num_roadbits += CountBits(GetRoadBits(cur_tile, ROADTYPE_TRAM));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Do not remove roadtypes! */
|
|
|
|
/* Take into account existing roadbits. */
|
|
|
|
rts |= cur_rts;
|
|
|
|
rts |= cur_rts;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
ret = DoCommand(cur_tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
|
|
|
ret = DoCommand(cur_tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
|
|
@ -1787,6 +1787,8 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
|
|
|
if (flags & DC_EXEC) {
|
|
|
|
if (flags & DC_EXEC) {
|
|
|
|
/* Check every tile in the area. */
|
|
|
|
/* Check every tile in the area. */
|
|
|
|
TILE_AREA_LOOP(cur_tile, roadstop_area) {
|
|
|
|
TILE_AREA_LOOP(cur_tile, roadstop_area) {
|
|
|
|
|
|
|
|
RoadTypes cur_rts = GetRoadTypes(cur_tile);
|
|
|
|
|
|
|
|
|
|
|
|
if (IsTileType(cur_tile, MP_STATION) && IsRoadStop(cur_tile)) {
|
|
|
|
if (IsTileType(cur_tile, MP_STATION) && IsRoadStop(cur_tile)) {
|
|
|
|
RemoveRoadStop(cur_tile, flags);
|
|
|
|
RemoveRoadStop(cur_tile, flags);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1809,10 +1811,9 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
|
|
|
|
|
|
|
|
|
|
|
RoadStopType rs_type = type ? ROADSTOP_TRUCK : ROADSTOP_BUS;
|
|
|
|
RoadStopType rs_type = type ? ROADSTOP_TRUCK : ROADSTOP_BUS;
|
|
|
|
if (is_drive_through) {
|
|
|
|
if (is_drive_through) {
|
|
|
|
RoadTypes cur_rts = IsNormalRoadTile(cur_tile) ? GetRoadTypes(cur_tile) : ROADTYPES_NONE;
|
|
|
|
|
|
|
|
Owner road_owner = HasBit(cur_rts, ROADTYPE_ROAD) ? GetRoadOwner(cur_tile, ROADTYPE_ROAD) : _current_company;
|
|
|
|
Owner road_owner = HasBit(cur_rts, ROADTYPE_ROAD) ? GetRoadOwner(cur_tile, ROADTYPE_ROAD) : _current_company;
|
|
|
|
Owner tram_owner = HasBit(cur_rts, ROADTYPE_TRAM) ? GetRoadOwner(cur_tile, ROADTYPE_TRAM) : _current_company;
|
|
|
|
Owner tram_owner = HasBit(cur_rts, ROADTYPE_TRAM) ? GetRoadOwner(cur_tile, ROADTYPE_TRAM) : _current_company;
|
|
|
|
MakeDriveThroughRoadStop(cur_tile, st->owner, road_owner, tram_owner, st->index, rs_type, rts, DiagDirToAxis(ddir));
|
|
|
|
MakeDriveThroughRoadStop(cur_tile, st->owner, road_owner, tram_owner, st->index, rs_type, rts | cur_rts, DiagDirToAxis(ddir));
|
|
|
|
road_stop->MakeDriveThrough();
|
|
|
|
road_stop->MakeDriveThrough();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
MakeRoadStop(cur_tile, st->owner, st->index, rs_type, rts, ddir);
|
|
|
|
MakeRoadStop(cur_tile, st->owner, st->index, rs_type, rts, ddir);
|
|
|
|