Bazaar developer reference

CvHomelandAI::PlotExplorerMoves()

Defined in
CvHomelandAI.cpp, line 816
Class
CvHomelandAI
Hook name
CivHooks::CvHomelandAI_PlotExplorerMoves

Hooks

static bool BeforeCvHomelandAI_PlotExplorerMoves(CvHomelandAI* self);static void AfterCvHomelandAI_PlotExplorerMoves(CvHomelandAI* self);static void ReplaceCvHomelandAI_PlotExplorerMoves(void (*original)(CvHomelandAI*), CvHomelandAI* self);CivRegisterBefore<CivHooks::CvHomelandAI_PlotExplorerMoves>(host, &BeforeCvHomelandAI_PlotExplorerMoves);CivRegisterAfter<CivHooks::CvHomelandAI_PlotExplorerMoves>(host, &AfterCvHomelandAI_PlotExplorerMoves);CivRegisterReplace<CivHooks::CvHomelandAI_PlotExplorerMoves>(host, &ReplaceCvHomelandAI_PlotExplorerMoves);

Code

815/// Get units with explore AI and plan their moves816void CvHomelandAI::PlotExplorerMoves()817{818	ClearCurrentMoveUnits();819820	// Loop through all recruited units821	for(list<int>::iterator it = m_CurrentTurnUnits.begin(); it != m_CurrentTurnUnits.end(); ++it)822	{823		UnitHandle pUnit = m_pPlayer->getUnit(*it);824		if(pUnit)825		{826			if(pUnit->AI_getUnitAIType() == UNITAI_EXPLORE ||827			        pUnit->IsAutomated() && pUnit->getDomainType() == DOMAIN_LAND && pUnit->GetAutomateType() == AUTOMATE_EXPLORE)828			{829				CvHomelandUnit unit;830				unit.SetID(pUnit->GetID());831				m_CurrentMoveUnits.push_back(unit);832			}833		}834	}835836	if(m_CurrentMoveUnits.size() > 0)837	{838		// Execute twice so explorers who can reach the end of their sight can move again839		ExecuteExplorerMoves();840		ExecuteExplorerMoves();841	}842}

Calls

Called by