mirror of https://github.com/OpenTTD/OpenTTD
(svn r23387) -Fix: move ai.script_max_opcode_till_suspend to script.script_max_opcode_till_suspend
parent
a8b22e5292
commit
9dde1287aa
|
@ -1264,7 +1264,7 @@ STR_CONFIG_SETTING_AI_BUILDS_AIRCRAFT :{LTBLUE}Disable
|
||||||
STR_CONFIG_SETTING_AI_BUILDS_SHIPS :{LTBLUE}Disable ships for computer: {ORANGE}{STRING1}
|
STR_CONFIG_SETTING_AI_BUILDS_SHIPS :{LTBLUE}Disable ships for computer: {ORANGE}{STRING1}
|
||||||
|
|
||||||
STR_CONFIG_SETTING_AI_IN_MULTIPLAYER :{LTBLUE}Allow AIs in multiplayer: {ORANGE}{STRING1}
|
STR_CONFIG_SETTING_AI_IN_MULTIPLAYER :{LTBLUE}Allow AIs in multiplayer: {ORANGE}{STRING1}
|
||||||
STR_CONFIG_SETTING_AI_MAX_OPCODES :{LTBLUE}#opcodes before AI is suspended: {ORANGE}{STRING1}
|
STR_CONFIG_SETTING_SCRIPT_MAX_OPCODES :{LTBLUE}#opcodes before scripts are suspended: {ORANGE}{STRING1}
|
||||||
|
|
||||||
STR_CONFIG_SETTING_SERVINT_ISPERCENT :{LTBLUE}Service intervals are in percents: {ORANGE}{STRING1}
|
STR_CONFIG_SETTING_SERVINT_ISPERCENT :{LTBLUE}Service intervals are in percents: {ORANGE}{STRING1}
|
||||||
STR_CONFIG_SETTING_SERVINT_TRAINS :{LTBLUE}Default service interval for trains: {ORANGE}{STRING1} day{P 0:1 "" s}/%
|
STR_CONFIG_SETTING_SERVINT_TRAINS :{LTBLUE}Default service interval for trains: {ORANGE}{STRING1} day{P 0:1 "" s}/%
|
||||||
|
@ -1357,6 +1357,7 @@ STR_CONFIG_SETTING_VEHICLES_ROUTING :{ORANGE}Routing
|
||||||
STR_CONFIG_SETTING_VEHICLES_TRAINS :{ORANGE}Trains
|
STR_CONFIG_SETTING_VEHICLES_TRAINS :{ORANGE}Trains
|
||||||
STR_CONFIG_SETTING_ECONOMY_TOWNS :{ORANGE}Towns
|
STR_CONFIG_SETTING_ECONOMY_TOWNS :{ORANGE}Towns
|
||||||
STR_CONFIG_SETTING_ECONOMY_INDUSTRIES :{ORANGE}Industries
|
STR_CONFIG_SETTING_ECONOMY_INDUSTRIES :{ORANGE}Industries
|
||||||
|
STR_CONFIG_SETTING_ECONOMY_SCRIPTS :{ORANGE}Scripts
|
||||||
|
|
||||||
STR_CONFIG_SETTING_PATHFINDER_OPF :Original
|
STR_CONFIG_SETTING_PATHFINDER_OPF :Original
|
||||||
STR_CONFIG_SETTING_PATHFINDER_NPF :NPF
|
STR_CONFIG_SETTING_PATHFINDER_NPF :NPF
|
||||||
|
|
|
@ -187,7 +187,7 @@ void ScriptInstance::GameLoop()
|
||||||
}
|
}
|
||||||
ScriptObject::SetAllowDoCommand(true);
|
ScriptObject::SetAllowDoCommand(true);
|
||||||
/* Start the script by calling Start() */
|
/* Start the script by calling Start() */
|
||||||
if (!this->engine->CallMethod(*this->instance, "Start", _settings_game.ai.ai_max_opcode_till_suspend) || !this->engine->IsSuspended()) this->Died();
|
if (!this->engine->CallMethod(*this->instance, "Start", _settings_game.script.script_max_opcode_till_suspend) || !this->engine->IsSuspended()) this->Died();
|
||||||
} catch (Script_Suspend e) {
|
} catch (Script_Suspend e) {
|
||||||
this->suspend = e.GetSuspendTime();
|
this->suspend = e.GetSuspendTime();
|
||||||
this->callback = e.GetSuspendCallback();
|
this->callback = e.GetSuspendCallback();
|
||||||
|
@ -208,7 +208,7 @@ void ScriptInstance::GameLoop()
|
||||||
|
|
||||||
/* Continue the VM */
|
/* Continue the VM */
|
||||||
try {
|
try {
|
||||||
if (!this->engine->Resume(_settings_game.ai.ai_max_opcode_till_suspend)) this->Died();
|
if (!this->engine->Resume(_settings_game.script.script_max_opcode_till_suspend)) this->Died();
|
||||||
} catch (Script_Suspend e) {
|
} catch (Script_Suspend e) {
|
||||||
this->suspend = e.GetSuspendTime();
|
this->suspend = e.GetSuspendTime();
|
||||||
this->callback = e.GetSuspendCallback();
|
this->callback = e.GetSuspendCallback();
|
||||||
|
@ -497,7 +497,7 @@ void ScriptInstance::Save()
|
||||||
void ScriptInstance::Suspend()
|
void ScriptInstance::Suspend()
|
||||||
{
|
{
|
||||||
HSQUIRRELVM vm = this->engine->GetVM();
|
HSQUIRRELVM vm = this->engine->GetVM();
|
||||||
Squirrel::DecreaseOps(vm, _settings_game.ai.ai_max_opcode_till_suspend);
|
Squirrel::DecreaseOps(vm, _settings_game.script.script_max_opcode_till_suspend);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ bool ScriptInstance::LoadObjects(HSQUIRRELVM vm)
|
/* static */ bool ScriptInstance::LoadObjects(HSQUIRRELVM vm)
|
||||||
|
|
|
@ -1479,9 +1479,16 @@ static SettingEntry _settings_economy_industries[] = {
|
||||||
/** Industries sub-page */
|
/** Industries sub-page */
|
||||||
static SettingsPage _settings_economy_industries_page = {_settings_economy_industries, lengthof(_settings_economy_industries)};
|
static SettingsPage _settings_economy_industries_page = {_settings_economy_industries, lengthof(_settings_economy_industries)};
|
||||||
|
|
||||||
|
static SettingEntry _settings_economy_scripts[] = {
|
||||||
|
SettingEntry("script.script_max_opcode_till_suspend"),
|
||||||
|
};
|
||||||
|
/** Scripts sub-page */
|
||||||
|
static SettingsPage _settings_economy_scripts_page = {_settings_economy_scripts, lengthof(_settings_economy_scripts)};
|
||||||
|
|
||||||
static SettingEntry _settings_economy[] = {
|
static SettingEntry _settings_economy[] = {
|
||||||
SettingEntry(&_settings_economy_towns_page, STR_CONFIG_SETTING_ECONOMY_TOWNS),
|
SettingEntry(&_settings_economy_towns_page, STR_CONFIG_SETTING_ECONOMY_TOWNS),
|
||||||
SettingEntry(&_settings_economy_industries_page, STR_CONFIG_SETTING_ECONOMY_INDUSTRIES),
|
SettingEntry(&_settings_economy_industries_page, STR_CONFIG_SETTING_ECONOMY_INDUSTRIES),
|
||||||
|
SettingEntry(&_settings_economy_scripts_page, STR_CONFIG_SETTING_ECONOMY_SCRIPTS),
|
||||||
SettingEntry("economy.inflation"),
|
SettingEntry("economy.inflation"),
|
||||||
SettingEntry("economy.smooth_economy"),
|
SettingEntry("economy.smooth_economy"),
|
||||||
SettingEntry("economy.feeder_payment_share"),
|
SettingEntry("economy.feeder_payment_share"),
|
||||||
|
@ -1495,7 +1502,6 @@ static SettingEntry _settings_ai_npc[] = {
|
||||||
SettingEntry("ai.ai_disable_veh_roadveh"),
|
SettingEntry("ai.ai_disable_veh_roadveh"),
|
||||||
SettingEntry("ai.ai_disable_veh_aircraft"),
|
SettingEntry("ai.ai_disable_veh_aircraft"),
|
||||||
SettingEntry("ai.ai_disable_veh_ship"),
|
SettingEntry("ai.ai_disable_veh_ship"),
|
||||||
SettingEntry("ai.ai_max_opcode_till_suspend"),
|
|
||||||
};
|
};
|
||||||
/** Computer players sub-page */
|
/** Computer players sub-page */
|
||||||
static SettingsPage _settings_ai_npc_page = {_settings_ai_npc, lengthof(_settings_ai_npc)};
|
static SettingsPage _settings_ai_npc_page = {_settings_ai_npc, lengthof(_settings_ai_npc)};
|
||||||
|
|
|
@ -257,7 +257,11 @@ struct AISettings {
|
||||||
bool ai_disable_veh_roadveh; ///< disable types for AI
|
bool ai_disable_veh_roadveh; ///< disable types for AI
|
||||||
bool ai_disable_veh_aircraft; ///< disable types for AI
|
bool ai_disable_veh_aircraft; ///< disable types for AI
|
||||||
bool ai_disable_veh_ship; ///< disable types for AI
|
bool ai_disable_veh_ship; ///< disable types for AI
|
||||||
uint32 ai_max_opcode_till_suspend; ///< max opcode calls till AI will suspend
|
};
|
||||||
|
|
||||||
|
/** Settings related to scripts. */
|
||||||
|
struct ScriptSettings {
|
||||||
|
uint32 script_max_opcode_till_suspend; ///< max opcode calls till scripts will suspend
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Settings related to the old pathfinder. */
|
/** Settings related to the old pathfinder. */
|
||||||
|
@ -447,6 +451,7 @@ struct GameSettings {
|
||||||
GameCreationSettings game_creation; ///< settings used during the creation of a game (map)
|
GameCreationSettings game_creation; ///< settings used during the creation of a game (map)
|
||||||
ConstructionSettings construction; ///< construction of things in-game
|
ConstructionSettings construction; ///< construction of things in-game
|
||||||
AISettings ai; ///< what may the AI do?
|
AISettings ai; ///< what may the AI do?
|
||||||
|
ScriptSettings script; ///< settings for scripts
|
||||||
class AIConfig *ai_config[MAX_COMPANIES]; ///< settings per company
|
class AIConfig *ai_config[MAX_COMPANIES]; ///< settings per company
|
||||||
PathfinderSettings pf; ///< settings for all pathfinders
|
PathfinderSettings pf; ///< settings for all pathfinders
|
||||||
OrderSettings order; ///< settings related to orders
|
OrderSettings order; ///< settings related to orders
|
||||||
|
|
|
@ -1160,7 +1160,7 @@ str = STR_CONFIG_SETTING_AI_BUILDS_SHIPS
|
||||||
|
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
base = GameSettings
|
base = GameSettings
|
||||||
var = ai.ai_max_opcode_till_suspend
|
var = script.script_max_opcode_till_suspend
|
||||||
type = SLE_UINT32
|
type = SLE_UINT32
|
||||||
from = 107
|
from = 107
|
||||||
guiflags = SGF_NEWGAME_ONLY
|
guiflags = SGF_NEWGAME_ONLY
|
||||||
|
@ -1168,7 +1168,7 @@ def = 10000
|
||||||
min = 5000
|
min = 5000
|
||||||
max = 250000
|
max = 250000
|
||||||
interval = 2500
|
interval = 2500
|
||||||
str = STR_CONFIG_SETTING_AI_MAX_OPCODES
|
str = STR_CONFIG_SETTING_SCRIPT_MAX_OPCODES
|
||||||
|
|
||||||
##
|
##
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
|
|
Loading…
Reference in New Issue