Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2003:
[Freeciv-Dev] Re: (PR#6802) CMA release does terrible things
Home

[Freeciv-Dev] Re: (PR#6802) CMA release does terrible things

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: bh@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#6802) CMA release does terrible things
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Sun, 9 Nov 2003 04:59:51 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=6802 >

On Sat, Nov 08, 2003 at 12:01:57PM -0800, Benoit Hudson wrote:
> 
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=6802 >
> 
> When the CMA cannot satisfy the constraints for a city, it release the
> city from its control.  This is all well and good.  However, and this is
> very bad, when it does release the city, it doesn't just leave all the
> workers where they are.  Instead, what I see very often is that most of
> the workers become scientists, so my city which was released because CMA
> couldn't guarantee +1 food suddenly has -12 food.  Recovering from this
> is highly annoying if there are any nearby cities: they may suddenly
> have decided to start using one of the released squares, which can cause
> a chain-reaction to arbitrarily far from the first city.
> 
> Note that when you manually release a city, the behaviour as it should
> be: the workers just stay put.

Can you please test the attached patch?

If this patch doesn't make it please upload a savegame to reproduce
this.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  Living on earth may be expensive, but it includes an annual free trip
  around the sun.

Index: client/agents/cma_core.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/agents/cma_core.c,v
retrieving revision 1.49
diff -u -u -r1.49 cma_core.c
--- client/agents/cma_core.c    2003/10/01 09:23:16     1.49
+++ client/agents/cma_core.c    2003/11/09 12:57:05
@@ -510,7 +510,7 @@
 *****************************************************************************/
 static void handle_city(struct city *pcity)
 {
-  struct cm_result result;
+  struct cm_result result, backup;
   bool handled;
   int i, city_id = pcity->id;
 
@@ -521,6 +521,8 @@
   freelog(HANDLE_CITY_LOG_LEVEL2, "START handle city='%s'(%d)",
          pcity->name, pcity->id);
 
+  get_current_as_result(pcity, &backup);
+
   handled = FALSE;
   for (i = 0; i < 5; i++) {
     struct cm_parameter parameter;
@@ -543,6 +545,12 @@
       create_event(pcity->x, pcity->y, E_CITY_CMA_RELEASE,
                   _("CMA: The agent can't fulfill the requirements "
                     "for %s. Passing back control."), pcity->name);
+      if (!apply_result_on_server(pcity, &backup)) {
+       create_event(pcity->x, pcity->y, E_NOEVENT,
+                    _("CMA: Unable to reset %s to the previous state."),
+                    pcity->name);
+      }
+
       handled = TRUE;
       break;
     } else {

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Re: (PR#6802) CMA release does terrible things, Raimar Falke <=