[Freeciv-Dev] Re: directional system: more magic code cleanups
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Mon, Sep 17, 2001 at 12:25:15PM -0400, Jason Dorje Short wrote:
> 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.
*looking further into this* mhh. Lets see if I understood this (in
goto_zoc_ok):
- (src_x, src_y) and (dest_x, dest_y) are adjacent
- the last block "{int dir...return 0;}" is useless since it has no
side-effects and will always return 0
Very weird.
> Ross's patch actually fixed the bug in straightest_direction, so it
> certainly was for that function.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"At the beginning of the week, we sealed ten BSD programmers
into a computer room with a single distribution of BSD Unix.
Upon opening the room after seven days, we found all ten programmers
dead, clutching each other's throats, and thirteen new flavors of BSD."
- [Freeciv-Dev] Re: Trigonometry of Freeciv, (continued)
- [Freeciv-Dev] Re: Trigonometry of Freeciv, Raahul Kumar, 2001/09/29
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Ross W. Wetmore, 2001/09/27
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Raimar Falke, 2001/09/28
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Ross W. Wetmore, 2001/09/29
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Raimar Falke, 2001/09/30
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Ross W. Wetmore, 2001/09/30
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Ross W. Wetmore, 2001/09/17
- [Freeciv-Dev] Re: directional system: more magic codecleanups, Jason Dorje Short, 2001/09/18
- [Freeciv-Dev] Re: directional system: more magic codecleanups, Reinier Post, 2001/09/25
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Jason Dorje Short, 2001/09/17
- [Freeciv-Dev] Re: directional system: more magic code cleanups,
Raimar Falke <=
- [Freeciv-Dev] Re: directional system: more magic code cleanups, Ross W. Wetmore, 2001/09/17
|
|