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

Method ScriptAsyncMode

src/script/api/script_asyncmode.cpp:30–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30ScriptAsyncMode::ScriptAsyncMode(HSQUIRRELVM vm)
31{
32 int nparam = sq_gettop(vm) - 1;
33 if (nparam < 1) {
34 throw sq_throwerror(vm, "You need to pass a boolean to the constructor");
35 }
36
37 SQBool sqasync;
38 if (SQ_FAILED(sq_getbool(vm, 2, &sqasync))) {
39 throw sq_throwerror(vm, "Argument must be a boolean");
40 }
41
42 this->last_mode = this->GetDoCommandAsyncMode();
43 this->last_instance = this->GetDoCommandAsyncModeInstance();
44
45 this->SetDoCommandAsyncMode(sqasync ? &ScriptAsyncMode::AsyncModeProc : &ScriptAsyncMode::NonAsyncModeProc, this);
46}
47
48void ScriptAsyncMode::FinalRelease()
49{

Callers

nothing calls this directly

Calls 6

sq_gettopFunction · 0.85
sq_throwerrorFunction · 0.85
sq_getboolFunction · 0.85
GetDoCommandAsyncModeMethod · 0.80
SetDoCommandAsyncModeMethod · 0.80

Tested by

no test coverage detected