mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Extend AI garrison troop removal logic to all RoE campaigns to emulate
H3 logic
This commit is contained in:
		| @@ -763,7 +763,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() && !cb->getStartInfo()->isSteadwickFallCampaignMission()) | ||||
| 		if(removableUnits && up->tempOwner == down->tempOwner && nullkiller->settings->isGarrisonTroopsUsageAllowed() && !cb->getStartInfo()->isRestorationOfErathiaCampaign()) | ||||
| 		{ | ||||
| 			pickBestCreatures(down, up); | ||||
| 		} | ||||
|   | ||||
| @@ -731,7 +731,7 @@ void VCAI::showGarrisonDialog(const CArmedInstance * up, const CGHeroInstance * | ||||
| 	//you can't request action from action-response thread | ||||
| 	requestActionASAP([=]() | ||||
| 	{ | ||||
| 		if(removableUnits && !cb->getStartInfo()->isSteadwickFallCampaignMission()) | ||||
| 		if(removableUnits && !cb->getStartInfo()->isRestorationOfErathiaCampaign()) | ||||
| 			pickBestCreatures(down, up); | ||||
|  | ||||
| 		answerQuery(queryID, 0); | ||||
|   | ||||
| @@ -90,18 +90,22 @@ std::string StartInfo::getCampaignName() const | ||||
| 		return VLC->generaltexth->allTexts[508]; | ||||
| } | ||||
|  | ||||
| bool StartInfo::isSteadwickFallCampaignMission() const | ||||
| bool StartInfo::isRestorationOfErathiaCampaign() const | ||||
| { | ||||
| 	constexpr std::array roeCampaigns = { | ||||
| 		"DATA/GOOD1", | ||||
| 		"DATA/EVIL1", | ||||
| 		"DATA/GOOD2", | ||||
| 		"DATA/NEUTRAL1", | ||||
| 		"DATA/EVIL2", | ||||
| 		"DATA/GOOD3", | ||||
| 		"DATA/SECRET1", | ||||
| 	}; | ||||
|  | ||||
| 	if (!campState) | ||||
| 		return false; | ||||
|  | ||||
| 	if (campState->getFilename() != "DATA/EVIL1") | ||||
| 		return false; | ||||
|  | ||||
| 	if (campState->currentScenario() != CampaignScenarioID(2)) | ||||
| 		return false; | ||||
|  | ||||
| 	return true; | ||||
| 	return vstd::contains(roeCampaigns, campState->getFilename()); | ||||
| } | ||||
|  | ||||
| void LobbyInfo::verifyStateBeforeStart(bool ignoreNoHuman) const | ||||
|   | ||||
| @@ -164,8 +164,8 @@ struct DLL_LINKAGE StartInfo : public Serializeable | ||||
| 	// 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; | ||||
| 	/// Controls hardcoded check for handling of garrisons by AI in Restoration of Erathia campaigns to match H3 behavior | ||||
| 	bool isRestorationOfErathiaCampaign() const; | ||||
|  | ||||
| 	template <typename Handler> | ||||
| 	void serialize(Handler &h) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user