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

Method PreUpdate

Sources/Termina/World/WorldSystem.cpp:144–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142 // ---------------------------------------------------------------------------
143
144 void WorldSystem::PreUpdate(float deltaTime)
145 {
146 // Apply any deferred scene transition requested by scripts last frame.
147 if (!m_PendingScene.empty())
148 {
149 std::string path = std::move(m_PendingScene);
150 m_PendingScene.clear();
151
152 // Destroy the current world first so actors release IDs before
153 // LoadFromFile calls IDGenerator::Clear().
154 if (m_CurrentWorld)
155 {
156 m_CurrentWorld->OnStop();
157 m_CurrentWorld->OnShutdown();
158 m_CurrentWorld.reset();
159 }
160 m_IsPlaying = false;
161
162 auto candidate = std::make_unique<World>();
163 bool loaded = false;
164 try
165 {
166 candidate->LoadFromFile(path);
167 loaded = true;
168 }
169 catch (const std::exception&) {}
170
171 if (loaded)
172 {
173 m_CurrentWorld = std::move(candidate);
174 // LoadFromFile already ran OnInit (Pass 3) — no second call needed.
175 m_IsPlaying = true;
176 m_CurrentWorld->OnPlay();
177 }
178 }
179
180 if (m_CurrentWorld)
181 m_CurrentWorld->OnPreUpdate(deltaTime);
182 }
183
184 void WorldSystem::Update(float deltaTime)
185 {

Callers

nothing calls this directly

Calls 8

resetMethod · 0.80
LoadFromFileMethod · 0.80
emptyMethod · 0.45
clearMethod · 0.45
OnStopMethod · 0.45
OnShutdownMethod · 0.45
OnPlayMethod · 0.45
OnPreUpdateMethod · 0.45

Tested by

no test coverage detected