Complete.Org: Mailing Lists: Archives: freeciv-ai: September 2003:
[freeciv-ai] Re: (PR#6236) Bug in CM

[freeciv-ai] Re: (PR#6236) Bug in CM

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [freeciv-ai] Re: (PR#6236) Bug in CM
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 22 Sep 2003 07:47:10 -0700
Reply-to: rt@xxxxxxxxxxxxxx

Per I. Mathisen wrote:
> On Sun, 21 Sep 2003, Jason Short wrote:
>>>Valgrind gives this fairly often for the server:
>>>==13287==  at 0x8067A58: auto_arrange_workers (cityturn.c:235)
> ...
>>>Could relate to PR#6222, but I doubt it (this is just an invalid read).
>>>This may have been reported before. We really need to fix it.
>>The culprit is the worker_positions_used field. In the client this is
>>memset to 0 before it is used. In the server it's not.
> I don't see why it should be. cm_query_result() shouldn't give us a
> cm_result struct with unset data in it. So the bug must be in CM.
> I looked at this briefly but found nothing. Raimar?

my_city_map_iterate skips the center tile.

We should also remove the memset from the client cma code, I suspect.


? rc
Index: common/aicore/cm.c
RCS file: /home/freeciv/CVS/freeciv/common/aicore/cm.c,v
retrieving revision 1.10
diff -u -r1.10 cm.c
--- common/aicore/cm.c  2003/09/20 19:24:54     1.10
+++ common/aicore/cm.c  2003/09/22 15:37:27
@@ -790,10 +790,10 @@
-  my_city_map_iterate(pcity, x, y) {
+  city_map_checked_iterate(pcity->x, pcity->y, x, y, mx, my) {
     result->worker_positions_used[x][y] =
        (base_combination->worker_positions[x][y] == C_TILE_WORKER);
-  } my_city_map_iterate_end;
+  } city_map_checked_iterate_end;
   result->scientists = scientists;
   result->taxmen = taxmen;

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