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: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>, freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: [Patch] MAPSTEP
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 24 Sep 2001 16:46:46 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Mon, Sep 24, 2001 at 03:07:39PM +0100, Gregory Berkolaiko wrote:
>  --- "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx> wrote: 
> 
> > 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. 
> 
> I must loudly disagree with you here.  (x,y) delta still has x-component
> and y-component and is still additive as long as the surface you are
> playing on is locally R^2 (planar).  And DIRSTEP explecitly returns these
> separate components and then they are explicitly used in GUI code.  So I
> think you are fooling yourself here.

The step of changing DIR_D[XY] to DIRSTEP and MAPSTEP was only the
first step. Yes DIRSTEP is not general enough for all circumstances.

  int canvas_src_x, canvas_src_y, canvas_dest_x, canvas_dest_y;

  get_canvas_xy(x, y, &canvas_src_x, &canvas_src_y);
  DIRSTEP(canvas_dest_x, canvas_dest_y, dir);
  canvas_dest_x = canvas_src_x + (NORMAL_TILE_WIDTH * canvas_dest_x) / 2;
  canvas_dest_y = canvas_src_y + (NORMAL_TILE_WIDTH * canvas_dest_y) / 2;

can be replaced by
  int canvas_src_x, canvas_src_y, canvas_dest_x, canvas_dest_y;
  int dest_x,dest_y;

  get_canvas_xy(x, y, &canvas_src_x, &canvas_src_y);
  MAPSTEP(dest_x,dest_y,x,y,dir);
  get_canvas_xy(dest_x, dest_y, &canvas_dest_x, &canvas_dest_y);

  ... some extra fiddling with canvas_dest_x and canvas_dest_y


        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]