Bazaar developer reference

CvTacticalAI::PlotRepositionMoves()

Defined in
CvTacticalAI.cpp, line 2546
Class
CvTacticalAI
Hook name
CivHooks::CvTacticalAI_PlotRepositionMoves

Hooks

static bool BeforeCvTacticalAI_PlotRepositionMoves(CvTacticalAI* self);static void AfterCvTacticalAI_PlotRepositionMoves(CvTacticalAI* self);static void ReplaceCvTacticalAI_PlotRepositionMoves(void (*original)(CvTacticalAI*), CvTacticalAI* self);CivRegisterBefore<CivHooks::CvTacticalAI_PlotRepositionMoves>(host, &BeforeCvTacticalAI_PlotRepositionMoves);CivRegisterAfter<CivHooks::CvTacticalAI_PlotRepositionMoves>(host, &AfterCvTacticalAI_PlotRepositionMoves);CivRegisterReplace<CivHooks::CvTacticalAI_PlotRepositionMoves>(host, &ReplaceCvTacticalAI_PlotRepositionMoves);

Code

2545/// Move units to a better location2546void CvTacticalAI::PlotRepositionMoves()2547{2548	list<int>::iterator it;2549	CvTacticalUnit unit;25502551	m_CurrentMoveUnits.clear();25522553	// Loop through all recruited units2554	for(it = m_CurrentTurnUnits.begin(); it != m_CurrentTurnUnits.end(); it++)2555	{2556		UnitHandle pUnit = m_pPlayer->getUnit(*it);2557		if(pUnit)2558		{2559			// Never use this (default) move for Great Admirals or Generals2560			if (pUnit->IsGreatGeneral() || pUnit->IsGreatAdmiral())2561			{2562				continue;2563			}25642565			unit.SetID(pUnit->GetID());2566			m_CurrentMoveUnits.push_back(unit);2567		}2568	}25692570	if(m_CurrentMoveUnits.size() > 0)2571	{2572		ExecuteRepositionMoves();2573	}2574}

Calls

Called by