MCPcopy Create free account
hub / github.com/AmelieHeinrich/Termina / LoadWorld

Method LoadWorld

Sources/Termina/World/WorldSystem.cpp:50–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48 }
49
50 bool WorldSystem::LoadWorld(const std::string& path)
51 {
52 // Destroy the old world first so its actors release their IDs before
53 // LoadFromFile calls IDGenerator::Clear().
54 if (m_CurrentWorld)
55 {
56 if (m_IsPlaying)
57 {
58 m_CurrentWorld->OnStop();
59 m_IsPlaying = false;
60 }
61 m_CurrentWorld->OnShutdown();
62 m_CurrentWorld.reset();
63 }
64
65 auto candidate = std::make_unique<World>();
66 try
67 {
68 candidate->LoadFromFile(path);
69 }
70 catch (const std::exception&)
71 {
72 return false;
73 }
74
75 m_CurrentWorld = std::move(candidate);
76 return true;
77 }
78
79 bool WorldSystem::SaveWorld(const std::string& path)
80 {

Callers 2

RuntimeApplicationMethod · 0.80
OpenWorldMethod · 0.80

Calls 4

resetMethod · 0.80
LoadFromFileMethod · 0.80
OnStopMethod · 0.45
OnShutdownMethod · 0.45

Tested by

no test coverage detected