[Freeciv-Dev] Re: RFC: Fixing movement code
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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
unit_move_turns1.diff
Description: Text document
- [Freeciv-Dev] RFC: Fixing movement code, Raahul Kumar, 2001/11/21
- [Freeciv-Dev] Re: RFC: Fixing movement code, Raimar Falke, 2001/11/21
- [Freeciv-Dev] Re: RFC: Fixing movement code, Raahul Kumar, 2001/11/21
- [Freeciv-Dev] PATCH: AI cleanup Version 2, Raahul Kumar, 2001/11/23
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Petr Baudis, 2001/11/23
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Raimar Falke, 2001/11/23
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Petr Baudis, 2001/11/23
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Raahul Kumar, 2001/11/23
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Raimar Falke, 2001/11/24
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Petr Baudis, 2001/11/24
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Raimar Falke, 2001/11/24
|
|