1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-13 11:40:38 +02:00

Added 'useTroopsFromGarrisons' option to NKAI

This commit is contained in:
Ivan Savenko 2024-04-19 18:40:29 +03:00
parent d5d9b79b92
commit 20f323d83c
4 changed files with 14 additions and 8 deletions

View File

@ -750,7 +750,7 @@ void AIGateway::showGarrisonDialog(const CArmedInstance * up, const CGHeroInstan
//you can't request action from action-response thread
requestActionASAP([=]()
{
if(removableUnits && up->tempOwner == down->tempOwner)
if(removableUnits && up->tempOwner == down->tempOwner && nullkiller->settings->isGarrisonTroopsUsageAllowed())
{
pickBestCreatures(down, up);
}

View File

@ -28,7 +28,8 @@ namespace NKAI
scoutHeroTurnDistanceLimit(5),
maxGoldPressure(0.3f),
maxpass(10),
allowObjectGraph(false)
allowObjectGraph(false),
useTroopsFromGarrisons(false)
{
ResourcePath resource("config/ai/nkai/nkai-settings", EResType::JSON);
@ -80,5 +81,10 @@ namespace NKAI
{
allowObjectGraph = node.Struct()["allowObjectGraph"].Bool();
}
if(!node.Struct()["useTroopsFromGarrisons"].isNull())
{
useTroopsFromGarrisons = node.Struct()["useTroopsFromGarrisons"].Bool();
}
}
}
}

View File

@ -27,6 +27,7 @@ namespace NKAI
int maxpass;
float maxGoldPressure;
bool allowObjectGraph;
bool useTroopsFromGarrisons;
public:
Settings();
@ -37,8 +38,6 @@ namespace NKAI
int getMainHeroTurnDistanceLimit() const { return mainHeroTurnDistanceLimit; }
int getScoutHeroTurnDistanceLimit() const { return scoutHeroTurnDistanceLimit; }
bool isObjectGraphAllowed() const { return allowObjectGraph; }
private:
void loadFromMod(const std::string & modName, const ResourcePath & resource);
bool isGarrisonTroopsUsageAllowed() const { return useTroopsFromGarrisons; }
};
}
}

View File

@ -3,5 +3,6 @@
"maxpass" : 30,
"mainHeroTurnDistanceLimit" : 10,
"scoutHeroTurnDistanceLimit" : 5,
"maxGoldPressure" : 0.3
"maxGoldPressure" : 0.3,
"useTroopsFromGarrisons" : false
}