Summary: player_invention_reachable() allow_prereqs mess
Submitted by: cazfi
Submitted on: Fri 12 Jul 2013 10:59:59 AM EEST
Severity: 3 - Normal
Priority: 5 - Normal
Assigned to: None
Discussion Lock: Any
Operating System: None
What is supposed to be the function of "allow_prereqs" parameter to
Function header says: "Returns TRUE iff the given tech is ever reachable by
the given player by checking tech tree limitations. If allow_prereqs is TRUE
check if the player can ever reach this tech." i.e, function always checks if
tech is ever reachable, and does the same thing if allow_prereqs is TRUE?
Reading the code, the only difference allow_prereq does (sans different
implementation that is logically equivalent) is that any root req must be
already known if it's not set, but reachability is enough when it's set. For
other requirements reachability is always enough.
I think most (all?) callers that have allow_prereq set to FALSE are in error.
Why wouldn't reachability be enough for root_req if at the same time it's
enough for other reqs?
One interesting caller is research dialog. Toggle between showing all or only
reachable techs was originally meant for distinct tech trees - to show only
current player's tree or entire tree. Now it never shows other trees, but
toggles between showing player's entire tree or only those parts for which
root_req is already known.
Reply to this item at:
Message sent via/by Gna!
Freeciv-dev mailing list