1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00

Merge pull request #5020 from IvanSavenko/ai_object_fix

Fix AI not recruiting heroes when map reveal is off
This commit is contained in:
Ivan Savenko 2024-12-05 16:29:43 +02:00 committed by GitHub
commit 102dfd0966
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 13 additions and 0 deletions

View File

@ -281,6 +281,9 @@ void AIGateway::tileRevealed(const std::unordered_set<int3> & pos)
for(const CGObjectInstance * obj : myCb->getVisitableObjs(tile)) for(const CGObjectInstance * obj : myCb->getVisitableObjs(tile))
addVisitableObj(obj); addVisitableObj(obj);
} }
if (nullkiller->settings->isUpdateHitmapOnTileReveal())
nullkiller->dangerHitMap->reset();
} }
void AIGateway::heroExchangeStarted(ObjectInstanceID hero1, ObjectInstanceID hero2, QueryID query) void AIGateway::heroExchangeStarted(ObjectInstanceID hero1, ObjectInstanceID hero2, QueryID query)

View File

@ -348,6 +348,7 @@ std::set<const CGObjectInstance *> DangerHitMapAnalyzer::getOneTurnAccessibleObj
void DangerHitMapAnalyzer::reset() void DangerHitMapAnalyzer::reset()
{ {
hitMapUpToDate = false; hitMapUpToDate = false;
tileOwnersUpToDate = false;
} }
} }

View File

@ -37,6 +37,7 @@ namespace NKAI
pathfinderBucketSize(32), pathfinderBucketSize(32),
allowObjectGraph(true), allowObjectGraph(true),
useTroopsFromGarrisons(false), useTroopsFromGarrisons(false),
updateHitmapOnTileReveal(false),
openMap(true), openMap(true),
useFuzzy(false) useFuzzy(false)
{ {
@ -55,6 +56,7 @@ namespace NKAI
retreatThresholdAbsolute = node["retreatThresholdAbsolute"].Float(); retreatThresholdAbsolute = node["retreatThresholdAbsolute"].Float();
safeAttackRatio = node["safeAttackRatio"].Float(); safeAttackRatio = node["safeAttackRatio"].Float();
allowObjectGraph = node["allowObjectGraph"].Bool(); allowObjectGraph = node["allowObjectGraph"].Bool();
updateHitmapOnTileReveal = node["updateHitmapOnTileReveal"].Bool();
openMap = node["openMap"].Bool(); openMap = node["openMap"].Bool();
useFuzzy = node["useFuzzy"].Bool(); useFuzzy = node["useFuzzy"].Bool();
useTroopsFromGarrisons = node["useTroopsFromGarrisons"].Bool(); useTroopsFromGarrisons = node["useTroopsFromGarrisons"].Bool();

View File

@ -33,6 +33,7 @@ namespace NKAI
float safeAttackRatio; float safeAttackRatio;
bool allowObjectGraph; bool allowObjectGraph;
bool useTroopsFromGarrisons; bool useTroopsFromGarrisons;
bool updateHitmapOnTileReveal;
bool openMap; bool openMap;
bool useFuzzy; bool useFuzzy;
@ -51,6 +52,7 @@ namespace NKAI
int getPathfinderBucketSize() const { return pathfinderBucketSize; } int getPathfinderBucketSize() const { return pathfinderBucketSize; }
bool isObjectGraphAllowed() const { return allowObjectGraph; } bool isObjectGraphAllowed() const { return allowObjectGraph; }
bool isGarrisonTroopsUsageAllowed() const { return useTroopsFromGarrisons; } bool isGarrisonTroopsUsageAllowed() const { return useTroopsFromGarrisons; }
bool isUpdateHitmapOnTileReveal() const { return updateHitmapOnTileReveal; }
bool isOpenMap() const { return openMap; } bool isOpenMap() const { return openMap; }
bool isUseFuzzy() const { return useFuzzy; } bool isUseFuzzy() const { return useFuzzy; }
}; };

View File

@ -5,6 +5,7 @@
"mainHeroTurnDistanceLimit" : 10, "mainHeroTurnDistanceLimit" : 10,
"scoutHeroTurnDistanceLimit" : 5, "scoutHeroTurnDistanceLimit" : 5,
"maxGoldPressure" : 0.3, "maxGoldPressure" : 0.3,
"updateHitmapOnTileReveal" : false,
"useTroopsFromGarrisons" : true, "useTroopsFromGarrisons" : true,
"openMap": false, "openMap": false,
"allowObjectGraph": false, "allowObjectGraph": false,
@ -22,6 +23,7 @@
"mainHeroTurnDistanceLimit" : 10, "mainHeroTurnDistanceLimit" : 10,
"scoutHeroTurnDistanceLimit" : 5, "scoutHeroTurnDistanceLimit" : 5,
"maxGoldPressure" : 0.3, "maxGoldPressure" : 0.3,
"updateHitmapOnTileReveal" : false,
"useTroopsFromGarrisons" : true, "useTroopsFromGarrisons" : true,
"openMap": false, "openMap": false,
"allowObjectGraph": false, "allowObjectGraph": false,
@ -39,6 +41,7 @@
"mainHeroTurnDistanceLimit" : 10, "mainHeroTurnDistanceLimit" : 10,
"scoutHeroTurnDistanceLimit" : 5, "scoutHeroTurnDistanceLimit" : 5,
"maxGoldPressure" : 0.3, "maxGoldPressure" : 0.3,
"updateHitmapOnTileReveal" : false,
"useTroopsFromGarrisons" : true, "useTroopsFromGarrisons" : true,
"openMap": false, "openMap": false,
"allowObjectGraph": false, "allowObjectGraph": false,
@ -56,6 +59,7 @@
"mainHeroTurnDistanceLimit" : 10, "mainHeroTurnDistanceLimit" : 10,
"scoutHeroTurnDistanceLimit" : 5, "scoutHeroTurnDistanceLimit" : 5,
"maxGoldPressure" : 0.3, "maxGoldPressure" : 0.3,
"updateHitmapOnTileReveal" : false,
"useTroopsFromGarrisons" : true, "useTroopsFromGarrisons" : true,
"openMap": true, "openMap": true,
"allowObjectGraph": false, "allowObjectGraph": false,
@ -73,6 +77,7 @@
"mainHeroTurnDistanceLimit" : 10, "mainHeroTurnDistanceLimit" : 10,
"scoutHeroTurnDistanceLimit" : 5, "scoutHeroTurnDistanceLimit" : 5,
"maxGoldPressure" : 0.3, "maxGoldPressure" : 0.3,
"updateHitmapOnTileReveal" : false,
"useTroopsFromGarrisons" : true, "useTroopsFromGarrisons" : true,
"openMap": true, "openMap": true,
"allowObjectGraph": false, "allowObjectGraph": false,