Summary: Allow requirement range "within city workable
radius" for tile-based requirements?
Submitted by: jtn
Submitted on: Sat Jun 16 14:02:30 2012
Priority: 3 - Low
Status: Need Info
Assigned to: None
Discussion Lock: Any
It might be nice if tile-based prerequisites (terrain, specials, bases etc)
could be required to be somewhere in a range of a city's workable radius,
rather than just on or adjacent to the city centre.
However, the implications aren't trivial, so this ticket may end up closed
without a fix.
An example given freeciv-dev
<http://mail.gna.org/public/freeciv-dev/2012-06/msg00052.html> was a "gold
mine" city improvement which could only be built in a city with gold nearby
(would also need patch #3322).
Answering the question "is a tile with properties X in workable range of this
city" isn't trivially cheap (requires iterating over city map), but is it
I suspect it's manageable unless some AI is going to call it in some inner
Answering the inverse question "which cities can work this tile" is likely to
be prohibitively expensive, so we'd better avoid that.
(As it happens, in the current implementation, it would actually be much
cheaper to answer the question "which city _is_ working this tile". Perhaps
"worked by city" would be a useful alternative range? )
It would seem reasonable to use the range "City" for this. In contexts where a
non-NULL city is provided to is_req_active(), the "Tile" range already means
the tile the city is on, and I can't think of another sensible meaning for
"City" for tile-based requirements.
(Except, perhaps, "city is _working_ this kind of tile".)
A quick survey of situations where the "City" range is meaningful (I may have
* Improvement build requirements: straightforward at build time.
** In some cases (but not others), improvements are sold if the requirement
goes away (e.g., harbours need nearby ocean). The current mechanism for that
(city_landlocked_sell_coastal_improvements()) already isn't very general and
wouldn't be easy to extend to city-radius requirements.
*** However, moving to the alternative strategy suggested in comments, of
checking every improvement's requirements once per turn, would work.
*** But, examples of reqs whose disappearance don't cause buildings to be sold
include tech and other buildings. We probably don't want to change that. So
there's inconsistency here already.
** It would be pretty annoying to have a gold mine sold due to a temporary
city radius fluctuation due to plague or whatever. But that's probably up to
*** If we used a tile-worked requirement, we certainly wouldn't want to sell
as soon as a city stopped working a tile.
* Specialist requirements: probably sensible.
** May need to re-assess specialists whenever city radius or nearby terrain
* Disaster: straightforward, because disasters don't persist.
Reply to this item at:
Message sent via/by Gna!
Freeciv-dev mailing list