mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-10 22:31:40 +02:00
Remove excessive recomputations of tile owners
This commit is contained in:
@@ -285,8 +285,8 @@ void AIGateway::tileRevealed(const std::unordered_set<int3> & pos)
|
||||
addVisitableObj(obj);
|
||||
}
|
||||
|
||||
if (nullkiller->settings->isUpdateHitmapOnTileReveal())
|
||||
nullkiller->dangerHitMap->reset();
|
||||
if (nullkiller->settings->isUpdateHitmapOnTileReveal() && !pos.empty())
|
||||
nullkiller->dangerHitMap->resetTileOwners();
|
||||
}
|
||||
|
||||
void AIGateway::heroExchangeStarted(ObjectInstanceID hero1, ObjectInstanceID hero2, QueryID query)
|
||||
@@ -389,9 +389,10 @@ void AIGateway::objectRemoved(const CGObjectInstance * obj, const PlayerColor &
|
||||
}
|
||||
|
||||
if(obj->ID == Obj::HERO && cb->getPlayerRelations(obj->tempOwner, playerID) == PlayerRelations::ENEMIES)
|
||||
{
|
||||
nullkiller->dangerHitMap->reset();
|
||||
}
|
||||
nullkiller->dangerHitMap->resetHitmap();
|
||||
|
||||
if(obj->ID == Obj::TOWN)
|
||||
nullkiller->dangerHitMap->resetTileOwners();
|
||||
}
|
||||
|
||||
void AIGateway::showHillFortWindow(const CGObjectInstance * object, const CGHeroInstance * visitor)
|
||||
@@ -507,7 +508,7 @@ void AIGateway::objectPropertyChanged(const SetObjectProperty * sop)
|
||||
else if(relations == PlayerRelations::SAME_PLAYER && obj->ID == Obj::TOWN)
|
||||
{
|
||||
// reevaluate defence for a new town
|
||||
nullkiller->dangerHitMap->reset();
|
||||
nullkiller->dangerHitMap->resetHitmap();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1246,7 +1247,7 @@ void AIGateway::addVisitableObj(const CGObjectInstance * obj)
|
||||
|
||||
if(obj->ID == Obj::HERO && cb->getPlayerRelations(obj->tempOwner, playerID) == PlayerRelations::ENEMIES)
|
||||
{
|
||||
nullkiller->dangerHitMap->reset();
|
||||
nullkiller->dangerHitMap->resetHitmap();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -345,10 +345,4 @@ std::set<const CGObjectInstance *> DangerHitMapAnalyzer::getOneTurnAccessibleObj
|
||||
return result;
|
||||
}
|
||||
|
||||
void DangerHitMapAnalyzer::reset()
|
||||
{
|
||||
hitMapUpToDate = false;
|
||||
tileOwnersUpToDate = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -87,7 +87,7 @@ public:
|
||||
const HitMapNode & getObjectThreat(const CGObjectInstance * obj) const;
|
||||
const HitMapNode & getTileThreat(const int3 & tile) const;
|
||||
std::set<const CGObjectInstance *> getOneTurnAccessibleObjects(const CGHeroInstance * enemy) const;
|
||||
void reset();
|
||||
void resetHitmap() {hitMapUpToDate = false;}
|
||||
void resetTileOwners() { tileOwnersUpToDate = false; }
|
||||
PlayerColor getTileOwner(const int3 & tile) const;
|
||||
const CGTownInstance * getClosestTown(const int3 & tile) const;
|
||||
|
@@ -229,7 +229,7 @@ void Nullkiller::resetAiState()
|
||||
lockedResources = TResources();
|
||||
scanDepth = ScanDepth::MAIN_FULL;
|
||||
lockedHeroes.clear();
|
||||
dangerHitMap->reset();
|
||||
dangerHitMap->resetHitmap();
|
||||
useHeroChain = true;
|
||||
objectClusterizer->reset();
|
||||
|
||||
|
@@ -40,7 +40,7 @@
|
||||
"scoutHeroTurnDistanceLimit" : 5,
|
||||
"threatTurnDistanceLimit" : 1,
|
||||
"maxGoldPressure" : 0.3,
|
||||
"updateHitmapOnTileReveal" : false,
|
||||
"updateHitmapOnTileReveal" : true,
|
||||
"useTroopsFromGarrisons" : true,
|
||||
"openMap": true,
|
||||
"allowObjectGraph": false,
|
||||
@@ -61,7 +61,7 @@
|
||||
"scoutHeroTurnDistanceLimit" : 5,
|
||||
"threatTurnDistanceLimit" : 4,
|
||||
"maxGoldPressure" : 0.3,
|
||||
"updateHitmapOnTileReveal" : false,
|
||||
"updateHitmapOnTileReveal" : true,
|
||||
"useTroopsFromGarrisons" : true,
|
||||
"openMap": true,
|
||||
"allowObjectGraph": false,
|
||||
@@ -82,7 +82,7 @@
|
||||
"scoutHeroTurnDistanceLimit" : 5,
|
||||
"threatTurnDistanceLimit" : 5,
|
||||
"maxGoldPressure" : 0.3,
|
||||
"updateHitmapOnTileReveal" : false,
|
||||
"updateHitmapOnTileReveal" : true,
|
||||
"useTroopsFromGarrisons" : true,
|
||||
"openMap": true,
|
||||
"allowObjectGraph": false,
|
||||
@@ -103,7 +103,7 @@
|
||||
"scoutHeroTurnDistanceLimit" : 5,
|
||||
"threatTurnDistanceLimit" : 5,
|
||||
"maxGoldPressure" : 0.3,
|
||||
"updateHitmapOnTileReveal" : false,
|
||||
"updateHitmapOnTileReveal" : true,
|
||||
"useTroopsFromGarrisons" : true,
|
||||
"openMap": true,
|
||||
"allowObjectGraph": false,
|
||||
@@ -124,7 +124,7 @@
|
||||
"scoutHeroTurnDistanceLimit" : 5,
|
||||
"threatTurnDistanceLimit" : 5,
|
||||
"maxGoldPressure" : 0.3,
|
||||
"updateHitmapOnTileReveal" : false,
|
||||
"updateHitmapOnTileReveal" : true,
|
||||
"useTroopsFromGarrisons" : true,
|
||||
"openMap": true,
|
||||
"allowObjectGraph": false,
|
||||
|
Reference in New Issue
Block a user