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

Method Stop

Sources/Termina/World/WorldSystem.cpp:108–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106 }
107
108 void WorldSystem::Stop()
109 {
110 if (!m_CurrentWorld || !m_IsPlaying)
111 return;
112 m_CurrentWorld->OnStop();
113 m_IsPlaying = false;
114
115 // Restore the world to its pre-play state.
116 if (!m_PlaySnapshot.empty() && std::filesystem::exists(m_PlaySnapshot))
117 {
118 // Destroy the play world BEFORE loading the snapshot so that
119 // Actor::~Actor() releases IDs before LoadFromFile calls IDGenerator::Clear().
120 m_CurrentWorld->OnShutdown();
121 m_CurrentWorld.reset();
122
123 auto restored = std::make_unique<World>();
124 restored->LoadFromFile(m_PlaySnapshot);
125 restored->SetCurrentPath(m_PrePlayPath);
126 m_CurrentWorld = std::move(restored);
127 // LoadFromFile already ran OnInit (Pass 3) — no second call needed.
128 std::filesystem::remove(m_PlaySnapshot);
129 m_PlaySnapshot.clear();
130 }
131 }
132
133 void WorldSystem::RequestSceneTransition(const std::string& path)
134 {

Callers 1

OnImGuiRenderMethod · 0.45

Calls 7

resetMethod · 0.80
LoadFromFileMethod · 0.80
SetCurrentPathMethod · 0.80
OnStopMethod · 0.45
emptyMethod · 0.45
OnShutdownMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected