Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2001:
[Freeciv-Dev] Re: [Patch] MAPSTEP
Home

[Freeciv-Dev] Re: [Patch] MAPSTEP

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>
Cc: freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: [Patch] MAPSTEP
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 22 Sep 2001 22:26:00 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Sat, Sep 22, 2001 at 03:26:19PM -0400, Ross W. Wetmore wrote:
> It looks good. Nice work.
> 
> Minor change, you should pass (int *) as the first two arguments, and
> not ints. This does two things: 
> 
> 1) it alerts people to the fact that these are LValues to be returned, 
> 
> 2) more importantly, it makes the macro and functional form equivalent, 
>    so if you ever move to a more complex system, all you need to do is
>    remove the macro definition.
> 
> In anticipation of such a change, it might not be bad to make the names
> look more like functions when you change the two arguments, i.e.
>  _mapstep(px, py, dir)
>   mapstep(px, py, x0, y0, dir)
> Note this makes it much more equivalent in form to normalize_map_pos() 
> which is not bad, since this is really a normalize adjacent position.

You may not believe it but I have considered this for the same
reasons. I think that the MAPSTEP code is used a lot of times. To
dodge a discussion about performance I just made it a macro. After
patching there are only 5 uses of _MAPSTEP and 15 uses of MAPSTEP
left. So it is easy work to transform the remaining in a more pleasant
form.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Transported to a surreal landscape, a young girl kills the first woman
  she meets and then teams up with three complete strangers to kill again."
    -- TV listing for the Wizard of Oz in the Marin Independent Journal


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