|
@@ -655,31 +655,31 @@ static bool PopulationInLabelActive(int3
|
|
|
UpdateAllTownVirtCoords();
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
static bool RedrawScreen(int32 p1)
|
|
|
{
|
|
|
MarkWholeScreenDirty();
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
static bool InvalidateDetailsWindow(int32 p1)
|
|
|
{
|
|
|
InvalidateWindowClasses(WC_VEHICLE_DETAILS);
|
|
|
SetWindowClassesDirty(WC_VEHICLE_DETAILS);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
static bool InvalidateStationBuildWindow(int32 p1)
|
|
|
{
|
|
|
InvalidateWindow(WC_BUILD_STATION, 0);
|
|
|
SetWindowDirty(WC_BUILD_STATION, 0);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
static bool InvalidateBuildIndustryWindow(int32 p1)
|
|
|
{
|
|
|
InvalidateWindowData(WC_BUILD_INDUSTRY, 0);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
static bool CloseSignalGUI(int32 p1)
|
|
|
{
|
|
|
if (p1 == 0) {
|
|
@@ -743,25 +743,25 @@ static bool TrainAccelerationModelChange
|
|
|
FOR_ALL_TRAINS(t) {
|
|
|
if (t->IsFrontEngine()) {
|
|
|
t->tcache.cached_max_curve_speed = GetTrainCurveSpeedLimit(t);
|
|
|
UpdateTrainAcceleration(t);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
static bool DragSignalsDensityChanged(int32)
|
|
|
{
|
|
|
InvalidateWindow(WC_BUILD_SIGNAL, 0);
|
|
|
SetWindowDirty(WC_BUILD_SIGNAL, 0);
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* A: competitors
|
|
|
* B: competitor start time. Deprecated since savegame version 110.
|
|
|
* C: town count (3 = high, 0 = very low)
|
|
|
* D: industry count (4 = high, 0 = none)
|
|
|
* E: inital loan (in GBP)
|
|
|
* F: interest rate
|
|
|
* G: running costs (0 = low, 2 = high)
|
|
@@ -811,25 +811,25 @@ static bool DifficultyReset(int32 level)
|
|
|
{
|
|
|
SetDifficultyLevel(level, (_game_mode == GM_MENU) ? &_settings_newgame.difficulty : &_settings_game.difficulty);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
static bool DifficultyChange(int32)
|
|
|
{
|
|
|
if (_game_mode == GM_MENU) {
|
|
|
if (_settings_newgame.difficulty.diff_level != 3) {
|
|
|
ShowErrorMessage(INVALID_STRING_ID, STR_WARNING_DIFFICULTY_TO_CUSTOM, 0, 0);
|
|
|
_settings_newgame.difficulty.diff_level = 3;
|
|
|
}
|
|
|
InvalidateWindowClasses(WC_SELECT_GAME);
|
|
|
SetWindowClassesDirty(WC_SELECT_GAME);
|
|
|
} else {
|
|
|
_settings_game.difficulty.diff_level = 3;
|
|
|
}
|
|
|
|
|
|
/* If we are a network-client, update the difficult setting (if it is open).
|
|
|
* Use this instead of just dirtying the window because we need to load in
|
|
|
* the new difficulty settings */
|
|
|
if (_networking && FindWindowById(WC_GAME_OPTIONS, 0) != NULL) {
|
|
|
ShowGameDifficulty();
|
|
|
}
|
|
|
|
|
|
return true;
|
|
@@ -1437,25 +1437,25 @@ CommandCost CmdChangeSetting(TileIndex t
|
|
|
|
|
|
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_SETTING);
|
|
|
GamelogSetting(sd->desc.name, oldval, newval);
|
|
|
GamelogStopAction();
|
|
|
}
|
|
|
|
|
|
InvalidateWindow(WC_GAME_OPTIONS, 0);
|
|
|
SetWindowDirty(WC_GAME_OPTIONS, 0);
|
|
|
}
|
|
|
|
|
|
return CommandCost();
|
|
|
}
|
|
|
|
|
|
/** Change one of the per-company settings.
|
|
|
* @param tile unused
|
|
|
* @param flags operation to perform
|
|
|
* @param p1 the index of the setting in the _company_settings array which identifies it
|
|
|
* @param p2 the new value for the setting
|
|
|
* The new value is properly clamped to its minimum/maximum when setting
|
|
|
*/
|
|
@@ -1471,25 +1471,25 @@ CommandCost CmdChangeCompanySetting(Tile
|
|
|
int32 newval = (int32)p2;
|
|
|
|
|
|
Write_ValidateSetting(var, sd, newval);
|
|
|
newval = (int32)ReadValue(var, sd->save.conv);
|
|
|
|
|
|
if (oldval == newval) return CommandCost();
|
|
|
|
|
|
if (sd->desc.proc != NULL && !sd->desc.proc(newval)) {
|
|
|
WriteValue(var, sd->save.conv, (int64)oldval);
|
|
|
return CommandCost();
|
|
|
}
|
|
|
|
|
|
InvalidateWindow(WC_GAME_OPTIONS, 0);
|
|
|
SetWindowDirty(WC_GAME_OPTIONS, 0);
|
|
|
}
|
|
|
|
|
|
return CommandCost();
|
|
|
}
|
|
|
|
|
|
/** Top function to save the new value of an element of the Settings struct
|
|
|
* @param index offset in the SettingDesc array of the Settings struct which
|
|
|
* identifies the setting member we want to change
|
|
|
* @param object pointer to a valid settings struct that has its settings change.
|
|
|
* This only affects setting-members that are not needed to be the same on all
|
|
|
* clients in a network game.
|
|
|
* @param value new value of the setting */
|
|
@@ -1500,25 +1500,25 @@ bool SetSettingValue(uint index, int32 v
|
|
|
* (if any) to change. Also *hack*hack* we update the _newgame version
|
|
|
* of settings because changing a company-based setting in a game also
|
|
|
* changes its defaults. At least that is the convention we have chosen */
|
|
|
if (sd->save.conv & SLF_NETWORK_NO) {
|
|
|
void *var = GetVariableAddress((_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game, &sd->save);
|
|
|
Write_ValidateSetting(var, sd, value);
|
|
|
|
|
|
if (_game_mode != GM_MENU) {
|
|
|
void *var2 = GetVariableAddress(&_settings_newgame, &sd->save);
|
|
|
Write_ValidateSetting(var2, sd, value);
|
|
|
}
|
|
|
if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv));
|
|
|
InvalidateWindow(WC_GAME_OPTIONS, 0);
|
|
|
SetWindowDirty(WC_GAME_OPTIONS, 0);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
/* send non-company-based settings over the network */
|
|
|
if (!_networking || (_networking && _network_server)) {
|
|
|
return DoCommandP(0, index, value, CMD_CHANGE_SETTING);
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
/** Top function to save the new value of an element of the Settings struct
|
|
|
* @param index offset in the SettingDesc array of the CompanySettings struct
|