Bazaar developer reference

CvDiplomacyAI::DoTestDemandReady()

Defined in
CvDiplomacyAI.cpp, line 4750
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_DoTestDemandReady

Hooks

static bool BeforeCvDiplomacyAI_DoTestDemandReady(CvDiplomacyAI* self);static void AfterCvDiplomacyAI_DoTestDemandReady(CvDiplomacyAI* self);static void ReplaceCvDiplomacyAI_DoTestDemandReady(void (*original)(CvDiplomacyAI*), CvDiplomacyAI* self);CivRegisterBefore<CivHooks::CvDiplomacyAI_DoTestDemandReady>(host, &BeforeCvDiplomacyAI_DoTestDemandReady);CivRegisterAfter<CivHooks::CvDiplomacyAI_DoTestDemandReady>(host, &AfterCvDiplomacyAI_DoTestDemandReady);CivRegisterReplace<CivHooks::CvDiplomacyAI_DoTestDemandReady>(host, &ReplaceCvDiplomacyAI_DoTestDemandReady);

Code

4749/// Are we ready to make a demand, backed with force?4750void CvDiplomacyAI::DoTestDemandReady()4751{4752	PlayerTypes eDemandTarget = GetDemandTargetPlayer();47534754	// Are we actually targeting anyone for a demand?4755	if(eDemandTarget != NO_PLAYER)4756	{4757		if(GetWarGoal(eDemandTarget) == WAR_GOAL_DEMAND)4758		{4759			CvAIOperation* pOperation = GetPlayer()->GetMilitaryAI()->GetShowOfForceOperation(eDemandTarget);47604761			if(pOperation)4762			{4763				if(!IsAtWar(eDemandTarget))4764				{4765					// If we're at least 85% of the way to our objective, let loose the dogs of war!4766					if(IsMusteringForAttack(eDemandTarget) || (pOperation != NULL && pOperation->PercentFromMusterPointToTarget() >= 85))	// If we're "mustering" it means we have a Sneak Attack Operation that's in position to attack4767					{4768						SetMusteringForAttack(eDemandTarget, false);47694770						SetDemandReady(true);4771					}4772				}4773			}4774		}4775	}4776}

Calls

Called by