--- a/src/station_cmd.cpp Tue May 27 00:50:55 2008 +0000
+++ b/src/station_cmd.cpp Tue Jun 17 10:32:49 2008 +0000
@@ -358,7 +358,7 @@
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 */
@@ -625,7 +625,7 @@
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));
@@ -762,7 +762,7 @@
* 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);
}
@@ -839,7 +839,7 @@
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));
@@ -883,7 +883,7 @@
}
}
/* 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;
}
@@ -972,7 +972,7 @@
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];
@@ -985,14 +985,14 @@
/* 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
@@ -1027,7 +1027,7 @@
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;
@@ -1082,7 +1082,7 @@
/* 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];
@@ -1251,7 +1251,7 @@
/* 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++;
@@ -1296,7 +1296,7 @@
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);
}
@@ -1415,7 +1415,7 @@
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;
}
@@ -1438,7 +1438,7 @@
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;
}
@@ -1676,18 +1676,15 @@
* 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);
-
- /* The airport is in the "inner" distance where there is no noise reduction */
- if (distance < town_tolerance_distance) return afc->noise_level;
+ 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. */
- uint noise_reduction = min(afc->noise_level, distance / town_tolerance_distance);
-
- /* If the noise reduction equals the airport noise itself, don't give it for free. Use it all minus 1.
+ uint noise_reduction = distance / town_tolerance_distance;
+
+ /* If the noise reduction equals the airport noise itself, don't give it for free.
* Otherwise, simply reduce the airport's level. */
- return max(1U, noise_reduction == afc->noise_level ? afc->noise_level - 1 : afc->noise_level - noise_reduction);
+ return noise_reduction >= afc->noise_level ? 1 : afc->noise_level - noise_reduction;
}
/** Place an Airport.
@@ -1731,7 +1728,7 @@
/* 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 {
@@ -1752,7 +1749,7 @@
byte w = fsmportsspec->size_x[layout_set];
byte h = fsmportsspec->size_y[layout_set];
- 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;
}
@@ -1762,7 +1759,7 @@
return CMD_ERROR;
}
- if (!_settings.station.adjacent_stations || !HasBit(p1, 24)) {
+ if (!_settings_game.station.adjacent_stations || !HasBit(p1, 24)) {
st = GetStationAround(tile, w, h, INVALID_STATION);
if (st == CHECK_STATIONS_ERR) return CMD_ERROR;
} else {
@@ -1872,7 +1869,7 @@
BEGIN_TILE_LOOP(tile_cur, w, h, tile) {
partial_snow_desert = 0x00;
byte layout = *layout_ptr++;
- if ((GetTropicZone(tile_cur) == TROPICZONE_DESERT) || ((GetTileZ(tile_cur) >= GetSnowLine() && _settings.game_creation.landscape == LT_ARCTIC)))
+ if ((GetTropicZone(tile_cur) == TROPICZONE_DESERT) || ((GetTileZ(tile_cur) >= GetSnowLine() && _settings_game.game_creation.landscape == LT_ARCTIC)))
partial_snow_desert = 1;
MakeAirport(tile_cur, st->owner, st->index, layout);
if (layout != 255)
@@ -1888,7 +1885,7 @@
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);
}
}
@@ -1963,7 +1960,7 @@
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);
}
@@ -2126,7 +2123,7 @@
/* 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);
@@ -2894,7 +2891,7 @@
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;
@@ -2917,7 +2914,7 @@
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;
@@ -2971,7 +2968,7 @@
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
@@ -3208,7 +3205,7 @@
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.
*/