| 190 | } |
| 191 | |
| 192 | void TrapFactory::checkBuildTrapDefaultEditor(GameMap* gameMap, TrapType type, const InputManager& inputManager, InputCommand& inputCommand) const |
| 193 | { |
| 194 | std::string txt = TrapManager::getTrapReadableName(type); |
| 195 | inputCommand.displayText(Ogre::ColourValue::White, txt); |
| 196 | if(inputManager.mCommandState == InputCommandState::infoOnly) |
| 197 | { |
| 198 | inputCommand.selectSquaredTiles(inputManager.mXPos, inputManager.mYPos, inputManager.mXPos, |
| 199 | inputManager.mYPos); |
| 200 | return; |
| 201 | } |
| 202 | |
| 203 | std::vector<Tile*> tiles = gameMap->rectangularRegion(inputManager.mXPos, |
| 204 | inputManager.mYPos, inputManager.mLStartDragX, inputManager.mLStartDragY); |
| 205 | |
| 206 | std::vector<Tile*> buildableTiles; |
| 207 | for(Tile* tile : tiles) |
| 208 | { |
| 209 | // We accept any tile if there is no building |
| 210 | if(tile->getIsBuilding()) |
| 211 | continue; |
| 212 | |
| 213 | buildableTiles.push_back(tile); |
| 214 | } |
| 215 | if(inputManager.mCommandState == InputCommandState::building) |
| 216 | { |
| 217 | inputCommand.selectTiles(buildableTiles); |
| 218 | return; |
| 219 | } |
| 220 | |
| 221 | ClientNotification *clientNotification = TrapManager::createTrapClientNotificationEditor(type); |
| 222 | uint32_t nbTiles = buildableTiles.size(); |
| 223 | int32_t seatId = inputManager.mSeatIdSelected; |
| 224 | clientNotification->mPacket << seatId; |
| 225 | clientNotification->mPacket << nbTiles; |
| 226 | for(Tile* tile : buildableTiles) |
| 227 | gameMap->tileToPacket(clientNotification->mPacket, tile); |
| 228 | |
| 229 | ODClient::getSingleton().queueClientNotification(clientNotification); |
| 230 | } |
| 231 | |
| 232 | bool TrapFactory::buildTrapDefaultEditor(GameMap* gameMap, Trap* trap, ODPacket& packet) const |
| 233 | { |
nothing calls this directly
no test coverage detected