URL:
  <http://gna.org/patch/?3835>

                 Summary: Negated requirements sanity checking improvements
                 Project: Freeciv
            Submitted by: persia
            Submitted on: Fri 05 Apr 2013 08:22:55 PM JST
                Category: general
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 

    _______________________________________________________

Details:

    The current sanity checking for negated requirements isn't quite
satisfactory.  It is possible to specify precisely opposite requirements (You
must have tea and no tea to build this road), or to fail with apparently
sensible requirements (this base cannot be built on mountains or hills).

    The attached patch is a first step towards fixing that, which addresses
the two issues listed above.  It is not an attempt to generally fix
requirements checking, so it is still possible to generate conflicting
requirements (e.g. "Terrain", "Grassland", "Local", FALSE; "TerrainClass",
"Land", "Local", TRUE), which can never be achieved (this may only be built on
grassland but never built on land).  Having richer requirements checking
involves having the entire requirements vector available at the time each
requirement is checked, which can't happen with the current code.  I am not
inclined to refactor it until the repository is open for wild changes, as it
would be unreasonably painful to do prior to merging the requirements
processing for effects into the generalised mechanisms (which change is large
and would need *lots* of testing).

    Note that the attached patch does not attempt to address the use of
negated in effects requirements: for now it is much safer to encourage the use
of nreqs vectors for negated requirements for effects, as the code paths
differ, and the precise implications may require significant investigation.

    As part of the implementation and testing, I became rather annoyed with
the semantics of requirement->negated.  It feels backwards to me, both in
terms of the double-negative thinking involved in the use of !preq->negated
and the awkward reading of reqs lists (where the items marked "TRUE" need to
not be met, and the items marked "FALSE" need to be met).  If swapping the
sense of this is also something that could fit into the near term, I would be
very happy to prepare a patch.  If not, I would like to do that as part of the
larger requirements modifications mentioned above.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 05 Apr 2013 08:22:55 PM JST  Name: negated-requiement-sanity.patch 
Size: 4kB   By: persia

<http://gna.org/patch/download.php?file_id=17680>

    _______________________________________________________

Reply to this item at:

  <http://gna.org/patch/?3835>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to