MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / update

Method update

game/state/gamestate.cpp:1014–1086  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1012}
1013
1014void GameState::update(unsigned int ticks)
1015{
1016 if (this->current_battle)
1017 {
1018 this->current_battle->update(*this, ticks);
1019 gameTime.addTicks(ticks);
1020 }
1021 else
1022 {
1023 // Roll back to time before battle and stuff
1024 if (gameTimeBeforeBattle.getTicks() != 0)
1025 {
1026 updateAfterBattle();
1027 }
1028
1029 current_city->update(*this, ticks);
1030
1031 for (auto &o : this->organisations)
1032 {
1033 o.second->updateMissions(*this);
1034 }
1035
1036 for (auto &v : this->vehicles)
1037 {
1038 if (v.second->city == current_city)
1039 {
1040 v.second->update(*this, ticks);
1041 }
1042 }
1043
1044 for (auto &a : this->agents)
1045 {
1046 if (a.second->city == current_city)
1047 {
1048 a.second->update(*this, ticks);
1049 }
1050 }
1051
1052 cleanUpDeathNote();
1053
1054 gameTime.addTicks(ticks);
1055
1056 if (gameTime.getTicks() > nextInvasion)
1057 {
1058 invasion();
1059 }
1060 if (gameTime.secondPassed())
1061 {
1062 this->updateEndOfSecond();
1063 }
1064 if (gameTime.fiveMinutesPassed())
1065 {
1066 this->updateEndOfFiveMinutes();
1067 }
1068 if (gameTime.hourPassed())
1069 {
1070 this->updateEndOfHour();
1071 }

Callers 2

updateTurboMethod · 0.95
updateAfterTurboMethod · 0.45

Calls 14

updateEndOfSecondMethod · 0.95
updateEndOfHourMethod · 0.95
updateEndOfDayMethod · 0.95
updateEndOfWeekMethod · 0.95
addTicksMethod · 0.80
getTicksMethod · 0.80
updateMissionsMethod · 0.80
secondPassedMethod · 0.80
fiveMinutesPassedMethod · 0.80
hourPassedMethod · 0.80
dayPassedMethod · 0.80

Tested by

no test coverage detected