Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: [PATCH] Corecleanup_07Part1 has been put in incoming
Home

[Freeciv-Dev] Re: [PATCH] Corecleanup_07Part1 has been put in incoming

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rf13@xxxxxxxxxxxxxxxxxxxxxx
Cc: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [PATCH] Corecleanup_07Part1 has been put in incoming
From: Jason Dorje Short <jshort@xxxxxxxxxxxxx>
Date: Sun, 26 Aug 2001 06:39:04 -0400

Raimar Falke wrote:
> 
> On Sat, Aug 25, 2001 at 07:02:22PM -0400, Ross W. Wetmore wrote:
> 
> Please resend the changes you made to server/gotohand.c:dir_ok and
> straightest_direction. They are not simple cleanups.
> 
> Same file:
> -    int dir;
> -    int x, y;
>      struct player *owner = unit_owner(punit);
> -
> -    for (dir = 0; dir < 8; dir++) {
> -      x = map_adjust_x(src_x + DIR_DX[dir]);
> -      y = map_adjust_y(src_y + DIR_DY[dir]);
> -
> +    adjc_dir_iterate(src_x,src_y,x,y,dir) {
>        if (!dir_ok(dest_x, dest_y, punit->goto_dest_x, punit->goto_dest_y, 
> dir))
>         continue;
>        if ((map_get_terrain(x, y) != T_OCEAN)
> -         && is_enemy_unit_tile(map_get_tile(x, y), owner))
> -       return 0;
>               ^^^
> -    }
> +    && is_enemy_unit_tile(map_get_tile(x, y), owner))
> +       return 1;
>               ^^^
> +    } adjc_dir_iterate_end;
>      return 0;
>    }
>  }
> 
> Mistake?

I've looked over this code several times, and right now it all boils
down to "return 0;".  Note that the function it is in (in
server/gotohand.c) has an exact correspondence with a same-name function
in client/gotohand.c...but the server function has this extra code. 
There's a comment saying it's necessary, but it's certainly not doing
anything useful right now.

I'm much more inclined to think the code is buggy as it is now.

jason


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