| 110 | } |
| 111 | |
| 112 | void RoomFactory::checkBuildRoomDefaultEditor(GameMap* gameMap, RoomType type, const InputManager& inputManager, InputCommand& inputCommand) const |
| 113 | { |
| 114 | std::string txt = RoomManager::getRoomReadableName(type); |
| 115 | inputCommand.displayText(Ogre::ColourValue::White, txt); |
| 116 | if(inputManager.mCommandState == InputCommandState::infoOnly) |
| 117 | { |
| 118 | inputCommand.selectSquaredTiles(inputManager.mXPos, inputManager.mYPos, inputManager.mXPos, |
| 119 | inputManager.mYPos); |
| 120 | return; |
| 121 | } |
| 122 | |
| 123 | std::vector<Tile*> tiles = gameMap->rectangularRegion(inputManager.mXPos, |
| 124 | inputManager.mYPos, inputManager.mLStartDragX, inputManager.mLStartDragY); |
| 125 | |
| 126 | std::vector<Tile*> buildableTiles; |
| 127 | for(Tile* tile : tiles) |
| 128 | { |
| 129 | // We accept any tile if there is no building |
| 130 | if(tile->getIsBuilding()) |
| 131 | continue; |
| 132 | |
| 133 | buildableTiles.push_back(tile); |
| 134 | } |
| 135 | if(inputManager.mCommandState == InputCommandState::building) |
| 136 | { |
| 137 | inputCommand.selectTiles(buildableTiles); |
| 138 | return; |
| 139 | } |
| 140 | |
| 141 | ClientNotification *clientNotification = RoomManager::createRoomClientNotificationEditor(type); |
| 142 | uint32_t nbTiles = buildableTiles.size(); |
| 143 | int32_t seatId = inputManager.mSeatIdSelected; |
| 144 | clientNotification->mPacket << seatId; |
| 145 | clientNotification->mPacket << nbTiles; |
| 146 | for(Tile* tile : buildableTiles) |
| 147 | gameMap->tileToPacket(clientNotification->mPacket, tile); |
| 148 | |
| 149 | ODClient::getSingleton().queueClientNotification(clientNotification); |
| 150 | } |
| 151 | |
| 152 | bool RoomFactory::getRoomTilesDefault(std::vector<Tile*>& tiles, GameMap* gameMap, Player* player, ODPacket& packet) const |
| 153 | { |
nothing calls this directly
no test coverage detected