Hooks
static bool BeforeCvUnit_embark(CvUnit* self, CvPlot* pPlot);static void AfterCvUnit_embark(CvUnit* self, CvPlot* pPlot);static void ReplaceCvUnit_embark(void (*original)(CvUnit*, CvPlot*), CvUnit* self, CvPlot* pPlot);CivRegisterBefore<CivHooks::CvUnit_embark>(host, &BeforeCvUnit_embark);CivRegisterAfter<CivHooks::CvUnit_embark>(host, &AfterCvUnit_embark);CivRegisterReplace<CivHooks::CvUnit_embark>(host, &ReplaceCvUnit_embark);
Code
5154void CvUnit::embark(CvPlot* pPlot)5155{5156 VALIDATE_OBJECT5157 if (canChangeVisibility())5158#if defined(MOD_API_EXTENSIONS)5159 pPlot->changeAdjacentSight(getTeam(), visibilityRange(), false, getSeeInvisibleType(), getFacingDirection(true), this);5160#else5161 pPlot->changeAdjacentSight(getTeam(), visibilityRange(), false, getSeeInvisibleType(), getFacingDirection(true));5162#endif51635164 setEmbarked(true);51655166 if (canChangeVisibility())5167#if defined(MOD_API_EXTENSIONS)5168 pPlot->changeAdjacentSight(getTeam(), visibilityRange(), true, getSeeInvisibleType(), getFacingDirection(true), this);5169#else5170 pPlot->changeAdjacentSight(getTeam(), visibilityRange(), true, getSeeInvisibleType(), getFacingDirection(true));5171#endif51725173 auto_ptr<ICvUnit1> pDllUnit(new CvDllUnit(this));5174 gDLL->GameplayUnitEmbark(pDllUnit.get(), true);51755176#if !defined(NO_ACHIEVEMENTS)5177 if(isHuman() && !GC.getGame().isGameMultiPlayer() && GET_PLAYER(GC.getGame().getActivePlayer()).isLocalPlayer())5178 {5179 gDLL->UnlockAchievement(ACHIEVEMENT_UNIT_EMBARK);5180 }5181#endif5182}