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: rf13@xxxxxxxxxxxxxxxxxxxxxx, Raahul Kumar <raahul_da_man@xxxxxxxxx>
Cc: freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: RFC: Fixing movement code
From: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Date: Thu, 22 Nov 2001 16:31:58 +0000 (GMT)

 --- 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

G.


__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page from News and Sport to Email and 
Music Charts
http://uk.my.yahoo.com


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