CvCity::GetNextBuyablePlot()
- Defined in
- CvCity.cpp, line 12057
- Class
- CvCity
- Hook name
CivHooks::CvCity_GetNextBuyablePlot
Hooks
static bool BeforeCvCity_GetNextBuyablePlot(CvCity* self, CvPlot*& result);static void AfterCvCity_GetNextBuyablePlot(CvCity* self, CvPlot*& result);static CvPlot* ReplaceCvCity_GetNextBuyablePlot(CvPlot* (*original)(CvCity*), CvCity* self);CivRegisterBefore<CivHooks::CvCity_GetNextBuyablePlot>(host, &BeforeCvCity_GetNextBuyablePlot);CivRegisterAfter<CivHooks::CvCity_GetNextBuyablePlot>(host, &AfterCvCity_GetNextBuyablePlot);CivRegisterReplace<CivHooks::CvCity_GetNextBuyablePlot>(host, &ReplaceCvCity_GetNextBuyablePlot);
Code
12056/// Which plot will we buy next12057CvPlot* CvCity::GetNextBuyablePlot(void)12058{12059 VALIDATE_OBJECT12060 std::vector<int> aiPlotList;12061 aiPlotList.resize(20, -1);12062 GetBuyablePlotList(aiPlotList);1206312064 int iListLength = 0;12065 for(uint ui = 0; ui < aiPlotList.size(); ui++)12066 {12067 if(aiPlotList[ui] >= 0)12068 {12069 iListLength++;12070 }12071 else12072 {12073 break;12074 }12075 }1207612077 CvPlot* pPickedPlot = NULL;12078 if(iListLength > 0)12079 {12080 int iPickedIndex = GC.getGame().getJonRandNum(iListLength, "GetNextBuyablePlot picker");12081 pPickedPlot = GC.getMap().plotByIndex(aiPlotList[iPickedIndex]);12082 }1208312084 return pPickedPlot;12085}
Calls
- CvCity::GetBuyablePlotList(std::vector<int> &)
- CvGame::getJonRandNum(int, const char *)
- CvGlobals::getGame()
- CvGlobals::getMap()
- CvMap::plotByIndex(int) const
std::vector::operator[]std::vector::resizestd::vector::sizestd::vector::vector