Add NewGRF global flag to allow rocky tiles in tropic desert zones
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
|
||||
#include "safeguards.h"
|
||||
|
||||
bool _allow_rocks_desert = false;
|
||||
|
||||
static CommandCost ClearTile_Clear(TileIndex tile, DoCommandFlag flags)
|
||||
{
|
||||
static const Price clear_price_table[] = {
|
||||
@@ -298,6 +300,8 @@ static void TileLoopClearDesert(TileIndex tile)
|
||||
|
||||
if (current == expected) return;
|
||||
|
||||
if (_allow_rocks_desert && IsClearGround(tile, CLEAR_ROCKS)) return;
|
||||
|
||||
if (expected == 0) {
|
||||
SetClearGroundDensity(tile, CLEAR_GRASS, 3);
|
||||
} else {
|
||||
@@ -404,7 +408,7 @@ void GenerateClearTile()
|
||||
do {
|
||||
if (--j == 0) goto get_out;
|
||||
tile_new = tile + TileOffsByDiagDir((DiagDirection)GB(Random(), 0, 2));
|
||||
} while (!IsTileType(tile_new, MP_CLEAR) || IsClearGround(tile_new, CLEAR_DESERT));
|
||||
} while (!IsTileType(tile_new, MP_CLEAR) || (!_allow_rocks_desert && IsClearGround(tile_new, CLEAR_DESERT)));
|
||||
tile = tile_new;
|
||||
}
|
||||
get_out:;
|
||||
|
@@ -167,6 +167,9 @@ void InitGRFGlobalVars()
|
||||
|
||||
extern uint8 _extra_station_names_probability;
|
||||
_extra_station_names_probability = 0;
|
||||
|
||||
extern bool _allow_rocks_desert;
|
||||
_allow_rocks_desert = false;
|
||||
}
|
||||
|
||||
/** Actually load the sprite tables. */
|
||||
|
@@ -2850,6 +2850,13 @@ static ChangeInfoResult GlobalVarChangeInfo(uint gvid, int numinfo, int prop, co
|
||||
break;
|
||||
}
|
||||
|
||||
case A0RPI_GLOBALVAR_ALLOW_ROCKS_DESERT: {
|
||||
if (MappedPropertyLengthMismatch(buf, 1, mapping_entry)) break;
|
||||
extern bool _allow_rocks_desert;
|
||||
_allow_rocks_desert = (buf->ReadByte() != 0);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
ret = HandleAction0PropertyDefault(buf, prop);
|
||||
break;
|
||||
@@ -2922,6 +2929,7 @@ static ChangeInfoResult GlobalVarReserveInfo(uint gvid, int numinfo, int prop, c
|
||||
case A0RPI_GLOBALVAR_EXTRA_STATION_NAMES_PROBABILITY:
|
||||
case A0RPI_GLOBALVAR_LIGHTHOUSE_GENERATE_AMOUNT:
|
||||
case A0RPI_GLOBALVAR_TRANSMITTER_GENERATE_AMOUNT:
|
||||
case A0RPI_GLOBALVAR_ALLOW_ROCKS_DESERT:
|
||||
buf->Skip(buf->ReadExtendedByte());
|
||||
break;
|
||||
|
||||
|
@@ -42,6 +42,7 @@ extern const GRFFeatureInfo _grf_feature_list[] = {
|
||||
GRFFeatureInfo("varaction2_railtype_signal_context", 1),
|
||||
GRFFeatureInfo("action0_global_extra_station_names", 2),
|
||||
GRFFeatureInfo("action0_global_default_object_generate_amount", 1),
|
||||
GRFFeatureInfo("action0_global_allow_rocks_in_desert", 1),
|
||||
GRFFeatureInfo("action0_signals_programmable_signals", 1),
|
||||
GRFFeatureInfo("action0_signals_no_entry_signals", 1),
|
||||
GRFFeatureInfo("action0_signals_restricted_signals", 2),
|
||||
@@ -86,6 +87,7 @@ extern const GRFPropertyMapDefinition _grf_action0_remappable_properties[] = {
|
||||
GRFPropertyMapDefinition(GSF_GLOBALVAR, A0RPI_GLOBALVAR_EXTRA_STATION_NAMES_PROBABILITY, "global_extra_station_names_probability"),
|
||||
GRFPropertyMapDefinition(GSF_GLOBALVAR, A0RPI_GLOBALVAR_LIGHTHOUSE_GENERATE_AMOUNT, "global_lighthouse_generate_amount"),
|
||||
GRFPropertyMapDefinition(GSF_GLOBALVAR, A0RPI_GLOBALVAR_TRANSMITTER_GENERATE_AMOUNT, "global_transmitter_generate_amount"),
|
||||
GRFPropertyMapDefinition(GSF_GLOBALVAR, A0RPI_GLOBALVAR_ALLOW_ROCKS_DESERT, "global_allow_rocks_in_desert"),
|
||||
GRFPropertyMapDefinition(GSF_SIGNALS, A0RPI_SIGNALS_ENABLE_PROGRAMMABLE_SIGNALS, "signals_enable_programmable_signals"),
|
||||
GRFPropertyMapDefinition(GSF_SIGNALS, A0RPI_SIGNALS_ENABLE_NO_ENTRY_SIGNALS, "signals_enable_no_entry_signals"),
|
||||
GRFPropertyMapDefinition(GSF_SIGNALS, A0RPI_SIGNALS_ENABLE_RESTRICTED_SIGNALS, "signals_enable_restricted_signals"),
|
||||
|
@@ -30,6 +30,7 @@ enum Action0RemapPropertyIds {
|
||||
A0RPI_GLOBALVAR_EXTRA_STATION_NAMES_PROBABILITY,
|
||||
A0RPI_GLOBALVAR_LIGHTHOUSE_GENERATE_AMOUNT,
|
||||
A0RPI_GLOBALVAR_TRANSMITTER_GENERATE_AMOUNT,
|
||||
A0RPI_GLOBALVAR_ALLOW_ROCKS_DESERT,
|
||||
A0RPI_SIGNALS_ENABLE_PROGRAMMABLE_SIGNALS,
|
||||
A0RPI_SIGNALS_ENABLE_NO_ENTRY_SIGNALS,
|
||||
A0RPI_SIGNALS_ENABLE_RESTRICTED_SIGNALS,
|
||||
|
Reference in New Issue
Block a user