Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2001:
[Freeciv-Dev] Re: RFC: Fixing movement code
Home

[Freeciv-Dev] Re: RFC: Fixing movement code

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Cc: Raahul Kumar <raahul_da_man@xxxxxxxxx>, freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: RFC: Fixing movement code
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 22 Nov 2001 18:04:39 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Thu, Nov 22, 2001 at 04:31:58PM +0000, Gregory Berkolaiko wrote:
>  --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
> > static int unit_move_turns(struct unit *punit, int x, int y)
> > {
> >   int m, result;
> >   m = unit_type(punit)->move_rate;
> > 
> >   if (unit_type(punit)->move_type == LAND_MOVING) {
> >     if (unit_flag(punit, F_IGTER)) m *= SINGLE_MOVE;
> >     result = warmap.cost[x][y] / m;
> >   }
> >   else if (unit_type(punit)->move_type == SEA_MOVING) {
> >     struct player *pplayer = unit_owner(punit);
> >     if (player_owns_active_wonder(pplayer, B_LIGHTHOUSE))
> >       m += SINGLE_MOVE;
> >     if (player_owns_active_wonder(pplayer, B_MAGELLAN))
> >       m += (improvement_variant(B_MAGELLAN)==1) ? SINGLE_MOVE : 2 *
> > SINGLE_MOVE;
> >     m += player_knows_techs_with_flag(pplayer,TF_BOAT_FAST) *
> > SINGLE_MOVE;
> > 
> >     result = warmap.seacost[x][y] / m; 
> >   } else /* air unit */ {
> >     retult = real_map_distance(punit->x, punit->y, x, y) * SINGLE_MOVE
> > / m;
> >   }
> >   return resukt;
> > }
> 
> a switch(unit_type(punit)->move_type) is prettier

Ack. It looks like I steak Raahul some work with this patch.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Understanding is a three-edged sword; 
  your side, their side, and the truth."
    -- a well-known Vorlon

Attachment: unit_move_turns1.diff
Description: Text document


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