* Runs the game timer and handles popups. */
| 537 | * Runs the game timer and handles popups. |
| 538 | */ |
| 539 | void GeoscapeState::think() |
| 540 | { |
| 541 | State::think(); |
| 542 | |
| 543 | _zoomInEffectTimer->think(this, 0); |
| 544 | _zoomOutEffectTimer->think(this, 0); |
| 545 | _dogfightStartTimer->think(this, 0); |
| 546 | |
| 547 | if (_game->getSavedGame()->getMonthsPassed() == -1) |
| 548 | { |
| 549 | _game->getSavedGame()->addMonth(); |
| 550 | determineAlienMissions(true); |
| 551 | setupTerrorMission(); |
| 552 | _game->getSavedGame()->setFunds(_game->getSavedGame()->getFunds() - (_game->getSavedGame()->getBaseMaintenance() - _game->getSavedGame()->getBases()->front()->getPersonnelMaintenance())); |
| 553 | } |
| 554 | if (_popups.empty() && _dogfights.empty() && (!_zoomInEffectTimer->isRunning() || _zoomInEffectDone) && (!_zoomOutEffectTimer->isRunning() || _zoomOutEffectDone)) |
| 555 | { |
| 556 | // Handle timers |
| 557 | _gameTimer->think(this, 0); |
| 558 | } |
| 559 | else |
| 560 | { |
| 561 | if (!_dogfights.empty() || _minimizedDogfights != 0) |
| 562 | { |
| 563 | handleDogfights(); |
| 564 | } |
| 565 | if (!_popups.empty()) |
| 566 | { |
| 567 | // Handle popups |
| 568 | _globe->rotateStop(); |
| 569 | _game->pushState(_popups.front()); |
| 570 | _popups.erase(_popups.begin()); |
| 571 | } |
| 572 | } |
| 573 | } |
| 574 | |
| 575 | /** |
| 576 | * Updates the Geoscape clock with the latest |
no test coverage detected