MCPcopy Create free account
hub / github.com/OpenMW/openmw / load

Method load

apps/openmw/mwlua/luaevents.cpp:72–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70 }
71
72 void LuaEvents::load(lua_State* lua, ESM::ESMReader& esm, const std::map<int, int>& contentFileMapping,
73 const LuaUtil::UserdataSerializer* serializer)
74 {
75 clear();
76 while (esm.isNextSub("LUAE"))
77 {
78 std::string name = esm.getHString();
79 ESM::RefNum dest = esm.getFormId(true);
80 std::string data = loadLuaBinaryData(esm);
81 try
82 {
83 data = LuaUtil::serialize(LuaUtil::deserialize(lua, data, serializer), serializer);
84 }
85 catch (std::exception& e)
86 {
87 Log(Debug::Error) << "loadEvent: invalid event data: " << e.what();
88 }
89 if (dest.isSet())
90 {
91 auto it = contentFileMapping.find(dest.mContentFile);
92 if (it != contentFileMapping.end())
93 dest.mContentFile = it->second;
94 mLocalEventBatch.push_back({ dest, std::move(name), std::move(data) });
95 }
96 else
97 mGlobalEventBatch.push_back({ std::move(name), std::move(data) });
98 }
99 }
100
101 void LuaEvents::save(ESM::ESMWriter& esm) const
102 {

Callers 5

loadPermanentStorageMethod · 0.45
readRecordMethod · 0.45
loadLocalScriptsMethod · 0.45
reloadAllScriptsImplMethod · 0.45
initCellBindingsFunction · 0.45

Calls 11

clearFunction · 0.85
LogClass · 0.85
isNextSubMethod · 0.80
getHStringMethod · 0.80
isSetMethod · 0.80
serializeFunction · 0.50
deserializeFunction · 0.50
getFormIdMethod · 0.45
whatMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected