| 229 | } |
| 230 | |
| 231 | void GameTime::addTicks(uint64_t ticks) |
| 232 | { |
| 233 | this->ticks += ticks; |
| 234 | uint64_t secondTicks = this->ticks % (TICKS_PER_SECOND); |
| 235 | uint64_t fiveMinutesTicks = this->ticks % (5 * TICKS_PER_MINUTE); |
| 236 | if (fiveMinutesTicks < ticks) |
| 237 | { |
| 238 | secondPassedFlag = true; |
| 239 | fiveMinutesPassedFlag = true; |
| 240 | uint64_t hourTicks = this->ticks % TICKS_PER_HOUR; |
| 241 | if (hourTicks < ticks) |
| 242 | { |
| 243 | hourPassedFlag = true; |
| 244 | uint64_t dayTicks = this->ticks % TICKS_PER_DAY; |
| 245 | if (dayTicks < ticks) |
| 246 | { |
| 247 | uint64_t days = this->ticks / TICKS_PER_DAY; |
| 248 | dayPassedFlag = true; |
| 249 | // game starts on Tuesday, so week rolls on day 6 |
| 250 | if (days % 7 == 6) |
| 251 | { |
| 252 | weekPassedFlag = true; |
| 253 | } |
| 254 | } |
| 255 | } |
| 256 | } |
| 257 | else |
| 258 | { |
| 259 | if (secondTicks < ticks) |
| 260 | { |
| 261 | secondPassedFlag = true; |
| 262 | } |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | GameTime GameTime::midday() { return GameTime(TICKS_PER_HOUR * 12); } |
| 267 | } // namespace OpenApoc |
no outgoing calls
no test coverage detected