refactor: move tower place detection to World.cpp

This commit is contained in:
2021-09-19 18:20:26 +02:00
parent 3bc58b12a6
commit 3771ea4a27
5 changed files with 54 additions and 51 deletions

View File

@@ -111,7 +111,7 @@ void WorldRenderer::changeZoom(float zoomStep) {
}
void WorldRenderer::click() {
if (m_Client->CanPlaceLittleTower(getClickWorldPos())) {
if (m_Client->getWorld().CanPlaceLittleTower(getClickWorldPos())) {
ImGui::OpenPopup("TowerPlace");
m_TowerPlacePopupOpened = true;
}
@@ -127,7 +127,7 @@ void WorldRenderer::renderPopups() const {
for (int i = 0; i < (int)game::TowerType::TowerCount; i++) {
game::TowerType towerType = game::TowerType(i);
const game::TowerInfo& towerInfo = game::getTowerInfo(towerType);
if (!towerInfo.isBigTower() || (towerInfo.isBigTower() && m_Client->CanPlaceBigTower(getClickWorldPos()))) {
if (!towerInfo.isBigTower() || (towerInfo.isBigTower() && m_Client->getWorld().CanPlaceBigTower(getClickWorldPos()))) {
if (ImGui::Button(game::getTowerInfo(towerType).getName().c_str())) {
m_Client->PlaceTower(towerType, getClickWorldPos());
ImGui::CloseCurrentPopup();