diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 0c0b4b6b..486cf1c0 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -1131,8 +1131,9 @@ FowAlphaCellsLookupItem Unit::getFogOfWarRadius(bool useCache) const { void Unit::calculateFogOfWarRadius() { if(game->getWorld()->getFogOfWar() == true) { - if(Config::getInstance().getBool("EnableFowCache","true") == true && this->pos != this->lastPos) { + if(Config::getInstance().getBool("EnableFowCache","true") == true && this->pos != this->cachedFowPos) { cachedFow = getFogOfWarRadius(false); + this->cachedFowPos = this->pos; } } } diff --git a/source/glest_game/type_instances/unit.h b/source/glest_game/type_instances/unit.h index ef0e5ac4..140d89a2 100644 --- a/source/glest_game/type_instances/unit.h +++ b/source/glest_game/type_instances/unit.h @@ -457,6 +457,7 @@ private: int pathFindRefreshCellCount; FowAlphaCellsLookupItem cachedFow; + Vec2i cachedFowPos; public: Unit(int id, UnitPathInterface *path, const Vec2i &pos, const UnitType *type, Faction *faction, Map *map, CardinalDir placeFacing);