[Freeciv-Dev] Re: (PR#12997) [PATCH] UnitFlag requirement
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12997 >
Benedict Adamson wrote:
> Does this mean rulesets can express effects such as 'The city containing
> the Leader has 50% less corruption?'. Cool.
Eventually. However for now unit-type and unit-flag reqs only work at
local range: so only for effects applying to the unit itself. We can
extend this to tile, adjacent, city, player, or world range by
introducing the appropriate sources cache (basically, by tracking the
number of each category of unit at each range). However this probably
won't be done until 2.2 (for 2.1 we should focus on finalizing the code
design and ruleset syntax).
And yes, some of the above ranges may never be supported. City and
adjacent range are particularly ugly. But maybe these can just be an
inefficient wrapper for the tile sources cache.
More technically, Vasco and I agreed that any requirement check should
be a fast-ish O(1) check. Since there is no limit on the number of
units this means any kind of unit_list_iterate isn't allowed. Instead
we'd have to track (per tile) the number of each type of unit that
exists on that tile. Iterating over all adjacent tiles or all tiles in
the citymap, or even all tiles on the map to implement adjacent or city
range is technically O(1) because the size of these is bounded. Which
is why we have to qualify it with fast-ish ;-).
-jason
|
|