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

Method slap

source/entities/DoorEntity.cpp:103–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103void DoorEntity::slap()
104{
105 if(!getIsOnServerMap())
106 return;
107
108 if(mBuilding == nullptr)
109 {
110 OD_LOG_ERR("name=" + getName());
111 return;
112 }
113
114 if(mBuilding->getObjectType() != GameEntityType::trap)
115 {
116 OD_LOG_ERR("name=" + getName() + ", type=" + Helper::toString(static_cast<uint32_t>(mBuilding->getObjectType())));
117 return;
118 }
119
120 Trap* trap = static_cast<Trap*>(mBuilding);
121 if(!trap->isDoor())
122 {
123 OD_LOG_ERR("name=" + getName() + ", wrong type=" + TrapManager::getTrapNameFromTrapType(trap->getType()));
124 return;
125 }
126
127 Tile* posTile = getPositionTile();
128 if(posTile == nullptr)
129 {
130 OD_LOG_ERR("name=" + getName());
131 return;
132 }
133
134 // We notify the trap that it should change the floodfill for owning seat. It should be
135 // handled in the trap because we want to remind if a door is open/closed when saving a game. And
136 // saving it in the trap is the easiest
137 TrapDoor* trapDoor = static_cast<TrapDoor*>(trap);
138 trapDoor->notifyDoorSlapped(this, posTile);
139}
140
141DoorEntity* DoorEntity::getDoorEntityFromPacket(GameMap* gameMap, ODPacket& is)
142{

Callers

nothing calls this directly

Calls 5

notifyDoorSlappedMethod · 0.80
toStringFunction · 0.50
getObjectTypeMethod · 0.45
isDoorMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected