From f3ed589e354bb02fa222fb69969ceb6df32df00d Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Sat, 30 Sep 2023 22:01:39 +0300 Subject: [PATCH] Use same fow radius calculation as in H3 --- config/objects/rewardableGeneric.json | 2 +- lib/IGameCallback.cpp | 2 +- lib/int3.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/objects/rewardableGeneric.json b/config/objects/rewardableGeneric.json index 85a3f1270..5c48c25b4 100644 --- a/config/objects/rewardableGeneric.json +++ b/config/objects/rewardableGeneric.json @@ -49,7 +49,7 @@ }, "secondary" : { "@gainedSkill" : 1 - } + }, "message" : 171 // Witch teaches you skill } ], diff --git a/lib/IGameCallback.cpp b/lib/IGameCallback.cpp index 4efa55cab..503d1a8d7 100644 --- a/lib/IGameCallback.cpp +++ b/lib/IGameCallback.cpp @@ -97,7 +97,7 @@ void CPrivilegedInfoCallback::getTilesInRange(std::unordered_set & tiles, for (int yd = std::max(pos.y - radious, 0); yd <= std::min(pos.y + radious, gs->map->height - 1); yd++) { int3 tilePos(xd,yd,pos.z); - double distance = pos.dist(tilePos, distanceFormula); + int distance = pos.dist(tilePos, distanceFormula); if(distance <= radious) { diff --git a/lib/int3.h b/lib/int3.h index aa060703a..014c5c8fa 100644 --- a/lib/int3.h +++ b/lib/int3.h @@ -110,7 +110,7 @@ public: switch(formula) { case DIST_2D: - return static_cast(dist2d(o)); + return std::round(dist2d(o)); case DIST_MANHATTAN: return static_cast(mandist2d(o)); case DIST_CHEBYSHEV: