CvUnit::GetDeclareWarRangeStrike(const CvPlot &) const
- Defined in
- CvUnit.cpp, line 3000
- Class
- CvUnit
- Hook name
CivHooks::CvUnit_GetDeclareWarRangeStrike
Hooks
static bool BeforeCvUnit_GetDeclareWarRangeStrike(const CvUnit* self, const CvPlot& plot, TeamTypes& result);static void AfterCvUnit_GetDeclareWarRangeStrike(const CvUnit* self, const CvPlot& plot, TeamTypes& result);static TeamTypes ReplaceCvUnit_GetDeclareWarRangeStrike(TeamTypes (*original)(const CvUnit*, const CvPlot&), const CvUnit* self, const CvPlot& plot);CivRegisterBefore<CivHooks::CvUnit_GetDeclareWarRangeStrike>(host, &BeforeCvUnit_GetDeclareWarRangeStrike);CivRegisterAfter<CivHooks::CvUnit_GetDeclareWarRangeStrike>(host, &AfterCvUnit_GetDeclareWarRangeStrike);CivRegisterReplace<CivHooks::CvUnit_GetDeclareWarRangeStrike>(host, &ReplaceCvUnit_GetDeclareWarRangeStrike);
Code
2999/// Returns the ID of the team to declare war against3000TeamTypes CvUnit::GetDeclareWarRangeStrike(const CvPlot& plot) const3001{3002 VALIDATE_OBJECT3003 const CvUnit* pUnit;30043005 CvAssert(isHuman());30063007 if(plot.isActiveVisible(false))3008 {3009 if(canRangeStrikeAt(plot.getX(), plot.getY(), false))3010 {3011 pUnit = plot.plotCheck(PUF_canDeclareWar, getOwner(), isAlwaysHostile(plot), NO_PLAYER, NO_TEAM, PUF_isVisible, getOwner());30123013 if(pUnit != NULL)3014 {3015 return pUnit->getTeam();3016 }3017 // Check for City as well3018 else3019 {3020 if(plot.isCity())3021 {3022#if defined(MOD_EVENTS_WAR_AND_PEACE)3023 if(GET_TEAM(getTeam()).canDeclareWar(plot.getTeam(), getOwner()))3024#else3025 if(GET_TEAM(getTeam()).canDeclareWar(plot.getTeam()))3026#endif3027 {3028 return plot.getTeam();3029 }3030 }3031 }3032 }3033 }30343035 return NO_TEAM;3036}
Calls
- CvPlot::getTeam() const
- CvPlot::getX() const
- CvPlot::getY() const
- CvPlot::isActiveVisible(bool) const
- CvPlot::isCity() const
- CvPlot::plotCheck(ConstPlotUnitFunc, int, int, PlayerTypes, TeamTypes, ConstPlotUnitFunc, int, int) const
- CvTeam::canDeclareWar(TeamTypes, PlayerTypes) const
- CvTeam::getTeam(TeamTypes)
- CvUnit::canRangeStrikeAt(int, int, bool, bool) const
- CvUnit::getOwner() const
- CvUnit::getTeam() const
- CvUnit::isAlwaysHostile(const CvPlot &) const
- PUF_canDeclareWar(const CvUnit *, int, int)
- PUF_isVisible(const CvUnit *, int, int)