| 627 | } |
| 628 | |
| 629 | void TrapManager::checkSellTrapTilesEditor(GameMap* gameMap, const InputManager& inputManager, InputCommand& inputCommand) |
| 630 | { |
| 631 | if(inputManager.mCommandState == InputCommandState::infoOnly) |
| 632 | { |
| 633 | inputCommand.displayText(Ogre::ColourValue::White, "Remove tiles"); |
| 634 | inputCommand.selectSquaredTiles(inputManager.mXPos, inputManager.mYPos, inputManager.mXPos, inputManager.mYPos); |
| 635 | return; |
| 636 | } |
| 637 | |
| 638 | std::vector<Tile*> sellTiles; |
| 639 | std::vector<Tile*> tiles = gameMap->rectangularRegion(inputManager.mXPos, |
| 640 | inputManager.mYPos, inputManager.mLStartDragX, inputManager.mLStartDragY); |
| 641 | for(Tile* tile : tiles) |
| 642 | { |
| 643 | if(!tile->getIsTrap()) |
| 644 | continue; |
| 645 | |
| 646 | sellTiles.push_back(tile); |
| 647 | } |
| 648 | |
| 649 | if(inputManager.mCommandState == InputCommandState::building) |
| 650 | { |
| 651 | inputCommand.selectTiles(sellTiles); |
| 652 | inputCommand.displayText(Ogre::ColourValue::White, "Remove tiles"); |
| 653 | return; |
| 654 | } |
| 655 | |
| 656 | inputCommand.unselectAllTiles(); |
| 657 | |
| 658 | ClientNotification *clientNotification = new ClientNotification( |
| 659 | ClientNotificationType::editorAskDestroyTrapTiles); |
| 660 | uint32_t nbTiles = sellTiles.size(); |
| 661 | clientNotification->mPacket << nbTiles; |
| 662 | for(Tile* tile : sellTiles) |
| 663 | gameMap->tileToPacket(clientNotification->mPacket, tile); |
| 664 | |
| 665 | ODClient::getSingleton().queueClientNotification(clientNotification); |
| 666 | } |
| 667 | |
| 668 | void TrapManager::sellTrapTilesEditor(GameMap* gameMap, ODPacket& packet) |
| 669 | { |
nothing calls this directly
no test coverage detected