I have been programming for about 3 weeks now and I'm making this civ game. The only problem is during each round, your stats for civ update each round but after the second round, they do not update. Basically what I want the program to do is add up each of resources after each round and calculate the population and gold, but it's not happening after the first round. I have never gotten classes to work, so don't expect me to get it right the first time.
Here is the code for the update that should happen each round inside the function:
int RoundTotal(int yg, int yk, int yf, int ys, int yr, int yfi,
int co, int rtp, int gtp, int ap, double tr, int yp, int dp,
int int yd, double fp) {
int YourGold = yg, YourStrength = ys, YourKnow = yk, YourFood = yf,
YourResource = yr, YourFields = yfi, YourPopulation = yp, YourDefense = yd;
int ResourceTradeProfit = rtp, GoldTradeProfit = gtp, DroughtProduction = dp;
int totals, count = co, ArcherPay = ap;
double taxrate = tr, FoodProduction = fp;
if (YourStrength<0) {
YourStrength = 0;
}
FoodProduction = (0.5*YourFields + 0.5*YourKnow - 0.02*YourPopulation)*DroughtProduction;
YourFood = YourFood + FoodProduction;
YourGold = YourGold + (taxrate/100)*YourPopulation;
YourGold -= (YourStrength / 2);
YourGold -= YourKnow;
YourGold -= YourFood;
YourGold -= ArcherPay;
YourResource += ResourceTradeProfit;
YourGold += GoldTradeProfit;
YourPopulation = YourPopulation + YourFood*FoodProduction;
return totals, YourGold, YourKnow, YourFood, YourStrength,
YourResource, YourFields, count, ResourceTradeProfit,
GoldTradeProfit, ArcherPay, taxrate, YourPopulation,
DroughtProduction, FoodProduction;
Disregard all of the abbreviations for the variables up top, unless they are the problem.