Author: sveinung
Date: Fri Oct 21 13:25:30 2016
New Revision: 34200

URL: http://svn.gna.org/viewcvs/freeciv?rev=34200&view=rev
Log:
requirements: x contradicts !x.

Exact opposite requirements will always contradict each other. Use this fact
to speed up are_requirements_contradictions().

See patch #7852

Modified:
    branches/S2_6/common/requirements.c

Modified: branches/S2_6/common/requirements.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/requirements.c?rev=34200&r1=34199&r2=34200&view=diff
==============================================================================
--- branches/S2_6/common/requirements.c (original)
+++ branches/S2_6/common/requirements.c Fri Oct 21 13:25:30 2016
@@ -921,6 +921,11 @@
 bool are_requirements_contradictions(const struct requirement *req1,
                                      const struct requirement *req2)
 {
+  if (are_requirements_opposites(req1, req2)) {
+    /* The exact opposite. */
+    return TRUE;
+  }
+
   switch (req1->source.kind) {
   case VUT_DIPLREL:
     if (req2->source.kind != VUT_DIPLREL) {
@@ -963,9 +968,9 @@
     }
     break;
   default:
-    /* No special knowledge exists. All that can be done is to detect if
-     * the requirements are opposite to each other. */
-    return are_requirements_opposites(req1, req2);
+    /* No special knowledge exists. The requirements aren't the exact
+     * opposite of each other per the initial check. */
+    return FALSE;
     break;
   }
 }


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

Reply via email to