(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
This commit is contained in:
@@ -296,7 +296,7 @@ static StringID GenerateStationName(Station *st, TileIndex tile, int flag)
|
||||
CountMapSquareAround(tile, CMSATree) >= 8 ||
|
||||
CountMapSquareAround(tile, CMSAForest) >= 2)
|
||||
) {
|
||||
return _settings.game_creation.landscape == LT_TROPIC ? STR_SV_STNAME_FOREST : STR_SV_STNAME_WOODS;
|
||||
return _settings_game.game_creation.landscape == LT_TROPIC ? STR_SV_STNAME_FOREST : STR_SV_STNAME_WOODS;
|
||||
}
|
||||
|
||||
/* check elevation compared to town */
|
||||
@@ -563,7 +563,7 @@ static void UpdateStationAcceptance(Station *st, bool show_msg)
|
||||
TileXY(rect.left, rect.bottom),
|
||||
rect.right - rect.left + 1,
|
||||
rect.top - rect.bottom + 1,
|
||||
_settings.station.modified_catchment ? FindCatchmentRadius(st) : (uint)CA_UNMODIFIED
|
||||
_settings_game.station.modified_catchment ? FindCatchmentRadius(st) : (uint)CA_UNMODIFIED
|
||||
);
|
||||
} else {
|
||||
memset(accepts, 0, sizeof(accepts));
|
||||
@@ -692,7 +692,7 @@ CommandCost CheckFlatLandBelow(TileIndex tile, uint w, uint h, uint flags, uint
|
||||
* b) the build_on_slopes switch is disabled
|
||||
*/
|
||||
if (IsSteepSlope(tileh) ||
|
||||
((_is_old_ai_player || !_settings.construction.build_on_slopes) && tileh != SLOPE_FLAT)) {
|
||||
((_is_old_ai_player || !_settings_game.construction.build_on_slopes) && tileh != SLOPE_FLAT)) {
|
||||
return_cmd_error(STR_0007_FLAT_LAND_REQUIRED);
|
||||
}
|
||||
|
||||
@@ -750,7 +750,7 @@ static bool CanExpandRailroadStation(const Station *st, uint *fin, Axis axis)
|
||||
uint w = fin[1];
|
||||
uint h = fin[2];
|
||||
|
||||
if (_settings.station.nonuniform_stations) {
|
||||
if (_settings_game.station.nonuniform_stations) {
|
||||
/* determine new size of train station region.. */
|
||||
int x = min(TileX(st->train_tile), TileX(tile));
|
||||
int y = min(TileY(st->train_tile), TileY(tile));
|
||||
@@ -794,7 +794,7 @@ static bool CanExpandRailroadStation(const Station *st, uint *fin, Axis axis)
|
||||
}
|
||||
}
|
||||
/* make sure the final size is not too big. */
|
||||
if (curw > _settings.station.station_spread || curh > _settings.station.station_spread) {
|
||||
if (curw > _settings_game.station.station_spread || curh > _settings_game.station.station_spread) {
|
||||
_error_message = STR_306C_STATION_TOO_SPREAD_OUT;
|
||||
return false;
|
||||
}
|
||||
@@ -883,7 +883,7 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1,
|
||||
w_org = numtracks;
|
||||
}
|
||||
|
||||
if (h_org > _settings.station.station_spread || w_org > _settings.station.station_spread) return CMD_ERROR;
|
||||
if (h_org > _settings_game.station.station_spread || w_org > _settings_game.station.station_spread) return CMD_ERROR;
|
||||
|
||||
/* these values are those that will be stored in train_tile and station_platforms */
|
||||
uint finalvalues[3];
|
||||
@@ -896,14 +896,14 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1,
|
||||
/* If DC_EXEC is in flag, do not want to pass it to CheckFlatLandBelow, because of a nice bug
|
||||
* for detail info, see:
|
||||
* https://sourceforge.net/tracker/index.php?func=detail&aid=1029064&group_id=103924&atid=636365 */
|
||||
CommandCost ret = CheckFlatLandBelow(tile_org, w_org, h_org, flags & ~DC_EXEC, 5 << axis, _settings.station.nonuniform_stations ? &est : NULL);
|
||||
CommandCost ret = CheckFlatLandBelow(tile_org, w_org, h_org, flags & ~DC_EXEC, 5 << axis, _settings_game.station.nonuniform_stations ? &est : NULL);
|
||||
if (CmdFailed(ret)) return ret;
|
||||
CommandCost cost(EXPENSES_CONSTRUCTION, ret.GetCost() + (numtracks * _price.train_station_track + _price.train_station_length) * plat_len);
|
||||
|
||||
Station *st = NULL;
|
||||
bool check_surrounding = true;
|
||||
|
||||
if (_settings.station.adjacent_stations) {
|
||||
if (_settings_game.station.adjacent_stations) {
|
||||
if (est != INVALID_STATION) {
|
||||
if (HasBit(p1, 24)) {
|
||||
/* You can't build an adjacent station over the top of one that
|
||||
@@ -938,7 +938,7 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1,
|
||||
|
||||
if (st->train_tile != 0) {
|
||||
/* check if we want to expanding an already existing station? */
|
||||
if (_is_old_ai_player || !_settings.station.join_stations)
|
||||
if (_is_old_ai_player || !_settings_game.station.join_stations)
|
||||
return_cmd_error(STR_3005_TOO_CLOSE_TO_ANOTHER_RAILROAD);
|
||||
if (!CanExpandRailroadStation(st, finalvalues, axis))
|
||||
return CMD_ERROR;
|
||||
@@ -993,7 +993,7 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1,
|
||||
/* Now really clear the land below the station
|
||||
* It should never return CMD_ERROR.. but you never know ;)
|
||||
* (a bit strange function name for it, but it really does clear the land, when DC_EXEC is in flags) */
|
||||
ret = CheckFlatLandBelow(tile_org, w_org, h_org, flags, 5 << axis, _settings.station.nonuniform_stations ? &est : NULL);
|
||||
ret = CheckFlatLandBelow(tile_org, w_org, h_org, flags, 5 << axis, _settings_game.station.nonuniform_stations ? &est : NULL);
|
||||
if (CmdFailed(ret)) return ret;
|
||||
|
||||
st->train_tile = finalvalues[0];
|
||||
@@ -1162,7 +1162,7 @@ CommandCost CmdRemoveFromRailroadStation(TileIndex tile, uint32 flags, uint32 p1
|
||||
/* Do not allow removing from stations if non-uniform stations are not enabled
|
||||
* The check must be here to give correct error message
|
||||
*/
|
||||
if (!_settings.station.nonuniform_stations) return_cmd_error(STR_NONUNIFORM_STATIONS_DISALLOWED);
|
||||
if (!_settings_game.station.nonuniform_stations) return_cmd_error(STR_NONUNIFORM_STATIONS_DISALLOWED);
|
||||
|
||||
/* If we reached here, the tile is valid so increase the quantity of tiles we will remove */
|
||||
quantity++;
|
||||
@@ -1207,7 +1207,7 @@ CommandCost CmdRemoveFromRailroadStation(TileIndex tile, uint32 flags, uint32 p1
|
||||
static CommandCost RemoveRailroadStation(Station *st, TileIndex tile, uint32 flags)
|
||||
{
|
||||
/* if there is flooding and non-uniform stations are enabled, remove platforms tile by tile */
|
||||
if (_current_player == OWNER_WATER && _settings.station.nonuniform_stations) {
|
||||
if (_current_player == OWNER_WATER && _settings_game.station.nonuniform_stations) {
|
||||
return DoCommand(tile, 0, 0, DC_EXEC, CMD_REMOVE_FROM_RAILROAD_STATION);
|
||||
}
|
||||
|
||||
@@ -1326,7 +1326,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
Owner road_owner = GetRoadOwner(tile, ROADTYPE_ROAD);
|
||||
if (road_owner == OWNER_TOWN) {
|
||||
town_owned_road = true;
|
||||
if (!_settings.construction.road_stop_on_town_road) return_cmd_error(STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD);
|
||||
if (!_settings_game.construction.road_stop_on_town_road) return_cmd_error(STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD);
|
||||
} else {
|
||||
if (road_owner != OWNER_NONE && !CheckOwnership(road_owner)) return CMD_ERROR;
|
||||
}
|
||||
@@ -1350,7 +1350,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
|
||||
Station *st = NULL;
|
||||
|
||||
if (!_settings.station.adjacent_stations || !HasBit(p2, 5)) {
|
||||
if (!_settings_game.station.adjacent_stations || !HasBit(p2, 5)) {
|
||||
st = GetStationAround(tile, 1, 1, INVALID_STATION);
|
||||
if (st == CHECK_STATIONS_ERR) return CMD_ERROR;
|
||||
}
|
||||
@@ -1681,7 +1681,7 @@ uint8 GetAirportNoiseLevelForTown(const AirportFTAClass *afc, TileIndex town_til
|
||||
* adding the town_council_tolerance 4 times, as a way to graduate, depending of the tolerance.
|
||||
* Basically, it says that the less tolerant a town is, the bigger the distance before
|
||||
* an actual decrease can be granted */
|
||||
uint8 town_tolerance_distance = 8 + (_settings.difficulty.town_council_tolerance * 4);
|
||||
uint8 town_tolerance_distance = 8 + (_settings_game.difficulty.town_council_tolerance * 4);
|
||||
|
||||
/* now, we want to have the distance segmented using the distance judged bareable by town
|
||||
* This will give us the coefficient of reduction the distance provides. */
|
||||
@@ -1715,7 +1715,7 @@ CommandCost CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
int h = afc->size_y;
|
||||
Station *st = NULL;
|
||||
|
||||
if (w > _settings.station.station_spread || h > _settings.station.station_spread) {
|
||||
if (w > _settings_game.station.station_spread || h > _settings_game.station.station_spread) {
|
||||
_error_message = STR_306C_STATION_TOO_SPREAD_OUT;
|
||||
return CMD_ERROR;
|
||||
}
|
||||
@@ -1729,7 +1729,7 @@ CommandCost CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
/* Check if local auth would allow a new airport */
|
||||
bool authority_refused;
|
||||
|
||||
if (_settings.economy.station_noise_level) {
|
||||
if (_settings_game.economy.station_noise_level) {
|
||||
/* do not allow to build a new airport if this raise the town noise over the maximum allowed by town */
|
||||
authority_refused = (t->noise_reached + newnoise_level) > t->MaxTownNoise();
|
||||
} else {
|
||||
@@ -1746,7 +1746,7 @@ CommandCost CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
return_cmd_error(STR_2035_LOCAL_AUTHORITY_REFUSES);
|
||||
}
|
||||
|
||||
if (!_settings.station.adjacent_stations || !HasBit(p2, 0)) {
|
||||
if (!_settings_game.station.adjacent_stations || !HasBit(p2, 0)) {
|
||||
st = GetStationAround(tile, w, h, INVALID_STATION);
|
||||
if (st == CHECK_STATIONS_ERR) return CMD_ERROR;
|
||||
} else {
|
||||
@@ -1821,7 +1821,7 @@ CommandCost CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
|
||||
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_PLANES);
|
||||
|
||||
if (_settings.economy.station_noise_level) {
|
||||
if (_settings_game.economy.station_noise_level) {
|
||||
InvalidateWindow(WC_TOWN_VIEW, st->town->index);
|
||||
}
|
||||
}
|
||||
@@ -1878,7 +1878,7 @@ static CommandCost RemoveAirport(Station *st, uint32 flags)
|
||||
|
||||
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_PLANES);
|
||||
|
||||
if (_settings.economy.station_noise_level) {
|
||||
if (_settings_game.economy.station_noise_level) {
|
||||
InvalidateWindow(WC_TOWN_VIEW, st->town->index);
|
||||
}
|
||||
|
||||
@@ -2041,7 +2041,7 @@ CommandCost CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
/* middle */
|
||||
Station *st = NULL;
|
||||
|
||||
if (!_settings.station.adjacent_stations || !HasBit(p1, 0)) {
|
||||
if (!_settings_game.station.adjacent_stations || !HasBit(p1, 0)) {
|
||||
st = GetStationAround(
|
||||
tile + ToTileIndexDiff(_dock_tileoffs_chkaround[direction]),
|
||||
_dock_w_chk[direction], _dock_h_chk[direction], INVALID_STATION);
|
||||
@@ -2771,7 +2771,7 @@ StationSet FindStationsAroundIndustryTile(TileIndex tile, int w, int h)
|
||||
int w_prod; // width and height of the "producer" of the cargo
|
||||
int h_prod;
|
||||
int max_rad;
|
||||
if (_settings.station.modified_catchment) {
|
||||
if (_settings_game.station.modified_catchment) {
|
||||
w_prod = w;
|
||||
h_prod = h;
|
||||
w += 2 * MAX_CATCHMENT;
|
||||
@@ -2794,7 +2794,7 @@ StationSet FindStationsAroundIndustryTile(TileIndex tile, int w, int h)
|
||||
if (st->IsBuoy()) continue; // bouys don't accept cargo
|
||||
|
||||
|
||||
if (_settings.station.modified_catchment) {
|
||||
if (_settings_game.station.modified_catchment) {
|
||||
/* min and max coordinates of the producer relative */
|
||||
const int x_min_prod = max_rad + 1;
|
||||
const int x_max_prod = max_rad + w_prod;
|
||||
@@ -2848,7 +2848,7 @@ uint MoveGoodsToStation(TileIndex tile, int w, int h, CargoID type, uint amount)
|
||||
|
||||
if (st->goods[type].rating == 0) continue; // Lowest possible rating, better not to give cargo anymore
|
||||
|
||||
if (_settings.order.selectgoods && st->goods[type].last_speed == 0) continue; // Selectively servicing stations, and not this one
|
||||
if (_settings_game.order.selectgoods && st->goods[type].last_speed == 0) continue; // Selectively servicing stations, and not this one
|
||||
|
||||
if (IsCargoInClass(type, CC_PASSENGERS)) {
|
||||
if (st->facilities == FACIL_TRUCK_STOP) continue; // passengers are never served by just a truck stop
|
||||
@@ -3073,7 +3073,7 @@ void AfterLoadStations()
|
||||
|
||||
static CommandCost TerraformTile_Station(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
|
||||
{
|
||||
if (_settings.construction.build_on_slopes && AutoslopeEnabled()) {
|
||||
if (_settings_game.construction.build_on_slopes && AutoslopeEnabled()) {
|
||||
/* TODO: If you implement newgrf callback 149 'land slope check', you have to decide what to do with it here.
|
||||
* TTDP does not call it.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user