| 379 | } |
| 380 | |
| 381 | void RoomPrison::notifyCarryingStateChanged(Creature* carrier, GameEntity* carriedEntity) |
| 382 | { |
| 383 | // The carrier has brought the enemy creature |
| 384 | if(carriedEntity->getObjectType() != GameEntityType::creature) |
| 385 | { |
| 386 | OD_LOG_ERR("room=" + getName() + ", entity=" + carriedEntity->getName()); |
| 387 | return; |
| 388 | } |
| 389 | |
| 390 | Creature* prisonerCreature = static_cast<Creature*>(carriedEntity); |
| 391 | |
| 392 | // We check if we were waiting for this creature |
| 393 | // We release the pending prisoners before pushing the action room to make sure |
| 394 | // the place is free when we add the creature |
| 395 | auto it = std::find(mPendingPrisoners.begin(), mPendingPrisoners.end(), prisonerCreature); |
| 396 | if(it == mPendingPrisoners.end()) |
| 397 | { |
| 398 | OD_LOG_ERR("room=" + getName() + ", unexpected creature=" + prisonerCreature->getName()); |
| 399 | return; |
| 400 | } |
| 401 | |
| 402 | mPendingPrisoners.erase(it); |
| 403 | |
| 404 | prisonerCreature->clearActionQueue(); |
| 405 | prisonerCreature->pushAction(Utils::make_unique<CreatureActionUseRoom>(*prisonerCreature, *this, true)); |
| 406 | prisonerCreature->resetKoTurns(); |
| 407 | } |
| 408 | |
| 409 | uint32_t RoomPrison::countPrisoners() |
| 410 | { |
nothing calls this directly
no test coverage detected