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:
parent
d5d9b79b92
commit
20f323d83c
@ -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);
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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; }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -3,5 +3,6 @@
|
||||
"maxpass" : 30,
|
||||
"mainHeroTurnDistanceLimit" : 10,
|
||||
"scoutHeroTurnDistanceLimit" : 5,
|
||||
"maxGoldPressure" : 0.3
|
||||
"maxGoldPressure" : 0.3,
|
||||
"useTroopsFromGarrisons" : false
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user