Change: Remove the limit of 20 parameters to a Script Text string. (#14193)

This commit is contained in:
Peter Nelson
2025-05-03 18:33:29 +01:00
committed by GitHub
parent 518a34c286
commit bd1a3fe0b7
5 changed files with 59 additions and 25 deletions

View File

@@ -75,8 +75,6 @@ private:
*/
class ScriptText : public Text {
public:
static const int SCRIPT_TEXT_MAX_PARAMETERS = 20; ///< The maximum amount of parameters you can give to one object.
#ifndef DOXYGEN_API
/**
* The constructor wrapper from Squirrel.
@@ -128,10 +126,15 @@ public:
*/
EncodedString GetEncodedText() override;
/**
* @api -all
*/
static void SetPadParameterCount(HSQUIRRELVM vm);
private:
using ScriptTextRef = ScriptObjectRef<ScriptText>;
using ScriptTextList = std::vector<ScriptText *>;
using Param = std::variant<SQInteger, std::string, ScriptTextRef>;
using Param = std::variant<std::monostate, SQInteger, std::string, ScriptTextRef>;
struct ParamCheck {
StringIndexInTab owner;
@@ -149,8 +152,9 @@ private:
using ParamSpan = std::span<ParamCheck>;
StringIndexInTab string;
std::array<Param, SCRIPT_TEXT_MAX_PARAMETERS> param = {};
int paramc = 0;
std::vector<Param> param{};
static inline int pad_parameter_count = 0; ///< Pad parameters for relaxed string validation.
/**
* Internal function to recursively fill a list of parameters.