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

Method getTrapTilesDefault

source/traps/TrapManager.cpp:111–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111bool TrapFactory::getTrapTilesDefault(std::vector<Tile*>& tiles, GameMap* gameMap, Player* player, ODPacket& packet) const
112{
113 uint32_t nbTiles;
114 OD_ASSERT_TRUE(packet >> nbTiles);
115
116 while(nbTiles > 0)
117 {
118 --nbTiles;
119 Tile* tile = gameMap->tileFromPacket(packet);
120 if(tile == nullptr)
121 {
122 OD_LOG_ERR("unexpected null tile");
123 return false;
124 }
125
126 if(!tile->isBuildableUpon(player->getSeat()))
127 {
128 OD_LOG_ERR("tile=" + Tile::displayAsString(tile) + ", seatId=" + Helper::toString(player->getSeat()->getId()));
129 continue;
130 }
131
132 tiles.push_back(tile);
133 }
134
135 return true;
136}
137
138bool TrapFactory::buildTrapDefault(GameMap* gameMap, Trap* trap, Seat* seat, const std::vector<Tile*>& tiles) const
139{

Callers

nothing calls this directly

Calls 5

tileFromPacketMethod · 0.80
isBuildableUponMethod · 0.80
toStringFunction · 0.50
getSeatMethod · 0.45
getIdMethod · 0.45

Tested by

no test coverage detected