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: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Cc: rf13@xxxxxxxxxxxxxxxxxxxxxx, freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: [Patch] MAPSTEP
From: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>
Date: Mon, 24 Sep 2001 00:18:37 -0400

Actually, a "get the (x,y) delta for direction dir" is not a bad
change. It forces you to hand in all the coordinates (in 2-D) and
returns a full 2-D result which is needed for isometric and a few
other cases. 

Doing x and y individually is actually a problem for a generalization
effort.

My only concern is this munges the core and GUI directions systems
into a single whole, and the use in the GUI vs in the core is not
really the same. The GUI stuff is fitting things into a window, the
core playing on a game map, and the two are really not the same in
many cases (windows have fixed boundaries, game maps may not, 
windows are going to be rectangular, the game map might be a quite
different system :-). 

But we are still fighting the "elegance" and "symmetry" argument 
against the practical understanding of what it is doing battle here.

Cheers,
RossW
=====

At 02:31 PM 01/09/23 +0100, you wrote:
> --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
>> On Sat, Sep 22, 2001 at 01:13:05PM +0100, Gregory Berkolaiko wrote:
>[...]
>> > However I strongly object to your use of _MAPSTEP because:
>> > 1. It obscures the code.
>> > 2. It is unnecessary.
>> > 3. It's got bad name (MAPSTEP_FROM_0 would be better if you insist on
>> > using it).
>> 
>> I introduced it for the case you mentioned below. You may have a way
>> to express this without an extra macro besides MAPSTEP.
>
>Errr, actually my complaint was about you use of _MAPSTEP exactly in the
>case mentioned below.  Why do you want to get rid of DIR_D[XY] ?
>They've got good name, it's transperent what it does etc.
>I don't think you are making code any more readable/general by using this
>ugly _MAPSTEP.
>
>> @@ -2083,8 +2067,9 @@
>>    get_canvas_xy(x, y, &canvas_src_x, &canvas_src_y);
>>    canvas_src_x += NORMAL_TILE_WIDTH/2;
>>    canvas_src_y += NORMAL_TILE_HEIGHT/2;
>> -  canvas_dest_x = canvas_src_x + (NORMAL_TILE_WIDTH * DIR_DX[dir])/2;
>> -  canvas_dest_y = canvas_src_y + (NORMAL_TILE_WIDTH * DIR_DY[dir])/2;
>> +  _MAPSTEP(canvas_dest_x, canvas_dest_y, dir);
>> +  canvas_dest_x = canvas_src_x + (NORMAL_TILE_WIDTH *
>canvas_dest_x)/2;
>
>Best,
>G.
>____________________________________________________________
>Do You Yahoo!?
>Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
>or your free @yahoo.ie address at http://mail.yahoo.ie




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