mirror of https://github.com/OpenTTD/OpenTTD
(svn r15334) -Codechange: reset setting to old value when the callback procedure returns false
parent
3cf7255c4f
commit
496b541cb1
|
@ -479,7 +479,7 @@ void DrawCatenary(const TileInfo *ti)
|
||||||
DrawCatenaryRailway(ti);
|
DrawCatenaryRailway(ti);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 SettingsDisableElrail(int32 p1)
|
bool SettingsDisableElrail(int32 p1)
|
||||||
{
|
{
|
||||||
Vehicle *v;
|
Vehicle *v;
|
||||||
Company *c;
|
Company *c;
|
||||||
|
@ -529,5 +529,5 @@ int32 SettingsDisableElrail(int32 p1)
|
||||||
* rails. It may have unintended consequences if that function is ever
|
* rails. It may have unintended consequences if that function is ever
|
||||||
* extended, though. */
|
* extended, though. */
|
||||||
ReinitGuiAfterToggleElrail(disable);
|
ReinitGuiAfterToggleElrail(disable);
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,6 @@ void DrawCatenary(const TileInfo *ti);
|
||||||
void DrawCatenaryOnTunnel(const TileInfo *ti);
|
void DrawCatenaryOnTunnel(const TileInfo *ti);
|
||||||
void DrawCatenaryOnBridge(const TileInfo *ti);
|
void DrawCatenaryOnBridge(const TileInfo *ti);
|
||||||
|
|
||||||
int32 SettingsDisableElrail(int32 p1); ///< _settings_game.disable_elrail callback
|
bool SettingsDisableElrail(int32 p1); ///< _settings_game.disable_elrail callback
|
||||||
|
|
||||||
#endif /* ELRAIL_FUNC_H */
|
#endif /* ELRAIL_FUNC_H */
|
||||||
|
|
|
@ -1779,7 +1779,7 @@ static void SetDefaultRailGui()
|
||||||
* @param 0 needed to be called when a patch setting changes
|
* @param 0 needed to be called when a patch setting changes
|
||||||
* @return success, needed for patch settings
|
* @return success, needed for patch settings
|
||||||
*/
|
*/
|
||||||
int32 ResetSignalVariant(int32 = 0)
|
bool ResetSignalVariant(int32 = 0)
|
||||||
{
|
{
|
||||||
SignalVariant new_variant = (_cur_year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC);
|
SignalVariant new_variant = (_cur_year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC);
|
||||||
|
|
||||||
|
@ -1792,7 +1792,7 @@ int32 ResetSignalVariant(int32 = 0)
|
||||||
_cur_signal_variant = new_variant;
|
_cur_signal_variant = new_variant;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Resets the rail GUI - sets default railtype to build
|
/** Resets the rail GUI - sets default railtype to build
|
||||||
|
|
|
@ -9,6 +9,6 @@
|
||||||
|
|
||||||
void ShowBuildRailToolbar(RailType railtype, int button);
|
void ShowBuildRailToolbar(RailType railtype, int button);
|
||||||
void ReinitGuiAfterToggleElrail(bool disable);
|
void ReinitGuiAfterToggleElrail(bool disable);
|
||||||
int32 ResetSignalVariant(int32 = 0);
|
bool ResetSignalVariant(int32 = 0);
|
||||||
|
|
||||||
#endif /* RAIL_GUI_H */
|
#endif /* RAIL_GUI_H */
|
||||||
|
|
144
src/settings.cpp
144
src/settings.cpp
|
@ -818,77 +818,76 @@ static void ini_save_setting_list(IniFile *ini, const char *grpname, char **list
|
||||||
|
|
||||||
/* Begin - Callback Functions for the various settings */
|
/* Begin - Callback Functions for the various settings */
|
||||||
/* virtual PositionMainToolbar function, calls the right one.*/
|
/* virtual PositionMainToolbar function, calls the right one.*/
|
||||||
static int32 v_PositionMainToolbar(int32 p1)
|
static bool v_PositionMainToolbar(int32 p1)
|
||||||
{
|
{
|
||||||
if (_game_mode != GM_MENU) PositionMainToolbar(NULL);
|
if (_game_mode != GM_MENU) PositionMainToolbar(NULL);
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 PopulationInLabelActive(int32 p1)
|
static bool PopulationInLabelActive(int32 p1)
|
||||||
{
|
{
|
||||||
Town *t;
|
Town *t;
|
||||||
|
|
||||||
FOR_ALL_TOWNS(t) UpdateTownVirtCoord(t);
|
FOR_ALL_TOWNS(t) UpdateTownVirtCoord(t);
|
||||||
|
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 RedrawScreen(int32 p1)
|
static bool RedrawScreen(int32 p1)
|
||||||
{
|
{
|
||||||
MarkWholeScreenDirty();
|
MarkWholeScreenDirty();
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 InValidateDetailsWindow(int32 p1)
|
static bool InvalidateDetailsWindow(int32 p1)
|
||||||
{
|
{
|
||||||
InvalidateWindowClasses(WC_VEHICLE_DETAILS);
|
InvalidateWindowClasses(WC_VEHICLE_DETAILS);
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 InvalidateStationBuildWindow(int32 p1)
|
static bool InvalidateStationBuildWindow(int32 p1)
|
||||||
{
|
{
|
||||||
InvalidateWindow(WC_BUILD_STATION, 0);
|
InvalidateWindow(WC_BUILD_STATION, 0);
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 InvalidateBuildIndustryWindow(int32 p1)
|
static bool InvalidateBuildIndustryWindow(int32 p1)
|
||||||
{
|
{
|
||||||
InvalidateWindowData(WC_BUILD_INDUSTRY, 0);
|
InvalidateWindowData(WC_BUILD_INDUSTRY, 0);
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 CloseSignalGUI(int32 p1)
|
static bool CloseSignalGUI(int32 p1)
|
||||||
{
|
{
|
||||||
if (p1 == 0) {
|
if (p1 == 0) {
|
||||||
DeleteWindowByClass(WC_BUILD_SIGNAL);
|
DeleteWindowByClass(WC_BUILD_SIGNAL);
|
||||||
}
|
}
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 InvalidateTownViewWindow(int32 p1)
|
static bool InvalidateTownViewWindow(int32 p1)
|
||||||
{
|
{
|
||||||
InvalidateWindowClassesData(WC_TOWN_VIEW, p1);
|
InvalidateWindowClassesData(WC_TOWN_VIEW, p1);
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 DeleteSelectStationWindow(int32 p1)
|
static bool DeleteSelectStationWindow(int32 p1)
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
DeleteWindowById(WC_SELECT_STATION, 0);
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 UpdateConsists(int32 p1)
|
static bool UpdateConsists(int32 p1)
|
||||||
{
|
{
|
||||||
Vehicle *v;
|
Vehicle *v;
|
||||||
FOR_ALL_VEHICLES(v) {
|
FOR_ALL_VEHICLES(v) {
|
||||||
/* Update the consist of all trains so the maximum speed is set correctly. */
|
/* Update the consist of all trains so the maximum speed is set correctly. */
|
||||||
if (v->type == VEH_TRAIN && (IsFrontEngine(v) || IsFreeWagon(v))) TrainConsistChanged(v, true);
|
if (v->type == VEH_TRAIN && (IsFrontEngine(v) || IsFreeWagon(v))) TrainConsistChanged(v, true);
|
||||||
}
|
}
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check service intervals of vehicles, p1 is value of % or day based servicing */
|
/* Check service intervals of vehicles, p1 is value of % or day based servicing */
|
||||||
static int32 CheckInterval(int32 p1)
|
static bool CheckInterval(int32 p1)
|
||||||
{
|
{
|
||||||
VehicleSettings *ptc = (_game_mode == GM_MENU) ? &_settings_newgame.vehicle : &_settings_game.vehicle;
|
VehicleSettings *ptc = (_game_mode == GM_MENU) ? &_settings_newgame.vehicle : &_settings_game.vehicle;
|
||||||
|
|
||||||
|
@ -904,28 +903,30 @@ static int32 CheckInterval(int32 p1)
|
||||||
ptc->servint_ships = 100;
|
ptc->servint_ships = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
return InValidateDetailsWindow(0);
|
InvalidateDetailsWindow(0);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 EngineRenewUpdate(int32 p1)
|
static bool EngineRenewUpdate(int32 p1)
|
||||||
{
|
{
|
||||||
DoCommandP(0, 0, _settings_client.gui.autorenew, CMD_SET_AUTOREPLACE);
|
DoCommandP(0, 0, _settings_client.gui.autorenew, CMD_SET_AUTOREPLACE);
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 EngineRenewMonthsUpdate(int32 p1)
|
static bool EngineRenewMonthsUpdate(int32 p1)
|
||||||
{
|
{
|
||||||
DoCommandP(0, 1, _settings_client.gui.autorenew_months, CMD_SET_AUTOREPLACE);
|
DoCommandP(0, 1, _settings_client.gui.autorenew_months, CMD_SET_AUTOREPLACE);
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 EngineRenewMoneyUpdate(int32 p1)
|
static bool EngineRenewMoneyUpdate(int32 p1)
|
||||||
{
|
{
|
||||||
DoCommandP(0, 2, _settings_client.gui.autorenew_money, CMD_SET_AUTOREPLACE);
|
DoCommandP(0, 2, _settings_client.gui.autorenew_money, CMD_SET_AUTOREPLACE);
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 TrainAccelerationModelChanged(int32 p1)
|
static bool TrainAccelerationModelChanged(int32 p1)
|
||||||
{
|
{
|
||||||
Vehicle *v;
|
Vehicle *v;
|
||||||
|
|
||||||
|
@ -933,14 +934,14 @@ static int32 TrainAccelerationModelChanged(int32 p1)
|
||||||
if (v->type == VEH_TRAIN && IsFrontEngine(v)) UpdateTrainAcceleration(v);
|
if (v->type == VEH_TRAIN && IsFrontEngine(v)) UpdateTrainAcceleration(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 DragSignalsDensityChanged(int32)
|
static bool DragSignalsDensityChanged(int32)
|
||||||
{
|
{
|
||||||
SetWindowDirty(FindWindowById(WC_BUILD_SIGNAL, 0));
|
SetWindowDirty(FindWindowById(WC_BUILD_SIGNAL, 0));
|
||||||
|
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -993,13 +994,13 @@ void CheckDifficultyLevels()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 DifficultyReset(int32 level)
|
static bool DifficultyReset(int32 level)
|
||||||
{
|
{
|
||||||
SetDifficultyLevel(level, (_game_mode == GM_MENU) ? &_settings_newgame.difficulty : &_settings_game.difficulty);
|
SetDifficultyLevel(level, (_game_mode == GM_MENU) ? &_settings_newgame.difficulty : &_settings_game.difficulty);
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 DifficultyChange(int32)
|
static bool DifficultyChange(int32)
|
||||||
{
|
{
|
||||||
if (_game_mode == GM_MENU) {
|
if (_game_mode == GM_MENU) {
|
||||||
_settings_newgame.difficulty.diff_level = 3;
|
_settings_newgame.difficulty.diff_level = 3;
|
||||||
|
@ -1014,10 +1015,10 @@ static int32 DifficultyChange(int32)
|
||||||
ShowGameDifficulty();
|
ShowGameDifficulty();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 DifficultyNoiseChange(int32 i)
|
static bool DifficultyNoiseChange(int32 i)
|
||||||
{
|
{
|
||||||
if (_game_mode == GM_NORMAL) {
|
if (_game_mode == GM_NORMAL) {
|
||||||
UpdateAirportsNoise();
|
UpdateAirportsNoise();
|
||||||
|
@ -1035,15 +1036,15 @@ static int32 DifficultyNoiseChange(int32 i)
|
||||||
* able to grow. If a user desires to have a town with no road,
|
* able to grow. If a user desires to have a town with no road,
|
||||||
* he can easily remove them himself. This would create less confusion
|
* he can easily remove them himself. This would create less confusion
|
||||||
* @param p1 unused
|
* @param p1 unused
|
||||||
* @return always 0
|
* @return always true
|
||||||
*/
|
*/
|
||||||
static int32 CheckTownLayout(int32 p1)
|
static bool CheckTownLayout(int32 p1)
|
||||||
{
|
{
|
||||||
if (_settings_game.economy.town_layout == TL_NO_ROADS && _game_mode == GM_EDITOR) {
|
if (_settings_game.economy.town_layout == TL_NO_ROADS && _game_mode == GM_EDITOR) {
|
||||||
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_TOWN_LAYOUT_INVALID, 0, 0);
|
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_TOWN_LAYOUT_INVALID, 0, 0);
|
||||||
_settings_game.economy.town_layout = TL_ORIGINAL;
|
_settings_game.economy.town_layout = TL_ORIGINAL;
|
||||||
}
|
}
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Conversion callback for _gameopt_settings_game.landscape
|
/** Conversion callback for _gameopt_settings_game.landscape
|
||||||
|
@ -1073,24 +1074,22 @@ static int32 CheckNoiseToleranceLevel(const char *value)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 CheckFreeformEdges(int32 p1)
|
static bool CheckFreeformEdges(int32 p1)
|
||||||
{
|
{
|
||||||
if (_game_mode == GM_MENU) return 0;
|
if (_game_mode == GM_MENU) return true;
|
||||||
if (p1 != 0) {
|
if (p1 != 0) {
|
||||||
Vehicle *v;
|
Vehicle *v;
|
||||||
FOR_ALL_VEHICLES(v) {
|
FOR_ALL_VEHICLES(v) {
|
||||||
if (v->type == VEH_SHIP && (TileX(v->tile) == 0 || TileY(v->tile) == 0)) {
|
if (v->type == VEH_SHIP && (TileX(v->tile) == 0 || TileY(v->tile) == 0)) {
|
||||||
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_EDGES_NOT_EMPTY, 0, 0);
|
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_EDGES_NOT_EMPTY, 0, 0);
|
||||||
_settings_game.construction.freeform_edges = false;
|
return false;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Station *st;
|
Station *st;
|
||||||
FOR_ALL_STATIONS(st) {
|
FOR_ALL_STATIONS(st) {
|
||||||
if (TileX(st->xy) == 0 || TileY(st->xy) == 0) {
|
if (TileX(st->xy) == 0 || TileY(st->xy) == 0) {
|
||||||
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_EDGES_NOT_EMPTY, 0, 0);
|
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_EDGES_NOT_EMPTY, 0, 0);
|
||||||
_settings_game.construction.freeform_edges = false;
|
return false;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (uint i = 0; i < MapSizeX(); i++) MakeVoid(TileXY(i, 0));
|
for (uint i = 0; i < MapSizeX(); i++) MakeVoid(TileXY(i, 0));
|
||||||
|
@ -1099,29 +1098,25 @@ static int32 CheckFreeformEdges(int32 p1)
|
||||||
for (uint i = 0; i < MapMaxX(); i++) {
|
for (uint i = 0; i < MapMaxX(); i++) {
|
||||||
if (TileHeight(TileXY(i, 1)) != 0) {
|
if (TileHeight(TileXY(i, 1)) != 0) {
|
||||||
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_EDGES_NOT_WATER, 0, 0);
|
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_EDGES_NOT_WATER, 0, 0);
|
||||||
_settings_game.construction.freeform_edges = true;
|
return false;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (uint i = 1; i < MapMaxX(); i++) {
|
for (uint i = 1; i < MapMaxX(); i++) {
|
||||||
if (!IsTileType(TileXY(i, MapMaxY() - 1), MP_WATER) || TileHeight(TileXY(1, MapMaxY())) != 0) {
|
if (!IsTileType(TileXY(i, MapMaxY() - 1), MP_WATER) || TileHeight(TileXY(1, MapMaxY())) != 0) {
|
||||||
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_EDGES_NOT_WATER, 0, 0);
|
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_EDGES_NOT_WATER, 0, 0);
|
||||||
_settings_game.construction.freeform_edges = true;
|
return false;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (uint i = 0; i < MapMaxY(); i++) {
|
for (uint i = 0; i < MapMaxY(); i++) {
|
||||||
if (TileHeight(TileXY(1, i)) != 0) {
|
if (TileHeight(TileXY(1, i)) != 0) {
|
||||||
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_EDGES_NOT_WATER, 0, 0);
|
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_EDGES_NOT_WATER, 0, 0);
|
||||||
_settings_game.construction.freeform_edges = true;
|
return false;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (uint i = 1; i < MapMaxY(); i++) {
|
for (uint i = 1; i < MapMaxY(); i++) {
|
||||||
if (!IsTileType(TileXY(MapMaxX() - 1, i), MP_WATER) || TileHeight(TileXY(MapMaxX(), i)) != 0) {
|
if (!IsTileType(TileXY(MapMaxX() - 1, i), MP_WATER) || TileHeight(TileXY(MapMaxX(), i)) != 0) {
|
||||||
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_EDGES_NOT_WATER, 0, 0);
|
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_EDGES_NOT_WATER, 0, 0);
|
||||||
_settings_game.construction.freeform_edges = true;
|
return false;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Make tiles at the border water again. */
|
/* Make tiles at the border water again. */
|
||||||
|
@ -1135,46 +1130,46 @@ static int32 CheckFreeformEdges(int32 p1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MarkWholeScreenDirty();
|
MarkWholeScreenDirty();
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_NETWORK
|
#ifdef ENABLE_NETWORK
|
||||||
|
|
||||||
static int32 UpdateMinActiveClients(int32 p1)
|
static bool UpdateMinActiveClients(int32 p1)
|
||||||
{
|
{
|
||||||
CheckMinActiveClients();
|
CheckMinActiveClients();
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 UpdateClientName(int32 p1)
|
static bool UpdateClientName(int32 p1)
|
||||||
{
|
{
|
||||||
NetworkUpdateClientName();
|
NetworkUpdateClientName();
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 UpdateServerPassword(int32 p1)
|
static bool UpdateServerPassword(int32 p1)
|
||||||
{
|
{
|
||||||
if (strcmp(_settings_client.network.server_password, "*") == 0) {
|
if (strcmp(_settings_client.network.server_password, "*") == 0) {
|
||||||
_settings_client.network.server_password[0] = '\0';
|
_settings_client.network.server_password[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 UpdateRconPassword(int32 p1)
|
static bool UpdateRconPassword(int32 p1)
|
||||||
{
|
{
|
||||||
if (strcmp(_settings_client.network.rcon_password, "*") == 0) {
|
if (strcmp(_settings_client.network.rcon_password, "*") == 0) {
|
||||||
_settings_client.network.rcon_password[0] = '\0';
|
_settings_client.network.rcon_password[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 UpdateClientConfigValues(int32 p1)
|
static bool UpdateClientConfigValues(int32 p1)
|
||||||
{
|
{
|
||||||
if (_network_server) NetworkServerSendConfigUpdate();
|
if (_network_server) NetworkServerSendConfigUpdate();
|
||||||
|
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* ENABLE_NETWORK */
|
#endif /* ENABLE_NETWORK */
|
||||||
|
@ -1339,10 +1334,10 @@ const SettingDesc _patch_settings[] = {
|
||||||
SDT_VAR(GameSettings, vehicle.max_aircraft, SLE_UINT16, 0, 0, 200, 0, 5000, 0, STR_CONFIG_PATCHES_MAX_AIRCRAFT, RedrawScreen),
|
SDT_VAR(GameSettings, vehicle.max_aircraft, SLE_UINT16, 0, 0, 200, 0, 5000, 0, STR_CONFIG_PATCHES_MAX_AIRCRAFT, RedrawScreen),
|
||||||
SDT_VAR(GameSettings, vehicle.max_ships, SLE_UINT16, 0, 0, 300, 0, 5000, 0, STR_CONFIG_PATCHES_MAX_SHIPS, RedrawScreen),
|
SDT_VAR(GameSettings, vehicle.max_ships, SLE_UINT16, 0, 0, 300, 0, 5000, 0, STR_CONFIG_PATCHES_MAX_SHIPS, RedrawScreen),
|
||||||
SDT_BOOL(GameSettings, vehicle.servint_ispercent, 0,NN, false, STR_CONFIG_PATCHES_SERVINT_ISPERCENT, CheckInterval),
|
SDT_BOOL(GameSettings, vehicle.servint_ispercent, 0,NN, false, STR_CONFIG_PATCHES_SERVINT_ISPERCENT, CheckInterval),
|
||||||
SDT_VAR(GameSettings, vehicle.servint_trains, SLE_UINT16, 0,D0, 150, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_TRAINS, InValidateDetailsWindow),
|
SDT_VAR(GameSettings, vehicle.servint_trains, SLE_UINT16, 0,D0, 150, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_TRAINS, InvalidateDetailsWindow),
|
||||||
SDT_VAR(GameSettings, vehicle.servint_roadveh, SLE_UINT16, 0,D0, 150, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_ROADVEH, InValidateDetailsWindow),
|
SDT_VAR(GameSettings, vehicle.servint_roadveh, SLE_UINT16, 0,D0, 150, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_ROADVEH, InvalidateDetailsWindow),
|
||||||
SDT_VAR(GameSettings, vehicle.servint_ships, SLE_UINT16, 0,D0, 360, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_SHIPS, InValidateDetailsWindow),
|
SDT_VAR(GameSettings, vehicle.servint_ships, SLE_UINT16, 0,D0, 360, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_SHIPS, InvalidateDetailsWindow),
|
||||||
SDT_VAR(GameSettings, vehicle.servint_aircraft, SLE_UINT16, 0,D0, 100, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_AIRCRAFT, InValidateDetailsWindow),
|
SDT_VAR(GameSettings, vehicle.servint_aircraft, SLE_UINT16, 0,D0, 100, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_AIRCRAFT, InvalidateDetailsWindow),
|
||||||
SDT_BOOL(GameSettings, order.no_servicing_if_no_breakdowns, 0, 0, false, STR_CONFIG_PATCHES_NOSERVICE, NULL),
|
SDT_BOOL(GameSettings, order.no_servicing_if_no_breakdowns, 0, 0, false, STR_CONFIG_PATCHES_NOSERVICE, NULL),
|
||||||
SDT_BOOL(GameSettings, vehicle.wagon_speed_limits, 0,NN, true, STR_CONFIG_PATCHES_WAGONSPEEDLIMITS, UpdateConsists),
|
SDT_BOOL(GameSettings, vehicle.wagon_speed_limits, 0,NN, true, STR_CONFIG_PATCHES_WAGONSPEEDLIMITS, UpdateConsists),
|
||||||
SDT_CONDBOOL(GameSettings, vehicle.disable_elrails, 38, SL_MAX_VERSION, 0,NN, false, STR_CONFIG_PATCHES_DISABLE_ELRAILS, SettingsDisableElrail),
|
SDT_CONDBOOL(GameSettings, vehicle.disable_elrails, 38, SL_MAX_VERSION, 0,NN, false, STR_CONFIG_PATCHES_DISABLE_ELRAILS, SettingsDisableElrail),
|
||||||
|
@ -1998,9 +1993,14 @@ CommandCost CmdChangePatchSetting(TileIndex tile, uint32 flags, uint32 p1, uint3
|
||||||
Write_ValidateSetting(var, sd, newval);
|
Write_ValidateSetting(var, sd, newval);
|
||||||
newval = (int32)ReadValue(var, sd->save.conv);
|
newval = (int32)ReadValue(var, sd->save.conv);
|
||||||
|
|
||||||
if (sd->desc.proc != NULL) sd->desc.proc(newval);
|
if (oldval == newval) return CommandCost();
|
||||||
|
|
||||||
if ((sd->desc.flags & SGF_NO_NETWORK) && oldval != newval) {
|
if (sd->desc.proc != NULL && !sd->desc.proc(newval)) {
|
||||||
|
WriteValue(var, sd->save.conv, (int64)oldval);
|
||||||
|
return CommandCost();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sd->desc.flags & SGF_NO_NETWORK) {
|
||||||
GamelogStartAction(GLAT_PATCH);
|
GamelogStartAction(GLAT_PATCH);
|
||||||
GamelogPatch(sd->desc.name, oldval, newval);
|
GamelogPatch(sd->desc.name, oldval, newval);
|
||||||
GamelogStopAction();
|
GamelogStopAction();
|
||||||
|
|
|
@ -48,7 +48,7 @@ template <> struct EnumPropsT<SettingGuiFlagLong> : MakeEnumPropsT<SettingGuiFla
|
||||||
typedef TinyEnumT<SettingGuiFlagLong> SettingGuiFlag;
|
typedef TinyEnumT<SettingGuiFlagLong> SettingGuiFlag;
|
||||||
|
|
||||||
|
|
||||||
typedef int32 OnChange(int32 var); ///< callback prototype on data modification
|
typedef bool OnChange(int32 var); ///< callback prototype on data modification
|
||||||
typedef int32 OnConvert(const char *value); ///< callback prototype for convertion error
|
typedef int32 OnConvert(const char *value); ///< callback prototype for convertion error
|
||||||
|
|
||||||
struct SettingDescBase {
|
struct SettingDescBase {
|
||||||
|
|
Loading…
Reference in New Issue