Close #13359: Make GameAction flags optional in plugin API. (#13381)

This commit is contained in:
Sadret 2020-11-06 10:40:15 +01:00 committed by GitHub
parent 4a6db953f7
commit 4ff412dfe1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -1866,7 +1866,7 @@ declare global {
widgets?: Widget[];
colours?: number[];
tabs?: WindowTabDesc[];
tabIndex: number;
tabIndex?: number;
onClose?: () => void;
onUpdate?: () => void;

View File

@ -43,7 +43,7 @@
using namespace OpenRCT2;
using namespace OpenRCT2::Scripting;
static constexpr int32_t OPENRCT2_PLUGIN_API_VERSION = 10;
static constexpr int32_t OPENRCT2_PLUGIN_API_VERSION = 11;
struct ExpressionStringifier final
{
@ -1130,7 +1130,10 @@ std::unique_ptr<GameAction> ScriptEngine::CreateGameAction(const std::string& ac
DukValue argsCopy = args;
DukToGameActionParameterVisitor visitor(std::move(argsCopy));
action->AcceptParameters(visitor);
action->AcceptFlags(visitor);
if (args["flags"].type() == DukValue::Type::NUMBER)
{
action->AcceptFlags(visitor);
}
return action;
}
else