Hooks
static bool BeforeCvUnit_airlift(CvUnit* self, int iX, int iY, bool& result);static void AfterCvUnit_airlift(CvUnit* self, int iX, int iY, bool& result);static bool ReplaceCvUnit_airlift(bool (*original)(CvUnit*, int, int), CvUnit* self, int iX, int iY);CivRegisterBefore<CivHooks::CvUnit_airlift>(host, &BeforeCvUnit_airlift);CivRegisterAfter<CivHooks::CvUnit_airlift>(host, &AfterCvUnit_airlift);CivRegisterReplace<CivHooks::CvUnit_airlift>(host, &ReplaceCvUnit_airlift);
Code
6351bool CvUnit::airlift(int iX, int iY)6352{6353 VALIDATE_OBJECT6354 CvPlot* pTargetPlot;63556356 if(!canAirliftAt(plot(), iX, iY))6357 {6358 return false;6359 }63606361 pTargetPlot = GC.getMap().plot(iX, iY);6362 CvAssert(pTargetPlot != NULL);636363646365#if !defined(NO_ACHIEVEMENTS)6366 //Here's Looking at You, Kid6367 CvPlayerAI& kActivePlayer = GET_PLAYER(GC.getGame().getActivePlayer());6368 if(pTargetPlot != NULL && getOwner() == kActivePlayer.GetID() && kActivePlayer.isHuman())6369 {6370 //Easy checks out of the way, now for the ugly ones.63716372 //Current City Casablanca?6373 CvPlot* pCurrentPlot = plot();6374 if(pCurrentPlot != NULL)6375 {6376 CvCity* pCurrentCity = pCurrentPlot->getPlotCity();6377 CvCity* pTargetCity = pTargetPlot->getPlotCity();6378 if( pCurrentCity != NULL && pTargetCity != NULL &&6379 strcmp(pCurrentCity->getNameKey(), "TXT_KEY_CITY_NAME_CASABLANCA") == 0 &&6380 pTargetCity->IsOriginalCapital())6381 {6382 const PlayerTypes eOriginalOwner = pTargetCity->getOriginalOwner();6383 CvPlayerAI& kOriginalPlayer = GET_PLAYER(eOriginalOwner);6384 if(strcmp(kOriginalPlayer.getCivilizationTypeKey(), "CIVILIZATION_PORTUGAL") == 0)6385 {6386 gDLL->UnlockAchievement(ACHIEVEMENT_XP2_22);6387 }6388 }6389 }6390 }6391#endif639263936394 if(pTargetPlot != NULL)6395 {6396 finishMoves();6397 setXY(pTargetPlot->getX(), pTargetPlot->getY());6398 return true;6399 }64006401 return false;6402}