Skip to content

Commit

Permalink
Fix monopoly rounding error (#10308)
Browse files Browse the repository at this point in the history
  • Loading branch information
axatin authored Oct 3, 2023
1 parent 9dafb26 commit 7c2c066
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions CvGameCoreDLL_Expansion2/CvPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39965,12 +39965,12 @@ void CvPlayer::CheckForMonopoly(ResourceTypes eResource)
bool bValid = false;
if (GC.getGame().GetGreatestPlayerResourceMonopoly(eResource) == GetID())
{
if (((iOwnedNumResource * 100) / iTotalNumResource) >= iThreshold && ((iOwnedNumResource * 100) / iTotalNumResource) > GD_INT_GET(GLOBAL_RESOURCE_MONOPOLY_THRESHOLD))
if ((iOwnedNumResource * 100 >= iTotalNumResource * iThreshold) && (iOwnedNumResource * 100 > iTotalNumResource * GD_INT_GET(GLOBAL_RESOURCE_MONOPOLY_THRESHOLD)))
bValid = true;
}
else
{
if (((iOwnedNumResource * 100) / iTotalNumResource) > iThreshold)
if (iOwnedNumResource * 100 > iTotalNumResource * iThreshold)
bValid = true;
}
if (bValid)
Expand All @@ -39995,7 +39995,7 @@ void CvPlayer::CheckForMonopoly(ResourceTypes eResource)
else if(pkResourceInfo->getResourceUsage() == RESOURCEUSAGE_STRATEGIC)
{
//Do we have >25% of this resource under our control?
if(((iOwnedNumResource * 100) / iTotalNumResource) > GD_INT_GET(STRATEGIC_RESOURCE_MONOPOLY_THRESHOLD))
if(iOwnedNumResource * 100 > iTotalNumResource * GD_INT_GET(STRATEGIC_RESOURCE_MONOPOLY_THRESHOLD))
{
if(m_pabHasStrategicMonopoly[eResource] == false)
{
Expand All @@ -40019,12 +40019,12 @@ void CvPlayer::CheckForMonopoly(ResourceTypes eResource)
bool bValid = false;
if (GC.getGame().GetGreatestPlayerResourceMonopoly(eResource) == GetID())
{
if (((iOwnedNumResource * 100) / iTotalNumResource) >= iThreshold && ((iOwnedNumResource * 100) / iTotalNumResource) > GD_INT_GET(GLOBAL_RESOURCE_MONOPOLY_THRESHOLD))
if ((iOwnedNumResource * 100 >= iTotalNumResource * iThreshold) && (iOwnedNumResource * 100 > iTotalNumResource * GD_INT_GET(GLOBAL_RESOURCE_MONOPOLY_THRESHOLD)))
bValid = true;
}
else
{
if (((iOwnedNumResource * 100) / iTotalNumResource) > iThreshold)
if (iOwnedNumResource * 100 > iTotalNumResource * iThreshold)
bValid = true;
}

Expand Down

0 comments on commit 7c2c066

Please sign in to comment.