<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39398 >

The special thing about the fantasy ruleset is that it uses units with
gold upkeep in gold cost.

I realized something was wrong since the mod allows you do build units
and lower your gold past 0 until you reach -70, then units are
disbanded.

The problem is that pay_for_units counts the possible gold that can be
got from improvements later, but it miscounts because it doesn't check
if improvements can actually be sold. This allows the city with palace
to not disband units until money is under 0 gold with could be the
reason for the crash (since new palaces are created after civil war
etc..)

Patch to 2.1 branch attached

Index: server/unittools.c
===================================================================
--- server/unittools.c	(revision 13028)
+++ server/unittools.c	(arbetskopia)
@@ -282,7 +282,9 @@
   int potential_gold = 0;
 
   built_impr_iterate(pcity, pimpr) {
-    potential_gold += impr_sell_gold(pimpr);
+    if (can_city_sell_building(pcity, pimpr)) {
+      potential_gold += impr_sell_gold(pimpr);
+    }
   } built_impr_iterate_end;
 
   unit_list_iterate_safe(pcity->units_supported, punit) {
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to