Bazaar developer reference

CvHomelandAI::ExecuteInquisitorMoves()

Defined in
CvHomelandAI.cpp, line 4509
Class
CvHomelandAI
Hook name
CivHooks::CvHomelandAI_ExecuteInquisitorMoves

Hooks

static bool BeforeCvHomelandAI_ExecuteInquisitorMoves(CvHomelandAI* self);static void AfterCvHomelandAI_ExecuteInquisitorMoves(CvHomelandAI* self);static void ReplaceCvHomelandAI_ExecuteInquisitorMoves(void (*original)(CvHomelandAI*), CvHomelandAI* self);CivRegisterBefore<CivHooks::CvHomelandAI_ExecuteInquisitorMoves>(host, &BeforeCvHomelandAI_ExecuteInquisitorMoves);CivRegisterAfter<CivHooks::CvHomelandAI_ExecuteInquisitorMoves>(host, &AfterCvHomelandAI_ExecuteInquisitorMoves);CivRegisterReplace<CivHooks::CvHomelandAI_ExecuteInquisitorMoves>(host, &ReplaceCvHomelandAI_ExecuteInquisitorMoves);

Code

4508// Get a inquisitor to the best city4509void CvHomelandAI::ExecuteInquisitorMoves()4510{4511	FStaticVector< CvHomelandUnit, 64, true, c_eCiv5GameplayDLL >::iterator it;4512	for(it = m_CurrentMoveUnits.begin(); it != m_CurrentMoveUnits.end(); ++it)4513	{4514		UnitHandle pUnit = m_pPlayer->getUnit(it->GetID());4515		if(!pUnit)4516		{4517			continue;4518		}45194520		int iTargetTurns;4521		CvPlot* pTarget = m_pPlayer->GetReligionAI()->ChooseInquisitorTargetPlot(pUnit, &iTargetTurns);4522		if(pTarget)4523		{4524			if(pUnit->plot() == pTarget)4525			{4526				pUnit->PushMission(CvTypes::getMISSION_REMOVE_HERESY());45274528				if(GC.getLogging() && GC.getAILogging())4529				{4530					CvString strLogString;4531					strLogString.Format("Removing heresy, X: %d, Y: %d", pTarget->getX(), pTarget->getY());4532					LogHomelandMessage(strLogString);4533				}4534			}4535			else if(iTargetTurns < 1)4536			{4537				pUnit->PushMission(CvTypes::getMISSION_MOVE_TO(), pTarget->getX(), pTarget->getY());45384539				if(pUnit->plot() == pTarget && pUnit->canMove())4540				{4541					pUnit->PushMission(CvTypes::getMISSION_REMOVE_HERESY());45424543					if(GC.getLogging() && GC.getAILogging())4544					{4545						CvString strLogString;4546						strLogString.Format("Move to remove heresy, X: %d, Y: %d", pTarget->getX(), pTarget->getY());4547						LogHomelandMessage(strLogString);4548					}4549				}4550				else4551				{4552					CvAssertMsg(false, "Internal error with Inquisitor AI move, contact Ed.");4553				}4554			}4555			else4556			{4557				m_CurrentBestMoveHighPriorityUnit = NULL;4558				m_CurrentBestMoveUnit = m_pPlayer->getUnit(it->GetID());4559				ExecuteMoveToTarget(pTarget);45604561				if(GC.getLogging() && GC.getAILogging())4562				{4563					CvString strLogString;4564					strLogString.Format("Moving to plot adjacent to heresy removal city, X: %d, Y: %d, Currently at, X: %d, Y: %d", pTarget->getX(), pTarget->getY(), pUnit->getX(), pUnit->getY());4565					LogHomelandMessage(strLogString);4566				}4567			}4568		}4569	}4570}

Calls

Called by