MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / timeAdvance

Method timeAdvance

src/Geoscape/GeoscapeState.cpp:621–674  ·  view source on GitHub ↗

* Advances the game timer according to * the timer speed set, and calls the respective * triggers. The timer always advances in "5 secs" * cycles, regardless of the speed, otherwise it might * skip important steps. Instead, it just keeps advancing * the timer until the next speed step (eg. the next day * on 1 Day speed) or until an event occurs, since updating * the screen on each step woul

Source from the content-addressed store, hash-verified

619 * the screen on each step would become cumbersomely slow.
620 */
621void GeoscapeState::timeAdvance()
622{
623 int timeSpan = 0;
624 if (_timeSpeed == _btn5Secs)
625 {
626 timeSpan = 1;
627 }
628 else if (_timeSpeed == _btn1Min)
629 {
630 timeSpan = 12;
631 }
632 else if (_timeSpeed == _btn5Mins)
633 {
634 timeSpan = 12 * 5;
635 }
636 else if (_timeSpeed == _btn30Mins)
637 {
638 timeSpan = 12 * 5 * 6;
639 }
640 else if (_timeSpeed == _btn1Hour)
641 {
642 timeSpan = 12 * 5 * 6 * 2;
643 }
644 else if (_timeSpeed == _btn1Day)
645 {
646 timeSpan = 12 * 5 * 6 * 2 * 24;
647 }
648
649 for (int i = 0; i < timeSpan && !_pause; ++i)
650 {
651 TimeTrigger trigger;
652 trigger = _game->getSavedGame()->getTime()->advance();
653 switch (trigger)
654 {
655 case TIME_1MONTH:
656 time1Month();
657 case TIME_1DAY:
658 time1Day();
659 case TIME_1HOUR:
660 time1Hour();
661 case TIME_30MIN:
662 time30Minutes();
663 case TIME_10MIN:
664 time10Minutes();
665 case TIME_5SEC:
666 time5Seconds();
667 }
668 }
669
670 _pause = !_dogfightsToBeStarted.empty();
671
672 timeDisplay();
673 _globe->draw();
674}
675
676/**
677 * Takes care of any game logic that has to

Callers

nothing calls this directly

Calls 5

getSavedGameMethod · 0.80
advanceMethod · 0.45
getTimeMethod · 0.45
emptyMethod · 0.45
drawMethod · 0.45

Tested by

no test coverage detected