Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2005:
[Freeciv-Dev] (PR#11497) server freeze on 2.0 beta5
Home

[Freeciv-Dev] (PR#11497) server freeze on 2.0 beta5

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: sj@xxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#11497) server freeze on 2.0 beta5
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Sun, 13 Feb 2005 00:51:18 -0800
Reply-to: bugs@xxxxxxxxxxx

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

> > > > 1: Workers at 24,68 (Plains) has activity Irrigation, which it
can't 
> > > > continue!
> > > 
> > > This is because another worker has changed the only adjacent irrigated
> > > tile into forest.
> > 
> > Don't think it's that, I didn't have anything but irrigate (grassland 
> > and plains), clean pollution and road/railroad running. Anyways mine 
> > doesn't appear to crash due to that either:
> > 1: Workers at 24,68 (Plains) has activity Irrigation, which it can't 
> > continue!
> > Game saved as europe+1510.sav.gz
> (24,68) is in Spain.
> 
Here's a patch that stops irrigation when it is no longer possible to
continue.
--
mateusz
Index: unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.318
diff -u -r1.318 unittools.c
--- unittools.c 5 Feb 2005 07:41:54 -0000       1.318
+++ unittools.c 13 Feb 2005 08:44:25 -0000
@@ -590,6 +590,7 @@
   enum unit_activity activity = punit->activity;
   enum ocean_land_change solvency = OLC_NONE;
   struct tile *ptile = punit->tile;
+  bool check_adjacent_units = FALSE;
   
   if (activity != ACTIVITY_IDLE && activity != ACTIVITY_FORTIFIED
       && activity != ACTIVITY_GOTO && activity != ACTIVITY_EXPLORE) {
@@ -634,6 +635,7 @@
          map_clear_special(punit->tile, what);
          update_tile_knowledge(punit->tile);
          set_unit_activity(punit, ACTIVITY_IDLE);
+         check_adjacent_units = TRUE;
        }
 
        /* If a watchtower has been pillaged, reduce sight to normal */
@@ -756,6 +758,7 @@
       map_mine_tile(punit->tile);
       solvency = check_terrain_ocean_land_change(punit->tile, old);
       unit_activity_done = TRUE;
+      check_adjacent_units = TRUE;
     }
   }
 
@@ -766,6 +769,7 @@
       map_transform_tile(punit->tile);
       solvency = check_terrain_ocean_land_change(punit->tile, old);
       unit_activity_done = TRUE;
+      check_adjacent_units = TRUE;
     }
   }
 
@@ -779,6 +783,17 @@
     } unit_list_iterate_end;
   }
 
+  /* Some units nearby can not continue irrigating */
+  if (check_adjacent_units) {
+    adjc_iterate(punit->tile, ptile2) {
+      unit_list_iterate(ptile2->units, punit2) {
+        if (!can_unit_continue_current_activity(punit2)) {
+          handle_unit_activity_request(punit2, ACTIVITY_IDLE);
+        }
+      } unit_list_iterate_end;
+    } adjc_iterate_end;
+  }
+
   if (activity==ACTIVITY_FORTIFYING) {
     if (punit->activity_count >= 1) {
       set_unit_activity(punit,ACTIVITY_FORTIFIED);

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