Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2003:
[Freeciv-Dev] (PR#6260) CM server bug: "Minas Anor is illegal"
Home

[Freeciv-Dev] (PR#6260) CM server bug: "Minas Anor is illegal"

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: paul@xxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#6260) CM server bug: "Minas Anor is illegal"
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 6 Oct 2003 12:01:22 -0700
Reply-to: rt@xxxxxxxxxxxxxx

Jason Short wrote:
> See also PR#3546, which is practically the same bug for the old
> auto_arrange_workers, AFAICT.

More clarification: the bug appears to happen because the tile status 
map (pcity->worked) is not updated in some rare cases.  This was the 
same as the old PR#3546 bug.  The solution there was to go straight to 
the source and call city_can_work_tile() to verify availability.  But 
AFAIK we never tracked down the actual cause of the invalid tile status 
map.  For the current bug, we can't call city_can_work_tile() because 
this would have to be called within the CM (common) code but it is a 
server-only function.  So a real solution is probably desirable.

However, the code structure does not lend itself to an easy solution. 
The problem is that the server is exporting the allocation of workers to 
the AI code, but it CANNOT do this with the check for tile availability. 
  Thus I'd suggest that the current C_TILE_*** enum be split into two 
booleans, 'available' and 'worked'.  So we'd have something like

   struct city {
     /* ... */
     struct {
       bool available, worked;
     } worked[CITY_MAP_SIZE][CITY_MAP_SIZE];
   };

so that 'available' can be recalculated whenever it's needed, and 
whenever availability changes auto_arrange_workers can be called to do 
the AI-style reassigning of workers.  The possibility for recursion 
should be removed in the process.

Problem is, this is likely to take a lot of code.

jason




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