[Freeciv-Dev] Re: (PR#9610) autosettler "territory" and danger maps
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] Re: (PR#9610) autosettler "territory" and danger maps |
From: |
"Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx> |
Date: |
Thu, 5 Aug 2004 18:32:06 -0700 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9610 >
Per I. Mathisen wrote:
>>Can we remove the territory map and replace it with a global function
>>call?
>
>
> Here is my preliminary idea for a "movemap":
>
> A mapsize array of struct {
> struct unit_list 1_turn_reach;
> struct unit_list 2_turn_reach;
> } movemap;
There must be one such array for each player, since each player has
different vision. Note that human players use this as well (human
autosettlers avoid dangerous positions) and this is hard-core cheating.
> These unit lists contain all the units that can reach the tile in one or
> two turns. You can now iterate over all possibly dangerous units that can
> reach a given tile quickly.
>
> To set up this cache, run through all units once, and use pf to mark tiles
> in the movemap. For ferries, for each ferry { make pf map; for each tile {
> for each passenger { pf backtrace from tile and see if we can overlap with
> the ferry's pf map, if so mark tile } } }.
>
> This is expensive, but doing ferries properly is a real pain in the ***,
> any way you do it.
>
> Setting up the cache will consume some CPU, and has to be recalculated
> each turn for each player, but will not cost much more CPU than a
> pf-converted city danger code, I think. The city danger code will have to
> (well, should) do these calculations anyway.
Calculated once per turn per player?
jason
|
|