forked from mirror/OpenTTD
(svn r3746) - [7/7] Moving the callback functions for the setting-changes from settings_gui.c to settings.c. Also enable the callback functionality through the console.
- Fix a nasty bug with improper counter addition. (*i)++ and NOT *i++ when setting a patch value through the console.
This commit is contained in:
@@ -555,98 +555,6 @@ void ShowGameDifficulty(void)
|
||||
AllocateWindowDesc(&_game_difficulty_desc);
|
||||
}
|
||||
|
||||
// virtual PositionMainToolbar function, calls the right one.
|
||||
static int32 v_PositionMainToolbar(int32 p1)
|
||||
{
|
||||
if (_game_mode != GM_MENU) PositionMainToolbar(NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32 AiNew_PatchActive_Warning(int32 p1)
|
||||
{
|
||||
if (p1 == 1) ShowErrorMessage(INVALID_STRING_ID, TEMP_AI_ACTIVATED, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32 Ai_In_Multiplayer_Warning(int32 p1)
|
||||
{
|
||||
if (p1 == 1) {
|
||||
ShowErrorMessage(INVALID_STRING_ID, TEMP_AI_MULTIPLAYER, 0, 0);
|
||||
_patches.ainew_active = true;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32 PopulationInLabelActive(int32 p1)
|
||||
{
|
||||
Town* t;
|
||||
|
||||
FOR_ALL_TOWNS(t) {
|
||||
if (t->xy != 0) UpdateTownVirtCoord(t);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32 InvisibleTreesActive(int32 p1)
|
||||
{
|
||||
MarkWholeScreenDirty();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32 InValidateDetailsWindow(int32 p1)
|
||||
{
|
||||
InvalidateWindowClasses(WC_VEHICLE_DETAILS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32 InvalidateStationBuildWindow(int32 p1)
|
||||
{
|
||||
InvalidateWindow(WC_BUILD_STATION, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check service intervals of vehicles, p1 is value of % or day based servicing */
|
||||
static int32 CheckInterval(int32 p1)
|
||||
{
|
||||
bool warning;
|
||||
if (p1) {
|
||||
warning = ( (IS_INT_INSIDE(_patches.servint_trains, 5, 90+1) || _patches.servint_trains == 0) &&
|
||||
(IS_INT_INSIDE(_patches.servint_roadveh, 5, 90+1) || _patches.servint_roadveh == 0) &&
|
||||
(IS_INT_INSIDE(_patches.servint_aircraft, 5, 90+1) || _patches.servint_aircraft == 0) &&
|
||||
(IS_INT_INSIDE(_patches.servint_ships, 5, 90+1) || _patches.servint_ships == 0) );
|
||||
} else {
|
||||
warning = ( (IS_INT_INSIDE(_patches.servint_trains, 30, 800+1) || _patches.servint_trains == 0) &&
|
||||
(IS_INT_INSIDE(_patches.servint_roadveh, 30, 800+1) || _patches.servint_roadveh == 0) &&
|
||||
(IS_INT_INSIDE(_patches.servint_aircraft, 30, 800+1) || _patches.servint_aircraft == 0) &&
|
||||
(IS_INT_INSIDE(_patches.servint_ships, 30, 800+1) || _patches.servint_ships == 0) );
|
||||
}
|
||||
|
||||
if (!warning)
|
||||
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_SERVICE_INTERVAL_INCOMPATIBLE, 0, 0);
|
||||
|
||||
return InValidateDetailsWindow(0);
|
||||
}
|
||||
|
||||
static int32 EngineRenewUpdate(int32 p1)
|
||||
{
|
||||
DoCommandP(0, 0, _patches.autorenew, NULL, CMD_REPLACE_VEHICLE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32 EngineRenewMonthsUpdate(int32 p1)
|
||||
{
|
||||
DoCommandP(0, 1, _patches.autorenew_months, NULL, CMD_REPLACE_VEHICLE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32 EngineRenewMoneyUpdate(int32 p1)
|
||||
{
|
||||
DoCommandP(0, 2, _patches.autorenew_money, NULL, CMD_REPLACE_VEHICLE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef int32 PatchButtonClick(int32);
|
||||
|
||||
typedef uint PatchEntry;
|
||||
|
||||
static const PatchEntry _patches_ui[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
|
||||
|
Reference in New Issue
Block a user