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

Method LoadOnStack

src/script/script_instance.cpp:749–769  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

747}
748
749void ScriptInstance::LoadOnStack(ScriptData *data)
750{
751 ScriptObject::ActiveInstance active(*this);
752
753 if (this->IsDead() || data == nullptr) return;
754
755 HSQUIRRELVM vm = this->engine->GetVM();
756
757 ScriptDataVariant version = data->front();
758 data->pop_front();
759 SQInteger top = sq_gettop(vm);
760 try {
761 sq_pushinteger(vm, std::get<SQInteger>(version));
762 LoadObjects(vm, data);
763 this->is_save_data_on_stack = true;
764 } catch (Script_FatalError &e) {
765 ScriptLog::Warning(fmt::format("Loading failed: {}", e.GetErrorMessage()));
766 /* Discard partially loaded savegame data and version. */
767 sq_settop(vm, top);
768 }
769}
770
771bool ScriptInstance::CallLoad()
772{

Callers 2

StartNewMethod · 0.80
StartNewMethod · 0.80

Calls 7

IsDeadMethod · 0.95
sq_gettopFunction · 0.85
sq_pushintegerFunction · 0.85
sq_settopFunction · 0.85
GetVMMethod · 0.80
GetErrorMessageMethod · 0.80
formatFunction · 0.50

Tested by

no test coverage detected