assert failure in is_goods_type_in_range()
While this should be caught at ruleset loading time instead of triggering runtime assert, the doc/README.effects list "City" as the only valid range for "Good" requirement.
OK, I've corrected the wiki page https://freeciv.fandom.com/wiki/Requirements
Ihnatus reverted my change to the wiki page, saying -
Code says it's possible to supply "Traderoute" range, plz discuss if not
1) req_from_str() accepts both "City" and "Traderoute" ranges for "Good" requirement when the ruleset is loaded
2) is_goods_type_in_range() does not have implementation for Traderoute range, giving the assert seen in this ticket instead
3) doc/README.effects list only "City" as a supported range.
In S3_0 (d3f) I would say that the correct behavior is what the documentation (README.effects) says -> fix req_from_str()
In later branches we could look in to supporting Traderoute range -> change is_goods_type_in_range() and documentation
Reply To cazfi
In later branches we could look in to supporting Traderoute range -> change is_goods_type_in_range() and documentation
The question is, does it ever make sense to use that range? It would mean that "For City A, does there exist a traderoute to a city B, to which a specific good is imported (via another traderoute) from a city C? (As a special case, C can be the same as A)"
Additional inconsistency reported as #42992
For those confused by the semantics: Remember that the concept of "Good" is that it *travels via a trade route* (it only exist within trade route). The source city never has it (it doesn't travel there), but only the city where it's imported to has. The source city might have requirements, such as specific "Resource", for exporting the good.
Note that even if "Good" requirement evaluated true also when the city is the one exporting the good, it wouldn't make it easier to handle cases where we want something enabled when a city either has "something" by itself, or by importing the same thing. The Good would still not be available in the source city either when there's no trade route. Maybe it makes sense in a future version to implement something that allows a city to provide goods to itself?
Reply To cazfi
In S3_0 (d3f) I would say that the correct behavior is what the documentation (README.effects) says -> fix req_from_str()
In later branches we could look in to supporting Traderoute range -> change is_goods_type_in_range() and documentation
Future development is future development (and new ticket, if someone wants it). Attached patches make the ruleset loading time check to disallow "Traderoute" range in all branches for now.
3.0.0-beta2
Playing with my custom ruleset, got this error msg at runtime (ruleset loaded OK) -
Please report this message at https://osdn.net/projects/freeciv/ticket/
in is_goods_type_in_range() [../../freeciv-3.0.0/common/requirements.c::1792]: assertion 'FALSE' failed.
Invalid range 4.
Cause is this effect in my effects.ruleset -
; Make minimum trade from a traderoute >= 1; change down-round to up-round by
; adding 1 to city center.
[effect_traderoute_minimum0\]
type = "Output_Add_Tile"
value = 1
reqs =
"CityTile", "Center", "Local"
"OutputType", "Trade", "Local"
This line looks like the trigger. I think it should be OK, according to the wiki page https://freeciv.fandom.com/wiki/Requirements -
game.ruleset has -
[goods_0\]
name=_("Goods")
from_pct=0
to_pct=0
onetime_pct=0