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

Total country is added to itself in countTotals method resulting in inflated world pop and GDP values #28

Open
iak10 opened this issue Apr 27, 2024 · 1 comment

Comments

@iak10
Copy link

iak10 commented Apr 27, 2024

In Report.Java the countTotals method sums the values of all the existing countries in the game by iterating through the countryList and adding them to the totalCountry.
The issue is that the list it's iterating through contains the total country and so at some point the totalCountry will be added to itself, rather than just adding the existing countries. The total country should be removed from the countryList while this loop executes or a check could take place in the loop to avoid adding the totalCountry to itself.

for (Country country : countryList) {
            // calculating real totalSupply (without wasted)
            country.innerCalculations();
            totalCountry.add(country);

            for (ProductStorage storage : country.getStorage().values()) {
                ProductStorage totalStorage = totalCountry.findStorage(storage.product);
                totalStorage.add(storage);
            }
        }
@LeonDev5
Copy link

LeonDev5 commented Oct 9, 2024

Any way to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants