fix: check team when placing tower

This commit is contained in:
2021-09-19 19:30:49 +02:00
parent 10a1fac992
commit 94e1ef6606
4 changed files with 17 additions and 9 deletions

View File

@@ -110,7 +110,7 @@ void WorldRenderer::changeZoom(float zoomStep) {
}
void WorldRenderer::click() {
if (m_Client->getWorld().CanPlaceLittleTower(getClickWorldPos())) {
if (m_Client->getWorld().CanPlaceLittleTower(getClickWorldPos(), m_Client->getPlayer()->getID())) {
ImGui::OpenPopup("TowerPlace");
m_TowerPlacePopupOpened = true;
}
@@ -126,7 +126,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->getWorld().CanPlaceBigTower(getClickWorldPos()))) {
if (!towerInfo.isBigTower() || (towerInfo.isBigTower() && m_Client->getWorld().CanPlaceBigTower(getClickWorldPos(), m_Client->getPlayer()->getID()))) {
if (ImGui::Button(game::getTowerInfo(towerType).getName().c_str())) {
m_Client->PlaceTower(towerType, getClickWorldPos());
ImGui::CloseCurrentPopup();