Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2001:
[Freeciv-Dev] Re: directional system: more magic code cleanups
Home

[Freeciv-Dev] Re: directional system: more magic code cleanups

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: directional system: more magic code cleanups
From: Jason Dorje Short <jshort@xxxxxxxxxxxxx>
Date: Mon, 17 Sep 2001 12:25:15 -0400
Reply-to: jdorje@xxxxxxxxxxxxxxxxxxxxx

Raimar Falke wrote:
> 
> On Mon, Sep 17, 2001 at 11:13:03AM +0100, Gregory Berkolaiko wrote:
> >  --- Jason Dorje Short <jshort@xxxxxxxxxxxxx> wrote:
> > [..]
> > > It does *not* fully fix dir_ok and straightest_direction as it should;
> > > I
> > > think Ross should provide a patch that fixes these guys properly.
> > > However it is good as far as it goes.
> >
> > there is a nice mathematical way to code dir_ok:
> > if diff_x, diff_y and dir are what they are in the current function then
> > the "scalar product"
> >
> >         diff_x*DIR_DX[dir] + diff_y*DIR_DY[dir]
> >
> > is positive whenever direction is ok.  And you don't need any switches.
> 
> Very nice. Good spotting. For clarity: s/positive/>=0/. There may be
> extra documentation about this (for a given diff vector there are
> exactly 5 directions ok. These are centered around the given diff
> vector. The "outmost" still valid directions are orthogonal to the
> given diff vector. scalar product bla bla ...)

No, it must be positive (>0) rather than non-negative (>=0).  Traveling
orthogonally to the destination is not OK.

> > However Ross' patch might be more advanced than this.
> 
> No I don't think so ;)

Ross's patch actually fixed the bug in straightest_direction, so it
certainly was for that function.

jason


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