Ticket #42944

assert failure in is_goods_type_in_range()

오픈 날짜: 2021-09-29 08:17 마지막 업데이트: 2021-10-11 03:39

Reporter:
소유자:
Type:
Status:
Closed
Component:
MileStone:
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Fixed
File:
2

Details

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 =

{ "type", "name", "range"
"Good", "Goods", "Traderoute"
"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 -

"Good", "Goods", "Traderoute"


game.ruleset has -

[goods_0\]
name=_("Goods")
from_pct=0
to_pct=0
onetime_pct=0

Ticket History (3/12 Histories)

2021-09-29 08:17 Updated by: ddeanbrown
  • New Ticket "assert failure in is_goods_type_in_range()" created
2021-09-29 08:21 Updated by: cazfi
댓글 올리기

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.

2021-09-29 09:11 Updated by: ddeanbrown
댓글 올리기

OK, I've corrected the wiki page https://freeciv.fandom.com/wiki/Requirements

2021-10-07 10:38 Updated by: ddeanbrown
댓글 올리기

Ihnatus reverted my change to the wiki page, saying -
Code says it's possible to supply "Traderoute" range, plz discuss if not

2021-10-07 13:32 Updated by: cazfi
  • Milestone Update from (None) to 3.0.0 (closed)
  • Component Update from (None) to General
댓글 올리기

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

2021-10-07 13:38 Updated by: cazfi
댓글 올리기

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)"

(Edited, 2021-10-07 17:39 Updated by: cazfi)
2021-10-07 17:31 Updated by: cazfi
댓글 올리기

Additional inconsistency reported as #42992

2021-10-07 18:06 Updated by: cazfi
댓글 올리기

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?

2021-10-08 02:08 Updated by: cazfi
  • Resolution Update from None to Accepted
댓글 올리기

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.

2021-10-11 03:39 Updated by: cazfi
  • Status Update from Open to Closed
  • 소유자 Update from (None) to cazfi
  • Resolution Update from Accepted to Fixed

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login