MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / notifyCarryingStateChanged

Method notifyCarryingStateChanged

source/rooms/RoomDormitory.cpp:546–567  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

544}
545
546void RoomDormitory::notifyCarryingStateChanged(Creature* carrier, GameEntity* carriedEntity)
547{
548 if(carriedEntity->getObjectType() != GameEntityType::creature)
549 {
550 OD_LOG_ERR("room=" + getName() + ", entity=" + carriedEntity->getName());
551 return;
552 }
553
554 Creature* creature = static_cast<Creature*>(carriedEntity);
555 Tile* posTile = creature->getPositionTile();
556 if(posTile == nullptr)
557 {
558 OD_LOG_ERR("creature=" + creature->getName() + ", position=" + Helper::toString(creature->getPosition()));
559 return;
560 }
561
562 if(posTile != creature->getHomeTile())
563 return;
564
565 creature->resetKoTurns();
566 creature->sleep();
567}
568
569void RoomDormitory::creatureDropped(Creature& creature)
570{

Callers

nothing calls this directly

Calls 6

getPositionTileMethod · 0.80
getHomeTileMethod · 0.80
resetKoTurnsMethod · 0.80
sleepMethod · 0.80
toStringFunction · 0.50
getObjectTypeMethod · 0.45

Tested by

no test coverage detected