Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2002:
[Freeciv-Dev] Re: goto_is_sane() is insane (PR#2131)
Home

[Freeciv-Dev] Re: goto_is_sane() is insane (PR#2131)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Sylvain Tricot <sylvaintricot@xxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx, <bugs@xxxxxxxxxxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: goto_is_sane() is insane (PR#2131)
From: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Sat, 5 Oct 2002 14:59:42 +0100 (BST)

Sylvain,

I agree with you.  Do you want to make a patch?  

If you do, please put comments explaining the logic behind the check.  
You could also go for a rewrite, moving
        if (!omni && !map_get_known_and_seen(x, y, pplayer))
check to the top, converting the whole structure to 
        switch(unit_type(punit)->move_type)
and substituting the ugly possible++ with just return TRUE;

These are my personal recommendations, of course.

G.

On Fri, 4 Oct 2002, Sylvain Tricot wrote:

> goto_is_sane() is insane in /freeciv-1.13.0/server/gotohand.c :
> 
> in function: goto_is_sane()
> 1213:
>       if (ground_unit_transporter_capacity(x, y, pplayer) > 0) {
>       adjc_iterate(punit->x, punit->y, tmp_x, tmp_y) {
>         if (map_get_continent(tmp_x, tmp_y) == map_get_continent(x, y))
>           possible++;
>       } adjc_iterate_end;
>       }
> 
> was same in /freeciv-1.10.0 :

You probably meant "was sane in 1.10" :)

G.

>       if (is_transporter_with_free_space(pplayer, x, y)) {
>         for (k = 0; k < 8; k++) {
>           if (map_get_continent(punit->x, punit->y) ==
>               map_get_continent(x + ii[k], y + jj[k]))
>             possible++;
>         }
>       }
> 
> correction:
>       if (ground_unit_transporter_capacity(x, y, pplayer) > 0) {
>       adjc_iterate(x, y, tmp_x, tmp_y) {
>         if (map_get_continent(tmp_x, tmp_y) == map_get_continent(punit->x, 
> punit->y))
>           possible++;
>       } adjc_iterate_end;
>       }
> /*************************************************************************/
> 
> 
> 
> 



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