[Freeciv-tickets] [freeciv] #42905: The 'survives' flag not surviving obsolescence is a logic mistake

Zurück zum Archiv-Index
OSDN Ticket System norep****@osdn*****
Fri Sep 24 10:55:56 JST 2021


#42905: The 'survives' flag not surviving obsolescence is a logic mistake

  Open Date: 2021-09-24 10:55
Last Update: 2021-09-24 10:55

URL for this Ticket:
    https://osdn.net//projects/freeciv/ticket/42905
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=42905

---------------------------------------------------------------------

Last Changes/Comment on this Ticket:
2021-09-24 10:55 Updated by: lexxie9952
 * New Ticket "The 'survives' flag not surviving obsolescence is a logic mistake" created


---------------------------------------------------------------------
Ticket Status:

      Reporter: lexxie9952
         Owner: (None)
          Type: Bugs
        Status: Open
      Priority: 8
     MileStone: (None)
     Component: (None)
      Severity: 5 - Medium
    Resolution: None
---------------------------------------------------------------------

Ticket details:

Basically, any req for a building that is obsolete will automatically render as false when it goes obsolete ANYWAY. So you don't ever NEED to make a req with "survives"==TRUE
if you want a req to render false if an improvement is obsolete.
ON THE OTHER HAND, when would we actually want to do the 'survives' check on an obsolete improvement? That's right, to see if the improvement were ever made before, that's
exactly when we'd want to check 'survives' on obsolete improvements.
The current coding allows you to check case A two different ways but not be allowed to check case B. The suggested code change below allows ruleset designers
to test case A and case B, so for that reason alone is logically superior. 
See the comments in the suggested code fix below.
This fix now provides semantic correctness for 'survives' and allows rulesets to test ALL possibilities instead of deleting one of the cases from the matrix of possibilities that reqs can test for.
NB: This situation arose in a real ruleset where you are only allowed to build wonder A or wonder B but not both. When your built wonder A goes obsolete it then allowed you to make wonder B.
There was no way to test 'survives' on it because it was obsolete. If this was what you wanted, it's easy enough to make the req without needing the 'survives' flag, that always becomes true
when a wonder goes obsolete. However what we need the 'survives' flag for was to test if the wonder had EVER been built. 
Hope it makes sense, feel free to comment. This is really a major important fix for allowing rulesets to incorporate EITHER/OR logic into players' strategic developmental paths.
requirements.c: 
/**********************************************************************//**
Are there any source buildings within range of the target that are not
obsolete?
The target gives the type of the target.  The exact target is a player,
city, or building specified by the target_xxx arguments.
The range gives the range of the requirement.
"Survives" specifies whether the requirement allows destroyed OR obsolete
If set then all source buildings ever built are counted; if not
then only living buildings are counted.
source gives the building type of the source in question.
**************************************************************************/
static enum fc_tristate
is_building_in_range(const struct player *target_player,
const struct city *target_city,
const struct impr_type *target_building,
enum req_range range,
bool survives,
const struct impr_type *source)
{
/* Check if it's certain that the building is obsolete given the
specification we have.             

23Sept2021 (!survives && ...) was added. Its absence was a logic flaw.

This allowed a dead dummy case while preventing a much needed
obligatory case. If you want a req to go unfulfilled after
an improvement goes obsolete, you don't NEED to mess with the
survives flag, since obsolete improvs will render non-present
and false anyway. On the other hand, it is very common in XXXX
games to have a requirement that you can only make one of X
or Y in a game. e.g., either/or one-way strategic paths or
defining factions/races/decisions/development paths, or
basically any (X || Y && !(X && Y)) type of conditions.
In theory, this change disallows reqs testing the 'survives' 
flag on the never-before-seen case of an improvement whose
purpose is to prevent other improvements only until it's
BUT, since obsoleteness makes improvement reqs 
render false anyway, the only time you use the 'survives' flag
w.r.t. obsolete improvements is to see if they've ever been 
  
This means the 'survives' req is now semantically correct insofar
as it 'survives obsolescence' and we can now consistently use
'survives' for the proper purpose of checking if an improvement
was ever made. Rulesets can now have conditions on whether
something was ever built, instead of leaving rulesets BLIND to
whether something was ever built, when it goes obsolete. See
changes in reqtext.c commited on this date. */
if (!survives && improvement_obsolete(target_player, source, target_city)) {
return TRI_NO;
}

-- 
Ticket information of Freeciv project
Freeciv Project is hosted on OSDN

Project URL: https://osdn.net/projects/freeciv/
OSDN: https://osdn.net

URL for this Ticket:
    https://osdn.net/projects/freeciv/ticket/42905
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=42905



More information about the Freeciv-tickets mailing list
Zurück zum Archiv-Index