Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

culture level option fix #1397

Merged
merged 1 commit into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions Sources/CvCity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10839,6 +10839,8 @@ void CvCity::updateCultureLevel(bool bUpdatePlotGroups)
{
return;
}
uint32_t iCultureLevel = 0;

CvGameAI& GAME = GC.getGame();

if (!isOccupation()
Expand All @@ -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<CultureLevelTypes>(iCultureLevel), bUpdatePlotGroups);
}


Expand Down
1 change: 1 addition & 0 deletions Sources/CvGlobals.h
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ class cvInternalGlobals

int getNumCultureLevelInfos() const;
CvCultureLevelInfo& getCultureLevelInfo(CultureLevelTypes eCultureLevelNum) const;
const std::vector<CvCultureLevelInfo*>& getCultureLevelInfos() const { return m_paCultureLevelInfo; }

int getNumVictoryInfos() const;
CvVictoryInfo& getVictoryInfo(VictoryTypes eVictoryNum) const;
Expand Down