Browse Source

CPathfinder: bring FoW reference back to avoid performance loss

This one is revert 148355908d968e4e87375a3b727fc8c3a03d8451
ArseniyShestakov 10 years ago
parent
commit
2632389aaf
2 changed files with 3 additions and 2 deletions
  1. 2 2
      lib/CPathfinder.cpp
  2. 1 0
      lib/CPathfinder.h

+ 2 - 2
lib/CPathfinder.cpp

@@ -37,7 +37,7 @@ CPathfinder::PathfinderOptions::PathfinderOptions()
 }
 
 CPathfinder::CPathfinder(CPathsInfo & _out, CGameState * _gs, const CGHeroInstance * _hero)
-	: CGameInfoCallback(_gs, boost::optional<PlayerColor>()), out(_out), hero(_hero)
+	: CGameInfoCallback(_gs, boost::optional<PlayerColor>()), out(_out), hero(_hero), FoW(getPlayerTeam(hero->tempOwner)->fogOfWarMap)
 {
 	assert(hero);
 	assert(hero == getHero(hero->id));
@@ -602,7 +602,7 @@ void CPathfinder::initializeGraph()
 
 CGPathNode::EAccessibility CPathfinder::evaluateAccessibility(const int3 & pos, const TerrainTile * tinfo, const ELayer layer) const
 {
-	if(tinfo->terType == ETerrainType::ROCK || !isVisible(pos, hero->tempOwner))
+	if(tinfo->terType == ETerrainType::ROCK || !FoW[pos.x][pos.y][pos.z])
 		return CGPathNode::BLOCKED;
 
 	switch(layer)

+ 1 - 0
lib/CPathfinder.h

@@ -153,6 +153,7 @@ private:
 
 	CPathsInfo & out;
 	const CGHeroInstance * hero;
+	const std::vector<std::vector<std::vector<ui8> > > &FoW;
 	unique_ptr<CPathfinderHelper> hlp;
 
 	struct NodeComparer