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

Method handleDogfights

src/Geoscape/GeoscapeState.cpp:2011–2051  ·  view source on GitHub ↗

* Dogfight logic. Moved here to have the code clean. */

Source from the content-addressed store, hash-verified

2009 * Dogfight logic. Moved here to have the code clean.
2010 */
2011void GeoscapeState::handleDogfights()
2012{
2013 // If all dogfights are minimized rotate the globe, etc.
2014 if (_dogfights.size() == _minimizedDogfights)
2015 {
2016 _pause = false;
2017 _gameTimer->think(this, 0);
2018 }
2019 // Handle dogfights logic.
2020 _minimizedDogfights = 0;
2021 std::list<DogfightState*>::iterator d = _dogfights.begin();
2022 while(d != _dogfights.end())
2023 {
2024 if ((*d)->isMinimized())
2025 {
2026 _minimizedDogfights++;
2027 }
2028 else
2029 {
2030 _globe->rotateStop();
2031 }
2032 (*d)->think();
2033 if ((*d)->dogfightEnded())
2034 {
2035 if ((*d)->isMinimized())
2036 {
2037 _minimizedDogfights--;
2038 }
2039 delete *d;
2040 d = _dogfights.erase(d);
2041 }
2042 else
2043 {
2044 ++d;
2045 }
2046 }
2047 if (_dogfights.empty())
2048 {
2049 _zoomOutEffectTimer->start();
2050 }
2051}
2052
2053/**
2054 * Gets the number of minimized dogfights.

Callers

nothing calls this directly

Calls 6

isMinimizedMethod · 0.80
rotateStopMethod · 0.80
dogfightEndedMethod · 0.80
thinkMethod · 0.45
emptyMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected