| 419 | } |
| 420 | |
| 421 | void RoomPortalWave::handleSpawnWave() |
| 422 | { |
| 423 | // We start by checking that the spawnable wave list is up to date |
| 424 | int64_t curTurn = getGameMap()->getTurnNumber(); |
| 425 | for(auto it = mRoomPortalWaveDataSpawnable.begin(); it != mRoomPortalWaveDataSpawnable.end();) |
| 426 | { |
| 427 | RoomPortalWaveData* roomPortalWaveData = *it; |
| 428 | if(roomPortalWaveData->mSpawnTurnMin > curTurn) |
| 429 | { |
| 430 | // Cannot spawn the wave anymore |
| 431 | it = mRoomPortalWaveDataSpawnable.erase(it); |
| 432 | mRoomPortalWaveDataNotSpawnable.push_back(roomPortalWaveData); |
| 433 | continue; |
| 434 | } |
| 435 | |
| 436 | if((roomPortalWaveData->mSpawnTurnMax != -1) && |
| 437 | (roomPortalWaveData->mSpawnTurnMax < curTurn)) |
| 438 | { |
| 439 | it = mRoomPortalWaveDataSpawnable.erase(it); |
| 440 | mRoomPortalWaveDataNotSpawnable.push_back(roomPortalWaveData); |
| 441 | continue; |
| 442 | } |
| 443 | |
| 444 | ++it; |
| 445 | } |
| 446 | |
| 447 | // Now we check in the not spawnable list if a wave is available |
| 448 | for(auto it = mRoomPortalWaveDataNotSpawnable.begin(); it != mRoomPortalWaveDataNotSpawnable.end();) |
| 449 | { |
| 450 | RoomPortalWaveData* roomPortalWaveData = *it; |
| 451 | if(roomPortalWaveData->mSpawnTurnMin > curTurn) |
| 452 | { |
| 453 | ++it; |
| 454 | continue; |
| 455 | } |
| 456 | |
| 457 | if((roomPortalWaveData->mSpawnTurnMax != -1) && |
| 458 | (roomPortalWaveData->mSpawnTurnMax < curTurn)) |
| 459 | { |
| 460 | ++it; |
| 461 | continue; |
| 462 | } |
| 463 | |
| 464 | // The wave is spawnable |
| 465 | it = mRoomPortalWaveDataNotSpawnable.erase(it); |
| 466 | mRoomPortalWaveDataSpawnable.push_back(roomPortalWaveData); |
| 467 | } |
| 468 | |
| 469 | if(mRoomPortalWaveDataSpawnable.empty()) |
| 470 | return; |
| 471 | |
| 472 | // Portal waves is not concerned about creature limit per seat. Only by the absolute limit |
| 473 | uint32_t maxCreatures = ConfigManager::getSingleton().getMaxCreaturesPerSeatAbsolute(); |
| 474 | uint32_t numCreatures = getSeat()->getNumCreaturesFighters(); |
| 475 | |
| 476 | if(numCreatures >= maxCreatures) |
| 477 | return; |
| 478 |
nothing calls this directly
no test coverage detected