| 101 | } |
| 102 | |
| 103 | void 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 | |
| 141 | DoorEntity* DoorEntity::getDoorEntityFromPacket(GameMap* gameMap, ODPacket& is) |
| 142 | { |
nothing calls this directly
no test coverage detected