Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2001:
[Freeciv-Dev] Re: [PATCH] Unit movement
Home

[Freeciv-Dev] Re: [PATCH] Unit movement

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx (Freeciv developers)
Subject: [Freeciv-Dev] Re: [PATCH] Unit movement
From: Reinier Post <rp@xxxxxxxxxx>
Date: Tue, 16 Jan 2001 16:49:32 +0100

On Tue, Jan 16, 2001 at 02:59:54PM +0100, Raimar Falke wrote:

>    sort_units(); /* to let explorer move before other units */
>    for_each_unit
>    {
>       while(current_unit_can_move())
>       {
>          think_about_best_direction(); /* could use dry_run */
>          result=move();
>          /* if dry_run was used before if should succeed */

This is *false*.  There is no way to make dry_run reliable,
unless it blocks all activity on the server that could possibly
affect this situation.

Besides, waiting for every move() would be prohibitively slow;
Chuck Corey explained this earlier.

>          if(is_enemy_unit_near())

Same remark: you have no way of knowing.  On a fast network the best you
can have is a high probablility.

>              if(enemy_can_be_killed()) /* is there a unit with attack>0 near 
> */
>                 try_to_kill_it();
>          if(is_enemy_unit_near())
>              retreat();
>       }
>    }

I think you should abandon the thought of structuring your code in this
way, unless it runs in the server (where such loops *are* possible).

-- 
Reinier



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