Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2004:
[Freeciv-Dev] Re: (PR#9637) Ocean numbers
Home

[Freeciv-Dev] Re: (PR#9637) Ocean numbers

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory.Berkolaiko@xxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#9637) Ocean numbers
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 9 Aug 2004 09:42:11 -0700
Reply-to: rt@xxxxxxxxxxx

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

Gregory Berkolaiko wrote:

> Index: server/sanitycheck.c
> ===================================================================
> RCS file: /home/freeciv/CVS/freeciv/server/sanitycheck.c,v
> retrieving revision 1.45
> diff -u -r1.45 sanitycheck.c
> --- server/sanitycheck.c      27 Jul 2004 16:43:48 -0000      1.45
> +++ server/sanitycheck.c      9 Aug 2004 12:51:17 -0000
> @@ -103,10 +103,15 @@
>      struct tile *ptile = map_get_tile(x, y);
>      struct city *pcity = map_get_city(x, y);
>      int cont = map_get_continent(x, y);
> +
> +    assert(cont != 0);
>      if (is_ocean(map_get_terrain(x, y))) {
> -      assert(cont == 0);
> +      adjc_iterate(x, y, x1, y1) {
> +     if (is_ocean(map_get_terrain(x1, y1))) {
> +       assert(map_get_continent(x1, y1) == cont);
> +     }
> +      } adjc_iterate_end;
>      } else {
> -      assert(cont != 0);
>        adjc_iterate(x, y, x1, y1) {
>       if (!is_ocean(map_get_terrain(x1, y1))) {
>         assert(map_get_continent(x1, y1) == cont);

I changed this part to

   if (is_ocean(...)) {
     assert(cont < 0);
     ...
   } else {
     assert(cont > 0);
     ...
   }

but this exposed some problems still in the code.  map_get_continent 
still returns an unsigned short so the first assertion quickly fails.  I 
think we should have a "typedef signed short Continent_id;" somewhere 
and use this in more places.

jason




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