CvPlayer::GetNumNaturalWondersInOwnedPlots()
- Defined in
- CvPlayer.cpp, line 26852
- Class
- CvPlayer
- Hook name
CivHooks::CvPlayer_GetNumNaturalWondersInOwnedPlots
Hooks
static bool BeforeCvPlayer_GetNumNaturalWondersInOwnedPlots(CvPlayer* self, int& result);static void AfterCvPlayer_GetNumNaturalWondersInOwnedPlots(CvPlayer* self, int& result);static int ReplaceCvPlayer_GetNumNaturalWondersInOwnedPlots(int (*original)(CvPlayer*), CvPlayer* self);CivRegisterBefore<CivHooks::CvPlayer_GetNumNaturalWondersInOwnedPlots>(host, &BeforeCvPlayer_GetNumNaturalWondersInOwnedPlots);CivRegisterAfter<CivHooks::CvPlayer_GetNumNaturalWondersInOwnedPlots>(host, &AfterCvPlayer_GetNumNaturalWondersInOwnedPlots);CivRegisterReplace<CivHooks::CvPlayer_GetNumNaturalWondersInOwnedPlots>(host, &ReplaceCvPlayer_GetNumNaturalWondersInOwnedPlots);
Code
26851/// Calculates how many Natural Wonders are in plots this player owns26852int CvPlayer::GetNumNaturalWondersInOwnedPlots()26853{26854 int iValue = 0;26855 CvPlotsVector& aiPlots = GetPlots();26856 for(uint ui = 0; ui < aiPlots.size(); ui++)26857 {26858 // at the end of the plot list26859 if(aiPlots[ui] == -1)26860 {26861 break;26862 }2686326864 CvPlot* pPlot = GC.getMap().plotByIndex(aiPlots[ui]);26865 if (pPlot && pPlot->IsNaturalWonder())26866 {26867 iValue++;26868 }26869 }26870 return iValue;26871}
Calls
BaseVector::operator[]BaseVector::size- CvGlobals::getMap()
- CvMap::plotByIndex(int) const
- CvPlayer::GetPlots()
- CvPlot::IsNaturalWonder() const