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: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>
Date: Sun, 26 Aug 2001 10:23:00 -0400

At 12:30 PM 01/08/26 +0200, 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.

Drop them and I will add them to the next round.

>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?

The loop is totally worthless if you return the same condition inside
vs when you leave it.

Yes, there is a mistake here ...

>I'm also not happy with the other changes you made to
>server/gotohand.c. Yes I know some of the functions are very ugly. Can
>you split your changes to a real cleanup one and another one which
>does the rest of your algorithmic changes? So we get more eyes on the
>latter one.
>
>       Raimar
>-- 
> email: rf13@xxxxxxxxxxxxxxxxx
>  "Windows is the one true OS. MS invented the GUI. MS invented 
>   the 32 bit OS. MS is open and standard. MS loves you. We have 
>   always been at war with Oceana."

Cheers,
RossW
=====



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