CvLuaPlayer::lIsAnyPlotImproved(lua_State *)
- Defined in
- Lua/CvLuaPlayer.cpp, line 9588
- Class
- CvLuaPlayer
- Hook name
CivHooks::CvLuaPlayer_lIsAnyPlotImproved
Hooks
static bool BeforeCvLuaPlayer_lIsAnyPlotImproved(lua_State* L, int& result);static void AfterCvLuaPlayer_lIsAnyPlotImproved(lua_State* L, int& result);static int ReplaceCvLuaPlayer_lIsAnyPlotImproved(int (*original)(lua_State*), lua_State* L);CivRegisterBefore<CivHooks::CvLuaPlayer_lIsAnyPlotImproved>(host, &BeforeCvLuaPlayer_lIsAnyPlotImproved);CivRegisterAfter<CivHooks::CvLuaPlayer_lIsAnyPlotImproved>(host, &AfterCvLuaPlayer_lIsAnyPlotImproved);CivRegisterReplace<CivHooks::CvLuaPlayer_lIsAnyPlotImproved>(host, &ReplaceCvLuaPlayer_lIsAnyPlotImproved);
Code
9588int CvLuaPlayer::lIsAnyPlotImproved(lua_State* L)9589{9590 CvPlayerAI* pkPlayer = GetInstance(L);95919592 const CvPlotsVector& aiPlots = pkPlayer->GetPlots();95939594 bool bResult = false;95959596 // go through all the plots the player has under their control9597 for(uint uiPlotIndex = 0; uiPlotIndex < aiPlots.size(); uiPlotIndex++)9598 {9599 // when we encounter the first plot that is invalid, the rest of the list will be invalid9600 if(aiPlots[uiPlotIndex] == -1)9601 {9602 break;9603 }96049605 CvPlot* pPlot = GC.getMap().plotByIndex(aiPlots[uiPlotIndex]);9606 if(!pPlot)9607 {9608 continue;9609 }96109611 if(pPlot->getPlotCity())9612 {9613 continue;9614 }96159616 if(pPlot->getImprovementType() != NO_IMPROVEMENT || pPlot->getRouteType() != NO_ROUTE)9617 {9618 bResult = true;9619 break;9620 }9621 }96229623 lua_pushboolean(L, bResult);96249625 return 1;9626}
Calls
BaseVector::operator[]BaseVector::size- CvGlobals::getMap()
CvLuaScopedInstance::GetInstance- CvMap::plotByIndex(int) const
- CvPlayer::GetPlots()
- CvPlot::getImprovementType() const
- CvPlot::getPlotCity() const
- CvPlot::getRouteType() const
lua_pushboolean