| 1012 | } |
| 1013 | |
| 1014 | void 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 | } |
no test coverage detected