fix: tower placement
This commit is contained in:
@@ -262,13 +262,13 @@ void World::cleanDeadMobs() {
|
||||
TowerPtr World::getTower(const glm::vec2& position) const {
|
||||
for (TowerPtr tower : m_Towers) {
|
||||
if (tower->getSize() == TowerSize::Big) {
|
||||
if (tower->getX() - 2 <= position.x && tower->getX() + 3 >= position.x &&
|
||||
tower->getY() - 2 <= position.y && tower->getY() + 3 >= position.y) {
|
||||
if (tower->getX() - 2 <= static_cast<std::int32_t>(position.x) && tower->getX() + 2 >= static_cast<std::int32_t>(position.x) &&
|
||||
tower->getY() - 2 <= static_cast<std::int32_t>(position.y) && tower->getY() + 2 >= static_cast<std::int32_t>(position.y)) {
|
||||
return tower;
|
||||
}
|
||||
} else {
|
||||
if (tower->getX() - 1 <= position.x && tower->getX() + 2 >= position.x &&
|
||||
tower->getY() - 1 <= position.y && tower->getY() + 2 >= position.y) {
|
||||
if (tower->getX() - 1 <= static_cast<std::int32_t>(position.x) && tower->getX() + 1 >= static_cast<std::int32_t>(position.x) &&
|
||||
tower->getY() - 1 <= static_cast<std::int32_t>(position.y) && tower->getY() + 1 >= static_cast<std::int32_t>(position.y)) {
|
||||
return tower;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user