--- common/city.c.orig 2002-08-16 14:20:01.000000000 +0200 +++ common/city.c 2002-08-16 14:22:53.000000000 +0200 @@ -1518,10 +1518,12 @@ static void set_tax_income(struct city *pcity) { int sci = 0, tax = 0, lux = 0, rate; + double sci_rest, tax_rest, lux_rest; int sci_rate = city_owner(pcity)->economic.science; int lux_rate = city_owner(pcity)->economic.luxury; int tax_rate = 100 - sci_rate - lux_rate; + pcity->science_total = 0; pcity->luxury_total = 0; pcity->tax_total = 0; @@ -1533,30 +1535,81 @@ } } + /* ANARCHY */ + if (get_gov_pcity(pcity)->index == game.government_when_anarchy) { + sci_rate = 0; + lux_rate = 100; + tax_rate = 100 - sci_rate - lux_rate; + } + + /* hare/niemeyer */ + /* distributes the whole-numbered part */ + sci = rate * sci_rate / 100; + tax = rate * tax_rate / 100; + lux = rate * lux_rate / 100; + + pcity->science_total+=sci; + pcity->tax_total+= tax; + pcity->luxury_total+=lux; + + /* this distributes the small rest */ + sci_rest = rate * sci_rate / 100.00 - sci; + tax_rest = rate * tax_rate / 100.00 - tax; + lux_rest = rate * lux_rate / 100.00 - lux; + + rate -= (sci + tax + lux); + while (rate > 0) { - if (get_gov_pcity(pcity)->index != game.government_when_anarchy) { - tax += tax_rate; - sci += sci_rate; - lux += lux_rate; - } else { /* ANARCHY */ - lux += 100; - } - if (tax >= 100 && rate > 0) { - tax -= 100; - pcity->tax_total++; + if (sci_rest > lux_rest && sci_rest > tax_rest){ + pcity->science_total++; + sci_rest=0; rate--; } - if (sci >= 100 && rate > 0) { - sci -= 100; - pcity->science_total++; + if (tax_rest > sci_rest && tax_rest > lux_rest && rate > 0){ + pcity->tax_total++; + tax_rest=0; rate--; } - if (lux >= 100 && rate > 0) { - lux -= 100; + if (lux_rest > tax_rest && lux_rest > sci_rest && rate > 0){ pcity->luxury_total++; + lux_rest=0; rate--; } + if (sci_rest==tax_rest && sci_rest > lux_rest && rate > 0){ + if (sci < tax){ + pcity->science_total++; + sci_rest=0; + rate--; + } else { + pcity->tax_total++; + tax_rest=0; + rate--; + } + } + if (sci_rest==lux_rest && sci_rest > tax_rest && rate > 0){ + if (sci < lux){ + pcity->science_total++; + sci_rest=0; + rate--; + } else { + pcity->luxury_total++; + lux_rest=0; + rate--; + } + } + if (tax_rest==lux_rest && tax_rest > sci_rest && rate > 0){ + if (tax < lux){ + pcity->tax_total++; + tax_rest=0; + rate--; + } else { + pcity->luxury_total++; + lux_rest=0; + rate--; + } + } } + pcity->luxury_total += (pcity->ppl_elvis * 2); pcity->science_total += (pcity->ppl_scientist * 3); pcity->tax_total +=