Merge branch 'master' into jgrpp-beta

# Conflicts:
#	.github/workflows/ci-build.yml
#	src/lang/german.txt
#	src/lang/romanian.txt
#	src/lang/slovak.txt
#	src/lang/turkish.txt
#	src/network/core/address.cpp
#	src/network/core/tcp.h
#	src/network/core/udp.cpp
#	src/network/network.cpp
#	src/network/network_client.cpp
#	src/network/network_server.cpp
#	src/network/network_server.h
#	src/network/network_udp.cpp
#	src/openttd.cpp
#	src/saveload/newgrf_sl.cpp
#	src/tree_cmd.cpp
#	src/video/video_driver.hpp
#	src/window.cpp
#	src/window_gui.h
This commit is contained in:
Jonathan G Rennison
2021-09-22 21:49:32 +01:00
76 changed files with 1226 additions and 617 deletions

View File

@@ -104,7 +104,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;
@@ -574,7 +574,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);
}
@@ -612,7 +612,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;
@@ -992,7 +992,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, false);
if (ret.Failed()) return ret;
cost.AddCost(ret);
@@ -1080,7 +1080,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, !_settings_game.construction.allow_road_stops_under_bridges);
if (ret.Failed()) return ret;
cost.AddCost(ret);
@@ -1630,7 +1630,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;
@@ -1759,7 +1759,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;
@@ -1931,7 +1931,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
@@ -2099,7 +2099,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;
@@ -2312,7 +2312,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;
@@ -2462,7 +2462,7 @@ static CommandCost CanRemoveAirport(Station *st, DoCommandFlag flags)
CommandCost cost(EXPENSES_CONSTRUCTION);
TILE_AREA_LOOP(tile_cur, st->airport) {
for (TileIndex tile_cur : st->airport) {
if (!st->TileBelongsToAirport(tile_cur)) continue;
CommandCost ret = EnsureNoVehicleOnGround(tile_cur);
@@ -2626,7 +2626,7 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
}
}
TILE_AREA_LOOP(tile_cur, st->airport) {
for (TileIndex tile_cur : st->airport) {
if (IsHangarTile(tile_cur)) OrderBackup::Reset(tile_cur, false);
DeleteAnimatedTile(tile_cur);
DoClearSquare(tile_cur);
@@ -2716,7 +2716,7 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
Town *nearest = AirportGetNearestTown(as, it, dist);
nearest->noise_reached -= GetAirportNoiseLevelForDistance(as, dist);
TILE_AREA_LOOP(tile_cur, st->airport) {
for (TileIndex tile_cur : st->airport) {
DeleteAnimatedTile(tile_cur);
DoClearSquare(tile_cur);
DeleteNewGRFInspectWindow(GSF_AIRPORTTILES, tile_cur);
@@ -4627,7 +4627,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);
}
}