<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40207 >
Marko Lindqvist:
> 2008/5/18 jacobn:
> >
> > I don't see an easy way out of this, unless the policy of using pointer
> > comparison is reversed. Temporarily modifying the tile in-place seems
> > evil (especially as the comments for city_tile_output() make it clear
> > that it can be called speculatively).
>
> Ouch, I didn't realize that this would be affected by "you can have
> legal objects in certain memory location only". This is not the first
> time it causes trouble, and sooner or later it has to be solved.
Here's an alternative approach which side-steps the issue: stop messing
around with dummy tiles entirely, and promote the city-centre effect to
the same level as irrigation and farmland are applied.
The auto-irrigation part is easy:
case O_FOOD:
- if (contains_special(tile.special, S_IRRIGATION)) {
+ /* The city center tile is auto-irrigated. */
+ if (tile_has_special(ptile, S_IRRIGATION)
+ || (NULL != pcity
+ && is_city_center(pcity, ptile)
+ && pterrain == pterrain->irrigation_result
+ && terrain_control.may_irrigate)) {
prod += pterrain->irrigation_food_incr;
}
break;
The auto-farmland part would be implemented by editing effects.ruleset,
and that's where we hit a snag -- as far as I can tell, there's
currently no way to limit an effect to a tile with a city on it.
It would presumably be possible to add this capability to the effects
system, but I think it'd require a new top-level entry in universals_n
-- the alternative would be to treat the presence of a city as a kind of
VUT_SPECIAL, which probably won't go down too well.
With this approach, all rulesets that support Farmland would need
updating before they got auto-farmland working again, but that's no
worse than the current situation.
I can have a go at this for S2_2 and the trunk if it seems like a good
idea. Would this approach, necessitating as it does adding a top-level
entity to the effects system, be too disruptive for the 2.1 branch?
_______________________________________________
Freeciv-dev mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-dev