From b14167d20927a3115d1478f2040bbff4e7f0e8f8 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Fri, 4 Jan 2013 20:35:38 +0000 Subject: [PATCH] - small fix for fog of war cache --- source/glest_game/type_instances/unit.cpp | 3 ++- source/glest_game/type_instances/unit.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 0c0b4b6bf..486cf1c09 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 ef0e5ac4d..140d89a27 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);