Bazaar developer reference

CvHomelandAI::ExecuteSSPartMoves()

Defined in
CvHomelandAI.cpp, line 4573
Class
CvHomelandAI
Hook name
CivHooks::CvHomelandAI_ExecuteSSPartMoves

Hooks

static bool BeforeCvHomelandAI_ExecuteSSPartMoves(CvHomelandAI* self);static void AfterCvHomelandAI_ExecuteSSPartMoves(CvHomelandAI* self);static void ReplaceCvHomelandAI_ExecuteSSPartMoves(void (*original)(CvHomelandAI*), CvHomelandAI* self);CivRegisterBefore<CivHooks::CvHomelandAI_ExecuteSSPartMoves>(host, &BeforeCvHomelandAI_ExecuteSSPartMoves);CivRegisterAfter<CivHooks::CvHomelandAI_ExecuteSSPartMoves>(host, &AfterCvHomelandAI_ExecuteSSPartMoves);CivRegisterReplace<CivHooks::CvHomelandAI_ExecuteSSPartMoves>(host, &ReplaceCvHomelandAI_ExecuteSSPartMoves);

Code

4572/// Moves a spaceship part to the capital (or into the spaceship if already there)4573void CvHomelandAI::ExecuteSSPartMoves()4574{4575	CvCity* pLoopCity;4576	CvCity* pCapitalCity = NULL;4577	int iLoopCity = 0;4578	for(pLoopCity = m_pPlayer->firstCity(&iLoopCity); pLoopCity != NULL; pLoopCity = m_pPlayer->nextCity(&iLoopCity))4579	{4580		if(pLoopCity->isCapital())4581		{4582			pCapitalCity = pLoopCity;4583			break;4584		}4585	}45864587	if(pCapitalCity != NULL)4588	{4589		FStaticVector< CvHomelandUnit, 64, true, c_eCiv5GameplayDLL >::iterator it;4590		for(it = m_CurrentMoveUnits.begin(); it != m_CurrentMoveUnits.end(); ++it)4591		{4592			UnitHandle pUnit = m_pPlayer->getUnit(it->GetID());4593			if(!pUnit)4594			{4595				continue;4596			}45974598			if(pUnit->plot() != pCapitalCity->plot())4599			{4600				pUnit->PushMission(CvTypes::getMISSION_MOVE_TO(), pCapitalCity->getX(), pCapitalCity->getY());4601				pUnit->finishMoves();4602				UnitProcessed(pUnit->GetID());46034604				if(GC.getLogging() && GC.getAILogging())4605				{4606					CvString strLogString;4607					CvString strTemp;4608					strTemp = pUnit->getUnitInfo().GetDescription();4609					strLogString.Format("Moving %s to spaceship - now at, X: %d, Y: %d", strTemp.GetCString(), pUnit->getX(), pUnit->getY());4610					LogHomelandMessage(strLogString);4611				}4612			}4613		}4614	}4615}

Calls

Called by