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

Method checkBuildRoomDefaultEditor

source/rooms/RoomManager.cpp:112–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112void 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
152bool RoomFactory::getRoomTilesDefault(std::vector<Tile*>& tiles, GameMap* gameMap, Player* player, ODPacket& packet) const
153{

Callers

nothing calls this directly

Calls 7

rectangularRegionMethod · 0.80
getIsBuildingMethod · 0.80
tileToPacketMethod · 0.80
displayTextMethod · 0.45
selectSquaredTilesMethod · 0.45
selectTilesMethod · 0.45

Tested by

no test coverage detected