Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: grid causes assertion failure (PR#919)
Home

[Freeciv-Dev] Re: grid causes assertion failure (PR#919)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rf13@xxxxxxxxxxxxxxxxxxxxxx
Cc: jjm@xxxxxxxxxxxx, freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: grid causes assertion failure (PR#919)
From: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>
Date: Wed, 29 Aug 2001 20:47:32 -0400

At 10:20 AM 01/08/29 +0200, Raimar Falke wrote:
>On Tue, Aug 28, 2001 at 05:06:25PM -0700, jjm@xxxxxxxxxxxx wrote:
>> Full_Name: Jeff Mallatt
>> Version: CVS 2001-08-28
>> Distribution: Built from source
>> Client: Both (or N/A)
>> OS: Linux RedHat 7.1
>> Submission from: (NULL) (206.40.164.244)
>> 
>> 
>> Trying to turn on the Grid in either client causes the following
>> assertion failure:
>> 
>> civclient: climisc.c:490: get_grid_color:
>>    Assertion `is_tiles_adjacent(x1, y1, x2, y2)' failed.
>> Aborted (core dumped)
>> 
>> This does not happen all the time.  Though I haven't proven this, I
>> believe it may only happen when the grid being displayed intersects
>> the 0/max X boundary.
>
>Known. It is on my todo list "- get_grid_color and normalized coord
>(BUG)" and simple but I haven't found the time yet.
>
>       Raimar
>
>-- 
> email: rf13@xxxxxxxxxxxxxxxxx
> "I haven't lost my mind - it's backed up on tape somewhere."

If the coordinates are not normalized, probably because an abs_x0+1
is being passed in, the adjacent will fail over the WRAP_X wall.

Adding normalization to this function should make this go away.

Tracking down all the places that call the above and forcing them 
to normalize first is the other option, but this is something that 
should probably be done as part of a larger effort and not a series 
of bug responses. Freeciv code really doesn't treat passed arguments
as normalized, and thus the short term fix is to test at the lowest
level.

Cheers,
RossW
=====

int is_tiles_adjacent(int x0, int y0, int x1, int y1)
{
>>  normalize_map_pos(&x1, &y1);
  adjc_iterate(x0, y0, x, y) {
    if (x == x1 && y == y1)
      return 1;
  } adjc_iterate_end;

  return 0;
}
   



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