Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: Profile.
Home

[Freeciv-Dev] Re: Profile.

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gaute B Strokkenes <gs234@xxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Profile.
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 6 Oct 2001 09:47:35 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Sat, Oct 06, 2001 at 12:09:50AM +0100, Gaute B Strokkenes wrote:
> 
> >> > #define CHECK_MAP_POS(x,y) do{\
> >> >     int dx = x, dy = y; \
> >> >     assert(normalize_map_pos(&dx, &dy)); \
> >> >     assert(x == dx && y == dy); \
> >> >   } while(0)
> >> 
> >> Are you aware of check_coords() ?
> > 
> > No but this is another function call. And it doesn't assert or abort
> > or exit. I don't want an error message I want a core dump. Such
> > problems are errors.
> 
> Yes, but there still shouldn't be two ways to do (almost) exactly the
> same thing.

There is another proposed method for this issue:
is_normal_map_pos. This would turn CHECK_MAP_POS into
"assert(is_normal_map_pos(x,y))"

> >> > So map_get_tile would be like:
> >> > 
> >> > struct tile *map_get_tile(int x, int y)
> >> > {
> >> >   CHECK_MAP_POS(x,y);
> >> > 
> >> >   return map.tiles + map_inx(x, y);
> >> > }
> >> > 
> >> > CHECK_MAP_POS can now check for 
> >> >  - un-real map position or for
> >> >  - non-normal(ized) map positions or
> >> >  - can be a noop
> >> 
> >> This is very similar to what I've been thinking about.  However, I
> >> think we should embedded this in map_inx() instead.  I think that
> >> would be a lot less intrusive and probably more thorough.
> > 
> > Problem is: map_inx isn't used much.
> 
> That is a bug which can and should be fixed.  Viz. the recent
> discussion about isometric view, and so on.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
    1) Customers cause problems.
    2) Marketing is trying to create more customers.
  Therefore:
    3) Marketing is evil.


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