1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-31 18:39:10 +00:00

Fix: [Script] Prevent cloning of API instances

This commit is contained in:
glx22
2025-04-02 01:19:44 +02:00
parent 8d0ba5649a
commit eeeef870d8

View File

@@ -7,6 +7,8 @@
/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */
#include "../script_fatalerror.hpp"
${SQUIRREL_INCLUDES}
static SQInteger ${APIUC}ObjectConstructor(HSQUIRRELVM vm)
@@ -14,11 +16,17 @@ static SQInteger ${APIUC}ObjectConstructor(HSQUIRRELVM vm)
return sq_throwerror(vm, "${APIUC}Object is not instantiable");
}
static SQInteger ${APIUC}ObjectCloned(HSQUIRRELVM)
{
throw Script_FatalError("This instance is not cloneable");
}
void SQ${APIUC}_RegisterAll(Squirrel *engine)
{
DefSQClass<ScriptObject, ScriptType::${APIUC}> SQ${APIUC}Object("${APIUC}Object");
SQ${APIUC}Object.PreRegister(engine);
SQ${APIUC}Object.DefSQAdvancedStaticMethod(engine, &${APIUC}ObjectConstructor, "constructor");
SQ${APIUC}Object.DefSQAdvancedStaticMethod(engine, &${APIUC}ObjectCloned, "_cloned");
SQ${APIUC}Object.PostRegister(engine);
${SQUIRREL_REGISTER}