You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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);
}
}
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: