MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / Update

Method Update

Source/Game/level.cpp:266–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266void Level::Update(bool paused) {
267 ASArglist args;
268 ASArglist args2;
269 args.Add(paused ? 1 : 0);
270 std::vector<HookedASContext>::iterator cit = as_contexts_.begin();
271 PROFILER_ENTER(g_profiler_ctx, "Level script Update()");
272 for (auto& as_context : as_contexts_) {
273 if (as_context.ctx->CallScriptFunction(as_context.as_funcs.update, &args) == false) {
274 if (paused == false) {
275 as_context.ctx->CallScriptFunction(as_context.as_funcs.update_deprecated, &args2);
276 }
277 }
278 }
279
280 Online* online = Online::Instance();
281 if (online->IsActive()) {
282 AngelScriptUpdate update;
283 if (online->GetIfPendingAngelScriptUpdates()) {
284 update = online->GetAngelScriptUpdate();
285
286 std::vector<char>& temp = update.data;
287
288 bool angelscriptCallSuccesfull = false;
289
290 for (auto& as_context : as_contexts_) {
291 if (as_context.ctx->CallMPCallBack(update.state, temp)) {
292 angelscriptCallSuccesfull = true;
293 }
294 }
295
296 if (angelscriptCallSuccesfull) {
297 online->MoveAngelScriptQueueForward();
298 }
299 }
300
301 if (online->GetIfPendingAngelScriptStates()) {
302 update = online->GetAngelScriptStates();
303 std::vector<char>& temp = update.data;
304
305 bool angelscriptCallSuccesfull = false;
306
307 for (auto& as_context : as_contexts_) {
308 if (as_context.ctx->CallMPCallBack(update.state, temp)) {
309 angelscriptCallSuccesfull = true;
310 }
311 }
312
313 if (angelscriptCallSuccesfull) {
314 online->MoveAngelStateQueueForward();
315 }
316 }
317 }
318
319 PROFILER_LEAVE(g_profiler_ctx);
320}
321
322void Level::LiveUpdateCheck() {
323 std::vector<HookedASContext>::iterator cit = as_contexts_.begin();

Callers

nothing calls this directly

Calls 11

GetAngelScriptUpdateMethod · 0.80
CallMPCallBackMethod · 0.80
GetAngelScriptStatesMethod · 0.80
AddMethod · 0.45
beginMethod · 0.45
CallScriptFunctionMethod · 0.45
IsActiveMethod · 0.45

Tested by

no test coverage detected