MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / RegisterAPI

Method RegisterAPI

src/game/game_info.cpp:30–46  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

28template <> SQInteger PushClassName<GameInfo, ScriptType::GS>(HSQUIRRELVM vm) { sq_pushstring(vm, "GSInfo"); return 1; }
29
30/* static */ void GameInfo::RegisterAPI(Squirrel &engine)
31{
32 /* Create the GSInfo class, and add the RegisterGS function */
33 DefSQClass<GameInfo, ScriptType::GS> SQGSInfo("GSInfo");
34 SQGSInfo.PreRegister(engine);
35 SQGSInfo.AddConstructor<void (GameInfo::*)()>(engine, "x");
36 SQGSInfo.DefSQAdvancedMethod(engine, &GameInfo::AddSetting, "AddSetting");
37 SQGSInfo.DefSQAdvancedMethod(engine, &GameInfo::AddLabels, "AddLabels");
38 SQGSInfo.DefSQConst(engine, ScriptConfigFlags{}.base(), "CONFIG_NONE");
39 SQGSInfo.DefSQConst(engine, ScriptConfigFlags{}.base(), "CONFIG_RANDOM"); // Deprecated, mapped to NONE.
40 SQGSInfo.DefSQConst(engine, ScriptConfigFlags{ScriptConfigFlag::Boolean}.base(), "CONFIG_BOOLEAN");
41 SQGSInfo.DefSQConst(engine, ScriptConfigFlags{ScriptConfigFlag::InGame}.base(), "CONFIG_INGAME");
42 SQGSInfo.DefSQConst(engine, ScriptConfigFlags{ScriptConfigFlag::Developer}.base(), "CONFIG_DEVELOPER");
43
44 SQGSInfo.PostRegister(engine);
45 engine.AddMethod("RegisterGS", &GameInfo::Constructor, "tx");
46}
47
48/* static */ SQInteger GameInfo::Constructor(HSQUIRRELVM vm)
49{

Callers

nothing calls this directly

Calls 8

PreRegisterMethod · 0.80
DefSQAdvancedMethodMethod · 0.80
DefSQConstMethod · 0.80
PostRegisterMethod · 0.80
AddMethodMethod · 0.80
AddClassBeginMethod · 0.80
AddClassEndMethod · 0.80
baseMethod · 0.45

Tested by

no test coverage detected