| 217 | } |
| 218 | |
| 219 | bool RoomTorture::addCreatureUsingRoom(Creature* creature) |
| 220 | { |
| 221 | RoomTortureCreatureInfo* infoToUse = nullptr; |
| 222 | for(std::pair<Tile* const,RoomTortureCreatureInfo>& p : mCreaturesSpots) |
| 223 | { |
| 224 | if(p.second.mCreature != nullptr) |
| 225 | continue; |
| 226 | |
| 227 | infoToUse = &p.second; |
| 228 | break; |
| 229 | } |
| 230 | |
| 231 | if(infoToUse == nullptr) |
| 232 | { |
| 233 | OD_LOG_ERR("room=" + getName() + ", creature=" + creature->getName()); |
| 234 | return false; |
| 235 | } |
| 236 | |
| 237 | if(!Room::addCreatureUsingRoom(creature)) |
| 238 | return false; |
| 239 | |
| 240 | creature->setInJail(this); |
| 241 | |
| 242 | infoToUse->mCreature = creature; |
| 243 | infoToUse->mIsReady = false; |
| 244 | infoToUse->mState = 0; |
| 245 | return true; |
| 246 | } |
| 247 | |
| 248 | void RoomTorture::removeCreatureUsingRoom(Creature* creature) |
| 249 | { |