Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2004:
[Freeciv-Dev] (PR#11154) client has unrefreshed cities
Home

[Freeciv-Dev] (PR#11154) client has unrefreshed cities

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11154) client has unrefreshed cities
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 23 Nov 2004 12:02:39 -0800
Reply-to: rt@xxxxxxxxxxx

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

> [jdorje - Tue Nov 23 05:05:43 2004]:
> 
> When cm_query_result is called on a city by the *client*, it is 
> sometimes called on an unrefreshed city.  In this case 
> pcity->science_bonus == 100, instead of having the correct value. 
> Calling generic_city_refresh at the start of cm_query_result seems to 
> fix it but there should be a better way.

Here's a patch.  It's easy enough to add an assertion here to verify
that this actually does change (among other things) pcity->science_bonus.

This speeds up the CM slightly at the client: 0.7s instead of 0.8s in my
test.

jason

Index: common/aicore/cm.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/aicore/cm.c,v
retrieving revision 1.44
diff -u -r1.44 cm.c
--- common/aicore/cm.c  19 Nov 2004 02:31:35 -0000      1.44
+++ common/aicore/cm.c  23 Nov 2004 20:01:50 -0000
@@ -1825,6 +1825,11 @@
 {
   struct cm_state *state = cm_init_state(pcity);
 
+  /* FIXME: there's a bug in the client causing cm_query_result to be called
+   * on unrefreshed cities.  To avoid problems we just call refresh once
+   * here to start. */
+  generic_city_refresh(pcity, FALSE, 0);
+
   cm_find_best_solution(state, param, result);
   cm_free_state(state);
 }

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