Hooks
static bool BeforeCvHomelandAI_ExecuteSpecialExploreMove(CvHomelandAI* self, CvUnit* pUnit, CvPlot* pTargetPlot, bool& result);static void AfterCvHomelandAI_ExecuteSpecialExploreMove(CvHomelandAI* self, CvUnit* pUnit, CvPlot* pTargetPlot, bool& result);static bool ReplaceCvHomelandAI_ExecuteSpecialExploreMove(bool (*original)(CvHomelandAI*, CvUnit*, CvPlot*), CvHomelandAI* self, CvUnit* pUnit, CvPlot* pTargetPlot);CivRegisterBefore<CivHooks::CvHomelandAI_ExecuteSpecialExploreMove>(host, &BeforeCvHomelandAI_ExecuteSpecialExploreMove);CivRegisterAfter<CivHooks::CvHomelandAI_ExecuteSpecialExploreMove>(host, &AfterCvHomelandAI_ExecuteSpecialExploreMove);CivRegisterReplace<CivHooks::CvHomelandAI_ExecuteSpecialExploreMove>(host, &ReplaceCvHomelandAI_ExecuteSpecialExploreMove);
Code
6235/// Move an exploring unit to a designated target (special function exposed to Lua)6236bool CvHomelandAI::ExecuteSpecialExploreMove(CvUnit* pUnit, CvPlot* pTargetPlot)6237{6238 bool bCanFindPath = GC.getPathFinder().GenerateUnitPath(pUnit, pUnit->getX(), pUnit->getY(), pTargetPlot->getX(), pTargetPlot->getY(), MOVE_TERRITORY_NO_ENEMY | MOVE_MAXIMIZE_EXPLORE | MOVE_UNITS_IGNORE_DANGER /*iFlags*/, true/*bReuse*/);6239 if(bCanFindPath)6240 {6241 CvPlot* pPlot = GC.getPathFinder().GetPathEndTurnPlot();6242 if(pPlot)6243 {6244 CvAssert(!pUnit->atPlot(*pPlot));6245 if(GC.getLogging() && GC.getAILogging())6246 {6247 CvString strLogString;6248 strLogString.Format("UnitID: %d Moving to script explore target, X: %d, Y: %d, from X: %d Y: %d", pUnit->GetID(), pPlot->getX(), pPlot->getY(), pUnit->getX(), pUnit->getY());6249 LogHomelandMessage(strLogString);6250 }6251 pUnit->PushMission(CvTypes::getMISSION_MOVE_TO(), pPlot->getX(), pPlot->getY(), MOVE_TERRITORY_NO_ENEMY | MOVE_MAXIMIZE_EXPLORE | MOVE_UNITS_IGNORE_DANGER, false, false, MISSIONAI_EXPLORE, pPlot);6252 pUnit->finishMoves();6253 UnitProcessed(pUnit->GetID());62546255 return true;6256 }6257 }6258 return false;6259}