Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: [PATCH] map_adjust_* patch

[Freeciv-Dev] Re: [PATCH] map_adjust_* patch

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [PATCH] map_adjust_* patch
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 31 Aug 2001 14:44:41 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Fri, Aug 31, 2001 at 02:13:02AM -0400, Jason Dorje Short wrote:
> Again in the spirit of small, focused patches:
> This patch replaces a number of uses of map_adjust_x/map_adjust_y with
> the corresponding normalize_map_pos/is_real_tile call.  For the most
> part it only covers the simple ones; there are some replacements that
> will be much more tricky (and some that will be impossible).  I've also
> tried to stay away from the instances that should be replaced by a
> different macro, for instance the adjc_iterate loops.  This is only a
> fraction of the total uses of map_adjust_*.
> It applies to current CVS.  It ran a collection of automated games
> yesterday without trouble.  Each instance of replacement (or, at a
> minimum, each file) should be independent and can be applied separately
> if there's any doubt.  (In fact, rather than wait while we argue about
> specific instances these instances might as well just be skipped.  There
> are plenty of other map_adjust_* instances for them to be lumped in with
> later.)

> +    /* FIXME: this check will not work with an orthogonal map */
> +    cardinal_move = (x1 == x2) || (y1 == y2);

Can you make make a is_cardinal_step please.

Overall I like it. Especially the extra asserts. Any objections?

What about this as a next step?

$ grep -Ir "<.*0.*.>*.*map.*ysize" .
./ChangeLog:    Fix map generator >=2 to check if tiles have y<0 or y>=map.ysize
./client/control.c:    if(y<0 || y>=map.ysize)
./client/gui-gtk/dialogs.c:  if (y < 0 || y >= map.ysize) {
./client/gui-xaw/dialogs.c:  if (y < 0 || y >= map.ysize) {
./common/map.c:  if (*y < 0 || *y >= map.ysize)
./common/map.h:  (((Y)<0) ? 0 : (((Y)>=map.ysize) ? map.ysize-1 : (Y)))
./server/barbarian.c:  if( y < 0 || y >= map.ysize ||
./server/barbarian.c:  if( y < 0 || y >= map.ysize ||
./server/mapgen.c:  if (y<0 || y>=map.ysize)              return 0;
./server/mapgen.c:  if( map.xsize < 40 || map.ysize < 40 || map.landpercent>80 )
./server/maphand.c:  if (y < 0 || y >= map.ysize) {
./server/unittools.c:  if (y < 0 || y >= map.ysize) {


 email: rf13@xxxxxxxxxxxxxxxxx
 "The very concept of PNP is a lovely dream that simply does not translate to
  reality. The confusion of manually doing stuff is nothing compared to the
  confusion of computers trying to do stuff and getting it wrong, which they
  gleefully do with great enthusiasm." 
    -- Jinx Tigr in the SDM

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