diff --git a/src/ai/ai_info.cpp b/src/ai/ai_info.cpp index 2b3036c8ef..eb3400b244 100644 --- a/src/ai/ai_info.cpp +++ b/src/ai/ai_info.cpp @@ -42,14 +42,14 @@ template <> const char *GetClassName() { return "AIInfo" SQAIInfo.DefSQAdvancedMethod(engine, &AIInfo::AddSetting, "AddSetting"); SQAIInfo.DefSQAdvancedMethod(engine, &AIInfo::AddLabels, "AddLabels"); SQAIInfo.DefSQConst(engine, SCRIPTCONFIG_NONE, "CONFIG_NONE"); - SQAIInfo.DefSQConst(engine, SCRIPTCONFIG_RANDOM, "CONFIG_RANDOM"); + SQAIInfo.DefSQConst(engine, SCRIPTCONFIG_NONE, "CONFIG_RANDOM"); // Deprecated, mapped to NONE. SQAIInfo.DefSQConst(engine, SCRIPTCONFIG_BOOLEAN, "CONFIG_BOOLEAN"); SQAIInfo.DefSQConst(engine, SCRIPTCONFIG_INGAME, "CONFIG_INGAME"); SQAIInfo.DefSQConst(engine, SCRIPTCONFIG_DEVELOPER, "CONFIG_DEVELOPER"); /* Pre 1.2 had an AI prefix */ SQAIInfo.DefSQConst(engine, SCRIPTCONFIG_NONE, "AICONFIG_NONE"); - SQAIInfo.DefSQConst(engine, SCRIPTCONFIG_RANDOM, "AICONFIG_RANDOM"); + SQAIInfo.DefSQConst(engine, SCRIPTCONFIG_NONE, "AICONFIG_RANDOM"); // Deprecated, mapped to NONE. SQAIInfo.DefSQConst(engine, SCRIPTCONFIG_BOOLEAN, "AICONFIG_BOOLEAN"); SQAIInfo.DefSQConst(engine, SCRIPTCONFIG_INGAME, "AICONFIG_INGAME"); diff --git a/src/game/game_info.cpp b/src/game/game_info.cpp index f6c9bd952c..ba5e0891ca 100644 --- a/src/game/game_info.cpp +++ b/src/game/game_info.cpp @@ -40,7 +40,7 @@ template <> const char *GetClassName() { return "GSInf SQGSInfo.DefSQAdvancedMethod(engine, &GameInfo::AddSetting, "AddSetting"); SQGSInfo.DefSQAdvancedMethod(engine, &GameInfo::AddLabels, "AddLabels"); SQGSInfo.DefSQConst(engine, SCRIPTCONFIG_NONE, "CONFIG_NONE"); - SQGSInfo.DefSQConst(engine, SCRIPTCONFIG_RANDOM, "CONFIG_RANDOM"); + SQGSInfo.DefSQConst(engine, SCRIPTCONFIG_NONE, "CONFIG_RANDOM"); // Deprecated, mapped to NONE. SQGSInfo.DefSQConst(engine, SCRIPTCONFIG_BOOLEAN, "CONFIG_BOOLEAN"); SQGSInfo.DefSQConst(engine, SCRIPTCONFIG_INGAME, "CONFIG_INGAME"); SQGSInfo.DefSQConst(engine, SCRIPTCONFIG_DEVELOPER, "CONFIG_DEVELOPER"); diff --git a/src/script/api/ai_changelog.hpp b/src/script/api/ai_changelog.hpp index 6af41d52a4..4bc5b5d18b 100644 --- a/src/script/api/ai_changelog.hpp +++ b/src/script/api/ai_changelog.hpp @@ -24,6 +24,7 @@ * * API removals: * \li AIError::ERR_PRECONDITION_TOO_MANY_PARAMETERS, that error is never returned anymore. + * \li AIInfo::CONFIG_RANDOM, no longer used. * * Other changes: * \li AIGroupList accepts an optional filter function diff --git a/src/script/api/game_changelog.hpp b/src/script/api/game_changelog.hpp index d3f4ac8d91..44d9ac0308 100644 --- a/src/script/api/game_changelog.hpp +++ b/src/script/api/game_changelog.hpp @@ -90,6 +90,7 @@ * * API removals: * \li GSError::ERR_PRECONDITION_TOO_MANY_PARAMETERS, that error is never returned anymore. + * \li AIInfo::CONFIG_RANDOM, no longer used. * * Other changes: * \li GSGroupList accepts an optional filter function diff --git a/src/script/api/script_info_docs.hpp b/src/script/api/script_info_docs.hpp index 902fc7357a..759bc8a336 100644 --- a/src/script/api/script_info_docs.hpp +++ b/src/script/api/script_info_docs.hpp @@ -203,7 +203,6 @@ public: /** Miscellaneous flags for Script settings. */ enum ScriptConfigFlags { CONFIG_NONE, ///< Normal setting. - CONFIG_RANDOM, ///< When randomizing the Script, pick any value between min_value and max_value (inclusive). CONFIG_BOOLEAN, ///< This value is a boolean (either 0 (false) or 1 (true) ). CONFIG_INGAME, ///< This setting can be changed while the Script is running. CONFIG_DEVELOPER, ///< This setting will only be visible when the Script development tools are active. diff --git a/src/script/script_config.cpp b/src/script/script_config.cpp index d86191b5f7..0814af63b0 100644 --- a/src/script/script_config.cpp +++ b/src/script/script_config.cpp @@ -34,14 +34,6 @@ void ScriptConfig::Change(std::optional name, int version, bo this->ClearConfigList(); if (_game_mode == GM_NORMAL && this->info != nullptr) { - /* If we're in an existing game and the Script is changed, set all settings - * for the Script that have the random flag to a random value. */ - for (const auto &item : *this->info->GetConfigList()) { - if (item.flags & SCRIPTCONFIG_RANDOM) { - this->SetSetting(item.name, ScriptObject::GetRandomizer(OWNER_NONE).Next(item.max_value + 1 - item.min_value) + item.min_value); - } - } - this->AddRandomDeviation(); } } diff --git a/src/script/script_config.hpp b/src/script/script_config.hpp index 684555e411..ad81f63068 100644 --- a/src/script/script_config.hpp +++ b/src/script/script_config.hpp @@ -20,7 +20,7 @@ static const int INT32_DIGITS_WITH_SIGN_AND_TERMINATION = 10 + 1 + 1; /** Bitmask of flags for Script settings. */ enum ScriptConfigFlags { SCRIPTCONFIG_NONE = 0x0, ///< No flags set. - SCRIPTCONFIG_RANDOM = 0x1, ///< When randomizing the Script, pick any value between min_value and max_value when on custom difficulty setting. + // Unused flag 0x1. SCRIPTCONFIG_BOOLEAN = 0x2, ///< This value is a boolean (either 0 (false) or 1 (true) ). SCRIPTCONFIG_INGAME = 0x4, ///< This setting can be changed while the Script is running. SCRIPTCONFIG_DEVELOPER = 0x8, ///< This setting will only be visible when the Script development tools are active. diff --git a/src/script/script_info.cpp b/src/script/script_info.cpp index 5eee02b5c5..47200ba501 100644 --- a/src/script/script_info.cpp +++ b/src/script/script_info.cpp @@ -162,12 +162,6 @@ SQInteger ScriptInfo::AddSetting(HSQUIRRELVM vm) } sq_pop(vm, 1); - /* Don't allow both random_deviation and SCRIPTCONFIG_RANDOM to - * be set for the same config item. */ - if ((items & 0x200) != 0 && (config.flags & SCRIPTCONFIG_RANDOM) != 0) { - this->engine->ThrowError("Setting both random_deviation and SCRIPTCONFIG_RANDOM is not allowed"); - return SQ_ERROR; - } /* Reset the bit for random_deviation as it's optional. */ items &= ~0x200;