Add console command to set NewGRF optimiser flags
This commit is contained in:
@@ -3068,6 +3068,39 @@ DEF_CONSOLE_CMD(ConMiscDebug)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEF_CONSOLE_CMD(ConSetNewGRFOptimiserFlags)
|
||||||
|
{
|
||||||
|
if (argc < 1 || argc > 2) {
|
||||||
|
IConsoleHelp("Debug: misc set_newgrf_optimiser_flags. Usage: 'set_newgrf_optimiser_flags [<flags>]'");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argc == 1) {
|
||||||
|
IConsolePrintF(CC_DEFAULT, "NewGRF optimiser flags: %X", _settings_game.debug.newgrf_optimiser_flags);
|
||||||
|
} else {
|
||||||
|
if (_game_mode == GM_MENU || (_networking && !_network_server)) {
|
||||||
|
IConsoleError("This command is only available in-game and in the editor, and not as a network client.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
extern uint NetworkClientCount();
|
||||||
|
if (_networking && NetworkClientCount() > 1) {
|
||||||
|
IConsoleError("This command is not available when network clients are connected.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint value = strtoul(argv[1], nullptr, 16);
|
||||||
|
if (_settings_game.debug.newgrf_optimiser_flags == value) return true;
|
||||||
|
_settings_game.debug.newgrf_optimiser_flags = value;
|
||||||
|
|
||||||
|
ReloadNewGRFData();
|
||||||
|
|
||||||
|
extern void PostCheckNewGRFLoadWarnings();
|
||||||
|
PostCheckNewGRFLoadWarnings();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
DEF_CONSOLE_CMD(ConDoDisaster)
|
DEF_CONSOLE_CMD(ConDoDisaster)
|
||||||
{
|
{
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
@@ -3662,6 +3695,7 @@ void IConsoleStdLibRegister()
|
|||||||
IConsole::CmdRegister("csleep", ConCSleep, nullptr, true);
|
IConsole::CmdRegister("csleep", ConCSleep, nullptr, true);
|
||||||
IConsole::CmdRegister("recalculate_road_cached_one_way_states", ConRecalculateRoadCachedOneWayStates, ConHookNoNetwork, true);
|
IConsole::CmdRegister("recalculate_road_cached_one_way_states", ConRecalculateRoadCachedOneWayStates, ConHookNoNetwork, true);
|
||||||
IConsole::CmdRegister("misc_debug", ConMiscDebug, nullptr, true);
|
IConsole::CmdRegister("misc_debug", ConMiscDebug, nullptr, true);
|
||||||
|
IConsole::CmdRegister("set_newgrf_optimiser_flags", ConSetNewGRFOptimiserFlags, nullptr, true);
|
||||||
|
|
||||||
/* NewGRF development stuff */
|
/* NewGRF development stuff */
|
||||||
IConsole::CmdRegister("reload_newgrfs", ConNewGRFReload, ConHookNewGRFDeveloperTool);
|
IConsole::CmdRegister("reload_newgrfs", ConNewGRFReload, ConHookNewGRFDeveloperTool);
|
||||||
|
@@ -158,6 +158,10 @@ byte NetworkSpectatorCount()
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint NetworkClientCount() {
|
||||||
|
return (uint)NetworkClientInfo::GetNumItems();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the company password of a given company.
|
* Change the company password of a given company.
|
||||||
* @param company_id ID of the company the password should be changed for.
|
* @param company_id ID of the company the password should be changed for.
|
||||||
|
@@ -37,6 +37,7 @@ extern StringList _network_host_list;
|
|||||||
extern StringList _network_ban_list;
|
extern StringList _network_ban_list;
|
||||||
|
|
||||||
byte NetworkSpectatorCount();
|
byte NetworkSpectatorCount();
|
||||||
|
uint NetworkClientCount();
|
||||||
bool NetworkIsValidClientName(const std::string_view client_name);
|
bool NetworkIsValidClientName(const std::string_view client_name);
|
||||||
bool NetworkValidateOurClientName();
|
bool NetworkValidateOurClientName();
|
||||||
bool NetworkValidateClientName(std::string &client_name);
|
bool NetworkValidateClientName(std::string &client_name);
|
||||||
|
Reference in New Issue
Block a user