Complete.Org: Mailing Lists: Archives: freeciv-dev: March 1999:
[Freeciv-Dev] Settlers can mine and irrigate a tile at the same time.
Home

[Freeciv-Dev] Settlers can mine and irrigate a tile at the same time.

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Settlers can mine and irrigate a tile at the same time.
From: Andrew Donkin <ard@xxxxxxxxxxxxxxxxxx>
Date: 05 Mar 1999 08:38:47 +1300

1: You can put two settlers on a tile then set one mining and the other
   irrigating.  Both processes run to completion, so whichever finishes
   last has the final effect.  A patch to prevent one order when another
   is being carried out follows, but it gives no explanation to the
   user.

2: If you let a settler work on a terrain tile for some turns, then stop
   and restart it, its activity count is reset to zero and it must start
   again.  Is this desirable?  After irrigating a jungle four 14 turns it
   would be a wrist-slitting event to accidentally click on your
   settler.

   Similarly, it would be handy to half-irrigate a tile, pop off for a
   spot of road building or to avoid an enemy navy, then recommence the
   irrigation.  Does Civ ("PayCiv"?) allow this?




--- freeciv/common/unit.c       Thu Feb 25 11:11:53 1999
+++ freeciv.ard/common/unit.c   Fri Mar  5 08:28:45 1999
@@ -682,16 +682,32 @@
            get_invention(pplayer, A_BRIDGE)==TECH_KNOWN);

   case ACTIVITY_MINE:
-    return unit_flag(punit->type, F_SETTLERS) && punit->moves_left &&
-           type->mining_result!=T_LAST && !(ptile->special&S_MINE);
+    /* Don't allow it if someone else is irrigating this tile.
+     *Do* allow it if they're transforming - the mine may survive */
+    if (unit_flag(punit->type, F_SETTLERS) && punit->moves_left &&
+       type->mining_result!=T_LAST && !(ptile->special&S_MINE)) {
+      unit_list_iterate(ptile->units, tunit) {
+       if(tunit->activity==ACTIVITY_IRRIGATE) return 0;
+       unit_list_iterate_end;
+      }
+      return 1;
+    } else return 0;

   case ACTIVITY_IRRIGATE:
-    return unit_flag(punit->type, F_SETTLERS) && punit->moves_left &&
+    /* Don't allow it if someone else is mining this tile.
+     *Do* allow it if they're transforming - the irrigation may survive */
+    if (unit_flag(punit->type, F_SETTLERS) && punit->moves_left &&
           !(ptile->special&S_IRRIGATION) &&
           ( (ptile->terrain==type->irrigation_result &&
              is_water_adjacent_to_tile(punit->x, punit->y)) ||
             (ptile->terrain!=type->irrigation_result &&
-             type->irrigation_result!=T_LAST));
+             type->irrigation_result!=T_LAST))) {
+      unit_list_iterate(ptile->units, tunit) {
+       if(tunit->activity==ACTIVITY_MINE) return 0;
+       unit_list_iterate_end;
+      }
+      return 1;
+    } else return 0;

   case ACTIVITY_FORTIFY:
     return is_ground_unit(punit) && punit->moves_left && 


[Prev in Thread] Current Thread [Next in Thread]