|
|
|
@ -105,7 +105,7 @@ CommandCost GetStationAround(TileArea ta, StationID closest_station, CompanyID c
|
|
|
|
|
ta.Expand(1);
|
|
|
|
|
|
|
|
|
|
/* check around to see if there are any stations there owned by the company */
|
|
|
|
|
TILE_AREA_LOOP(tile_cur, ta) {
|
|
|
|
|
for (TileIndex tile_cur : ta) {
|
|
|
|
|
if (IsTileType(tile_cur, MP_STATION)) {
|
|
|
|
|
StationID t = GetStationIndex(tile_cur);
|
|
|
|
|
if (!T::IsValidID(t) || Station::Get(t)->owner != company) continue;
|
|
|
|
@ -511,7 +511,7 @@ CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad)
|
|
|
|
|
|
|
|
|
|
/* Loop over all tiles to get the produced cargo of
|
|
|
|
|
* everything except industries */
|
|
|
|
|
TILE_AREA_LOOP(tile, ta) {
|
|
|
|
|
for (TileIndex tile : ta) {
|
|
|
|
|
if (IsTileType(tile, MP_INDUSTRY)) industries.insert(GetIndustryIndex(tile));
|
|
|
|
|
AddProducedCargo(tile, produced);
|
|
|
|
|
}
|
|
|
|
@ -549,7 +549,7 @@ CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, Cargo
|
|
|
|
|
|
|
|
|
|
TileArea ta = TileArea(tile, w, h).Expand(rad);
|
|
|
|
|
|
|
|
|
|
TILE_AREA_LOOP(tile, ta) {
|
|
|
|
|
for (TileIndex tile : ta) {
|
|
|
|
|
/* Ignore industry if it has a neutral station. */
|
|
|
|
|
if (!_settings_game.station.serve_neutral_industries && IsTileType(tile, MP_INDUSTRY) && Industry::GetByTile(tile)->neutral_station != nullptr) continue;
|
|
|
|
|
|
|
|
|
@ -872,7 +872,7 @@ static CommandCost CheckFlatLandRailStation(TileArea tile_area, DoCommandFlag fl
|
|
|
|
|
const StationSpec *statspec = StationClass::Get(spec_class)->GetSpec(spec_index);
|
|
|
|
|
bool slope_cb = statspec != nullptr && HasBit(statspec->callback_mask, CBM_STATION_SLOPE_CHECK);
|
|
|
|
|
|
|
|
|
|
TILE_AREA_LOOP(tile_cur, tile_area) {
|
|
|
|
|
for (TileIndex tile_cur : tile_area) {
|
|
|
|
|
CommandCost ret = CheckBuildableTile(tile_cur, invalid_dirs, allowed_z, false);
|
|
|
|
|
if (ret.Failed()) return ret;
|
|
|
|
|
cost.AddCost(ret);
|
|
|
|
@ -954,7 +954,7 @@ static CommandCost CheckFlatLandRoadStop(TileArea tile_area, DoCommandFlag flags
|
|
|
|
|
CommandCost cost(EXPENSES_CONSTRUCTION);
|
|
|
|
|
int allowed_z = -1;
|
|
|
|
|
|
|
|
|
|
TILE_AREA_LOOP(cur_tile, tile_area) {
|
|
|
|
|
for (TileIndex cur_tile : tile_area) {
|
|
|
|
|
CommandCost ret = CheckBuildableTile(cur_tile, invalid_dirs, allowed_z, !is_drive_through);
|
|
|
|
|
if (ret.Failed()) return ret;
|
|
|
|
|
cost.AddCost(ret);
|
|
|
|
@ -1435,7 +1435,7 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32
|
|
|
|
|
update_reservation_area = TileArea(tile_org, numtracks_orig, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TILE_AREA_LOOP(tile, update_reservation_area) {
|
|
|
|
|
for (TileIndex tile : update_reservation_area) {
|
|
|
|
|
/* Don't even try to make eye candy parts reserved. */
|
|
|
|
|
if (IsStationTileBlocked(tile)) continue;
|
|
|
|
|
|
|
|
|
@ -1563,7 +1563,7 @@ CommandCost RemoveFromRailBaseStation(TileArea ta, std::vector<T *> &affected_st
|
|
|
|
|
CommandCost error;
|
|
|
|
|
|
|
|
|
|
/* Do the action for every tile into the area */
|
|
|
|
|
TILE_AREA_LOOP(tile, ta) {
|
|
|
|
|
for (TileIndex tile : ta) {
|
|
|
|
|
/* Make sure the specified tile is a rail station */
|
|
|
|
|
if (!HasStationTileRail(tile)) continue;
|
|
|
|
|
|
|
|
|
@ -1729,7 +1729,7 @@ CommandCost RemoveRailStation(T *st, DoCommandFlag flags, Money removal_cost)
|
|
|
|
|
|
|
|
|
|
CommandCost cost(EXPENSES_CONSTRUCTION);
|
|
|
|
|
/* clear all areas of the station */
|
|
|
|
|
TILE_AREA_LOOP(tile, ta) {
|
|
|
|
|
for (TileIndex tile : ta) {
|
|
|
|
|
/* only remove tiles that are actually train station tiles */
|
|
|
|
|
if (st->TileBelongsToRailStation(tile)) {
|
|
|
|
|
std::vector<T*> affected_stations; // dummy
|
|
|
|
@ -1894,7 +1894,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
|
|
|
|
|
|
|
|
|
if (flags & DC_EXEC) {
|
|
|
|
|
/* Check every tile in the area. */
|
|
|
|
|
TILE_AREA_LOOP(cur_tile, roadstop_area) {
|
|
|
|
|
for (TileIndex cur_tile : roadstop_area) {
|
|
|
|
|
/* Get existing road types and owners before any tile clearing */
|
|
|
|
|
RoadType road_rt = MayHaveRoad(cur_tile) ? GetRoadType(cur_tile, RTT_ROAD) : INVALID_ROADTYPE;
|
|
|
|
|
RoadType tram_rt = MayHaveRoad(cur_tile) ? GetRoadType(cur_tile, RTT_TRAM) : INVALID_ROADTYPE;
|
|
|
|
@ -2101,7 +2101,7 @@ CommandCost CmdRemoveRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
|
|
|
|
|
CommandCost last_error(STR_ERROR_THERE_IS_NO_STATION);
|
|
|
|
|
bool had_success = false;
|
|
|
|
|
|
|
|
|
|
TILE_AREA_LOOP(cur_tile, roadstop_area) {
|
|
|
|
|
for (TileIndex cur_tile : roadstop_area) {
|
|
|
|
|
/* Make sure the specified tile is a road stop of the correct type */
|
|
|
|
|
if (!IsTileType(cur_tile, MP_STATION) || !IsRoadStop(cur_tile) || (uint32)GetRoadStopType(cur_tile) != GB(p2, 0, 1)) continue;
|
|
|
|
|
|
|
|
|
@ -2409,7 +2409,7 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
|
|
|
|
|
nearest->noise_reached -= GetAirportNoiseLevelForDistance(as, dist);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TILE_AREA_LOOP(tile_cur, st->airport) {
|
|
|
|
|
for (TileIndex tile_cur : st->airport) {
|
|
|
|
|
if (!st->TileBelongsToAirport(tile_cur)) continue;
|
|
|
|
|
|
|
|
|
|
CommandCost ret = EnsureNoVehicleOnGround(tile_cur);
|
|
|
|
@ -4120,7 +4120,7 @@ void UpdateStationDockingTiles(Station *st)
|
|
|
|
|
int y1 = std::max<int>(y - 1, 0);
|
|
|
|
|
|
|
|
|
|
TileArea ta(TileXY(x1, y1), TileXY(x2 - 1, y2 - 1));
|
|
|
|
|
TILE_AREA_LOOP(tile, ta) {
|
|
|
|
|
for (TileIndex tile : ta) {
|
|
|
|
|
if (IsValidTile(tile) && IsPossibleDockingTile(tile)) CheckForDockingTile(tile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|