mirror of
https://github.com/vcmi/vcmi.git
synced 2025-12-20 00:22:54 +02:00
int3 dist2d microoptimization
This commit is contained in:
@@ -5592,11 +5592,11 @@ bool CGameHandler::castSpell(const CGHeroInstance *h, SpellID spellID, const int
|
||||
|
||||
if (h->getSpellSchoolLevel(s) < 2)
|
||||
{
|
||||
double dist = town->pos.dist2d(h->pos);
|
||||
si32 dist = town->pos.dist2dSQ(h->pos);
|
||||
ObjectInstanceID nearest = town->id; //nearest town's ID
|
||||
for(const CGTownInstance * currTown : gs->getPlayer(h->tempOwner)->towns)
|
||||
{
|
||||
double curDist = currTown->pos.dist2d(h->pos);
|
||||
si32 curDist = currTown->pos.dist2dSQ(h->pos);
|
||||
if (nearest == ObjectInstanceID() || curDist < dist)
|
||||
{
|
||||
nearest = town->id;
|
||||
|
||||
Reference in New Issue
Block a user