diff --git a/Sources/CvCity.cpp b/Sources/CvCity.cpp index f894cd3062..537bd22294 100644 --- a/Sources/CvCity.cpp +++ b/Sources/CvCity.cpp @@ -10839,6 +10839,8 @@ void CvCity::updateCultureLevel(bool bUpdatePlotGroups) { return; } + uint32_t iCultureLevel = 0; + CvGameAI& GAME = GC.getGame(); if (!isOccupation() @@ -10850,19 +10852,18 @@ void CvCity::updateCultureLevel(bool bUpdatePlotGroups) const GameSpeedTypes eSpeed = GAME.getGameSpeedType(); const int iCulture = getCultureTimes100(getOwner()) / 100; - for (int iI = (GC.getNumCultureLevelInfos() - 1); iI > 0; iI--) + foreach_(const CvCultureLevelInfo* info, GC.getCultureLevelInfos()) { - const CvCultureLevelInfo& info = GC.getCultureLevelInfo((CultureLevelTypes)iI); - - if ((info.getPrereqGameOption() == NO_GAMEOPTION || GAME.isOption((GameOptionTypes)info.getPrereqGameOption())) - && iCulture >= info.getSpeedThreshold(eSpeed)) + if (info->getPrereqGameOption() == NO_GAMEOPTION || GAME.isOption((GameOptionTypes)info->getPrereqGameOption())) { - setCultureLevel((CultureLevelTypes)iI, bUpdatePlotGroups); - return; + if (iCulture < info->getSpeedThreshold(eSpeed)) + break; + + iCultureLevel++; } } } - setCultureLevel((CultureLevelTypes)0, bUpdatePlotGroups); + setCultureLevel(static_cast(iCultureLevel), bUpdatePlotGroups); } diff --git a/Sources/CvGlobals.h b/Sources/CvGlobals.h index 6adb646ddd..05cbce875a 100644 --- a/Sources/CvGlobals.h +++ b/Sources/CvGlobals.h @@ -628,6 +628,7 @@ class cvInternalGlobals int getNumCultureLevelInfos() const; CvCultureLevelInfo& getCultureLevelInfo(CultureLevelTypes eCultureLevelNum) const; + const std::vector& getCultureLevelInfos() const { return m_paCultureLevelInfo; } int getNumVictoryInfos() const; CvVictoryInfo& getVictoryInfo(VictoryTypes eVictoryNum) const;