Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: Remove map_adjust_[xy] invocations from server (PR#100
Home

[Freeciv-Dev] Re: Remove map_adjust_[xy] invocations from server (PR#100

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: Remove map_adjust_[xy] invocations from server (PR#1003)
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 12 Oct 2001 13:54:40 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Fri, Oct 12, 2001 at 07:08:30AM -0400, Jason Dorje Short wrote:
> Raimar Falke wrote:
> > 
> > On Fri, Oct 12, 2001 at 05:40:13AM -0400, Jason Dorje Short wrote:
> 
> <snip...>
> 
> > > Upon further reflection, I really like the following change that unifies
> > > check_coords with CHECK_MAP_POS.
> > >
> > > Though we may want to rename the function check_map_pos().  It could
> > > also be made a macro, if desired.
> 
> <snip...>
> 
> > Rewrite it and change the name. However note that I'm still not sure
> > if this is the way to go. check_map_pos has a function call overhead
> > we don't want. So the first step in all cases is the introduction of
> > CHECK_MAP_POS. We can then argue how CHECK_MAP_POS should be
> > implemented and if it should segv or not.
> 
> Unfortunately, the following macro
> 
> #define CHECK_MAP_POS(x, y)         \
> do {                                \
>   if (!is_normal_map_pos(*x, *y)) { \
>     assert(0);                      \
>     if (!normalize_map_pos(x, y)) { \
>       abort();                      \
>     }                               \
>   }                                 \
> } while(0)
> 
> Does not seem like it will work inside map_inx:
> 
> #define map_inx(x,y) \
>   (CHECK_MAP_POS(&x, &y), (x)+(y)*map.xsize)

This isn't need IMHO since I think we should separately control the
check in map_inx. Something like:

#define map_inx(x,y) \
   (is_normal_map_pos(x,y)? (x)+(y)*map.xsize): x/0)

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "These download files are in Microsoft Word 6.0 format. After
  unzipping, these files can be viewed in any text editor, including
  all versions of Microsoft Word, WordPad, and Microsoft Word Viewer."
    -- http://www.microsoft.com/hwdev/pc99.htm


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