Author: sveinung
Date: Sun Dec  6 10:13:50 2015
New Revision: 30863

URL: http://svn.gna.org/viewcvs/freeciv?rev=30863&view=rev
Log:
Make payment trigger gold balance unit "selling".

Unit gold upkeep is payed at one point. At a later point, if the gold now
is negative, the game will try to "balance" the gold by removing the unit
and taking back the already payed upkeep. This is called "selling" it.

Make a unit a candidate for selling based on the upkeep that actually was
payed for it rather than what its current upkeep is.

See patch #6649

Modified:
    trunk/server/cityturn.c

Modified: trunk/server/cityturn.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/cityturn.c?rev=30863&r1=30862&r2=30863&view=diff
==============================================================================
--- trunk/server/cityturn.c     (original)
+++ trunk/server/cityturn.c     Sun Dec  6 10:13:50 2015
@@ -2566,8 +2566,9 @@
   /* Check if unit is transporting other units from punitlist,
    * and sell one of those (recursively) instead. */
   unit_list_iterate(unit_transport_cargo(punit), pcargo) {
-    if (pcargo->upkeep[O_GOLD] > 0) { /* Optimization, do not iterate over 
punitlist
-                                       * if we are sure that pcargo is not in 
it. */
+    /* Optimization, do not iterate over punitlist
+     * if we are sure that pcargo is not in it. */
+    if (pcargo->server.upkeep_payed[O_GOLD] > 0) {
       unit_list_iterate(punitlist, p2) {
         if (pcargo == p2) {
           unit_list_append(cargo, pcargo);
@@ -2640,7 +2641,7 @@
     } city_built_iterate_end;
 
     unit_list_iterate(pcity->units_supported, punit) {
-      if (punit->upkeep[O_GOLD] > 0) {
+      if (punit->server.upkeep_payed[O_GOLD] > 0) {
         uk_rem_gold_append(punit);
       }
     } unit_list_iterate_end;
@@ -2689,7 +2690,7 @@
 
   city_list_iterate(pplayer->cities, pcity) {
     unit_list_iterate(pcity->units_supported, punit) {
-      if (punit->upkeep[O_GOLD] > 0) {
+      if (punit->server.upkeep_payed[O_GOLD] > 0) {
         uk_rem_gold_append(punit);
       }
     } unit_list_iterate_end;
@@ -2775,7 +2776,7 @@
 
   /* Create a vector of all supported units with gold upkeep. */
   unit_list_iterate(pcity->units_supported, punit) {
-    if (punit->upkeep[O_GOLD] > 0) {
+    if (punit->server.upkeep_payed[O_GOLD] > 0) {
        uk_rem_gold_append(punit);
      }
   } unit_list_iterate_end;


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to