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

AI will only ignore garrisons in 'Steadwick Fall' mission (H3 logic)

This commit is contained in:
Ivan Savenko 2024-04-20 17:30:50 +03:00
parent e8e4446886
commit 438ec08d72
5 changed files with 22 additions and 3 deletions

View File

@ -11,6 +11,7 @@
#include "../../lib/ArtifactUtils.h"
#include "../../lib/UnlockGuard.h"
#include "../../lib/StartInfo.h"
#include "../../lib/mapObjects/MapObjects.h"
#include "../../lib/mapObjects/ObjectTemplate.h"
#include "../../lib/mapObjects/CGHeroInstance.h"
@ -750,7 +751,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 && nullkiller->settings->isGarrisonTroopsUsageAllowed())
if(removableUnits && up->tempOwner == down->tempOwner && nullkiller->settings->isGarrisonTroopsUsageAllowed() && !cb->getStartInfo()->isSteadwickFallCampaignMission())
{
pickBestCreatures(down, up);
}

View File

@ -16,6 +16,7 @@
#include "../../lib/ArtifactUtils.h"
#include "../../lib/UnlockGuard.h"
#include "../../lib/StartInfo.h"
#include "../../lib/mapObjects/MapObjects.h"
#include "../../lib/mapObjects/ObjectTemplate.h"
#include "../../lib/CConfigHandler.h"
@ -732,7 +733,7 @@ void VCAI::showGarrisonDialog(const CArmedInstance * up, const CGHeroInstance *
//you can't request action from action-response thread
requestActionASAP([=]()
{
if(removableUnits)
if(removableUnits && !cb->getStartInfo()->isSteadwickFallCampaignMission())
pickBestCreatures(down, up);
answerQuery(queryID, 0);

View File

@ -4,5 +4,5 @@
"mainHeroTurnDistanceLimit" : 10,
"scoutHeroTurnDistanceLimit" : 5,
"maxGoldPressure" : 0.3,
"useTroopsFromGarrisons" : false
"useTroopsFromGarrisons" : true
}

View File

@ -89,6 +89,20 @@ std::string StartInfo::getCampaignName() const
return VLC->generaltexth->allTexts[508];
}
bool StartInfo::isSteadwickFallCampaignMission() const
{
if (!campState)
return false;
if (campState->getFilename() != "DATA/EVIL1")
return false;
if (campState->currentScenario() != CampaignScenarioID(2))
return false;
return true;
}
void LobbyInfo::verifyStateBeforeStart(bool ignoreNoHuman) const
{
if(!mi || !mi->mapHeader)

View File

@ -136,6 +136,9 @@ struct DLL_LINKAGE StartInfo
// TODO: Must be client-side
std::string getCampaignName() const;
/// Controls hardcoded check for "Steadwick's Fall" scenario from "Dungeon and Devils" campaign
bool isSteadwickFallCampaignMission() const;
template <typename Handler>
void serialize(Handler &h)
{