MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / Resume

Method Resume

src/script/squirrel.cpp:341–361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

339}
340
341bool Squirrel::Resume(int suspend)
342{
343 assert(!this->crashed);
344 ScriptAllocatorScope alloc_scope(this);
345
346 /* Did we use more operations than we should have in the
347 * previous tick? If so, subtract that from the current run. */
348 if (this->overdrawn_ops > 0 && suspend > 0) {
349 this->overdrawn_ops -= suspend;
350 /* Do we need to wait even more? */
351 if (this->overdrawn_ops >= 0) return true;
352
353 /* We can now only run whatever is "left". */
354 suspend = -this->overdrawn_ops;
355 }
356
357 this->crashed = !sq_resumecatch(this->vm, suspend);
358 this->overdrawn_ops = -this->vm->_ops_till_suspend;
359 this->allocator->CheckLimit();
360 return this->vm->_suspended != 0;
361}
362
363void Squirrel::ResumeError()
364{

Callers 1

GameLoopMethod · 0.45

Calls 2

sq_resumecatchFunction · 0.85
CheckLimitMethod · 0.80

Tested by

no test coverage detected