Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] Re: [Patch] Special testing
Home

[Freeciv-Dev] Re: [Patch] Special testing

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Petr Baudis <pasky@xxxxxxxxxxx>, rf13@xxxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [Patch] Special testing
From: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Date: Sat, 16 Feb 2002 18:59:36 +0000 (GMT)

 --- Petr Baudis <pasky@xxxxxxxxxxx> wrote: 

=============================================================
> RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
> retrieving revision 1.112
> diff -u -r1.112 map.c
> --- common/map.c      2002/02/14 15:17:14     1.112
> +++ common/map.c      2002/02/16 16:19:19
> @@ -480,29 +480,29 @@
>      /* range 0 .. 5 , 2 standard */
>  
>    case T_FOREST:
> -    if (map_get_tile(x, y)->special) return 5;
> +    if (map_has_special(x, y, S_ALL)) return 5;
>      return 3;
..snip..

Will this work? In fact, I can't imagine how this would.. The same issue 
as with the binary or, IMHO. We mut either add a special case for S_ALL
in 
map_has_special(), introduce another function for this 
(map_has_any_special()), or remove the assert etc from the
map_has_special 
and allow testing for more specials at once (which breaks encapsulation 
again).

=================================================

It will definitely break the assert in contains_specail if there is
anything special on the tile at all...
Testing?

I would do it this way:
return (map_get_specail(x,y) == S_NO_SPECIAL ? 3 : 5);

It's slightly conceptually wrong, but I like it.  To make it better, you
can take S_NO_SPECIAL outside enum, like S_ALL...

Best,
G.


__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com


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