Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2003:
[Freeciv-Dev] Re: (PR#4331) Bug in cm.c
Home

[Freeciv-Dev] Re: (PR#4331) Bug in cm.c

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: per@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#4331) Bug in cm.c
From: "rwetmore@xxxxxxxxxxxx" <rwetmore@xxxxxxxxxxxx>
Date: Tue, 10 Jun 2003 05:41:47 -0700
Reply-to: rt@xxxxxxxxxxxxxx

C_TILE_UNAVAILABLE is the correct designation for an unreal tile. This should
be (correctly) ignored in all citymap vs citymap_checked operations.

Introducing core dumps into correctly functionning programs purely for spurious
reasons is always a dumb idea. Most of Freeciv cores in the last year or so have
been caused by such poor coding practices that have broken functionning code and
then gone on to make the breakage a feature.

Cheers,
RossW
=====

Per I. Mathisen wrote:
> On Sun, 8 Jun 2003, Raimar Falke wrote:
> 
>>>From cm3.diff:
>>
>>+  city_map_iterate(x, y) {
>>+    if (result->worker_positions_used[x][y]) {
>>+      assert(pcity->city_map[x][y] == C_TILE_EMPTY
>>+           || pcity->city_map[x][y] == C_TILE_WORKER);
>>+    }
>>+  } city_map_iterate_end;
>>
>>This is obviously incorrect as it doesn't handle unreal map
>>position. So use city_map_checked_iterate or my_city_map_iterate
>>(which leaves out the center). Was this the problem/error?!
> 
> 
> Yes. I guess my question is: Shouldn't the unreal tiles be set to a value
> which does not produce erronous core dumps? ie set them to C_TILE_EMPTY.
>>From my reading of cm.c, this is what the original, default value is, but
> it gets set to C_TILE_UNAVAILABLE for some reason. That is wrong, let it
> core when you try to _use_ the unreal position - that you way you can see
> what the problem is instead of blaming CM.
> 
>   - Per




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