Re: [Freeciv-Dev] (PR#38245) [Bug] Sun Tzu always marked redundant

2007-08-12 Thread Marko Lindqvist

http://bugs.freeciv.org/Ticket/Display.html?id=38245 >

On 04/08/07, Marko Lindqvist <[EMAIL PROTECTED]> wrote:
>
> On 16/03/07, Marko Lindqvist <[EMAIL PROTECTED]> wrote:
> >
> >  Sun Tzu's War Academy is always displayed as redundant.
> >
> >  I think this relates to the fact that its effects have nreq UnitFlag 
> > Diplomat.

 This new version for S2_1 keeps changes to AI behavior minimal.

 In other words: We fix user visible part of the Sun Tzu problem
(client marking it as redundant), but not AI part (AI still thinks Sun
Tzu redundant). It is simply too risky to introduce such AI changes to
S2_1. Even in this reduced form AI behavior has been changed more than
is good for stable branch.


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/aicity.c freeciv/ai/aicity.c
--- freeciv/ai/aicity.c	2007-07-04 14:04:26.0 +0300
+++ freeciv/ai/aicity.c	2007-08-12 14:47:34.0 +0300
@@ -310,7 +310,10 @@
 
 if (is_effect_disabled(pplayer, pcity, pimpr,
 			   NULL, NULL, NULL, NULL,
-			   peffect)) {
+ 			   peffect, RPT_POSSIBLE)) {
+
+  /* TODO: Select between RPT_POSSIBLE and RPT_CERTAIN dynamically
+   * depending how much AI can take risks. */
   CITY_LOG(LOG_DEBUG, pcity, "%s has a disabled effect: %s", 
improvement_rule_name(id),
effect_type_name(peffect->type));
@@ -328,7 +331,7 @@
 continue;
   }
   if (!is_req_active(pplayer, pcity, pimpr, NULL, NULL, NULL, NULL,
-			 preq)) {
+			 preq, RPT_POSSIBLE)) {
 	useful = FALSE;
 	break;
   }
@@ -830,7 +833,8 @@
  wonder_city->production.value)
 && !improvement_obsolete(pplayer, wonder_city->production.value)
 && !is_building_replaced(wonder_city, 
- wonder_city->production.value))
+ wonder_city->production.value,
+ RPT_POSSIBLE))
   || wonder_city == NULL) {
 /* Find a new wonder city! */
 int best_candidate_value = 0;
@@ -899,7 +903,7 @@
   }
   if (city_got_building(pcity, id)
   || !can_build_improvement(pcity, id)
-  || is_building_replaced(pcity, id)) {
+  || is_building_replaced(pcity, id, RPT_POSSIBLE)) {
 continue; /* Don't build redundant buildings */
   }
   adjust_building_want_by_effects(pcity, id);
@@ -1363,7 +1367,7 @@
 if(can_city_sell_building(pcity, i) 
&& !building_has_effect(i, EFT_DEFEND_BONUS)
 	  /* selling city walls is really, really dumb -- Syela */
-   && (is_building_replaced(pcity, i)
+   && (is_building_replaced(pcity, i, RPT_CERTAIN)
 	   || building_unwanted(city_owner(pcity), i))) {
   do_sell_building(pplayer, pcity, i);
   notify_player(pplayer, pcity->tile, E_IMP_SOLD,
diff -Nurd -X.diff_ignore freeciv/client/citydlg_common.c freeciv/client/citydlg_common.c
--- freeciv/client/citydlg_common.c	2007-07-04 14:04:27.0 +0300
+++ freeciv/client/citydlg_common.c	2007-08-12 14:09:37.0 +0300
@@ -321,7 +321,7 @@
   my_snprintf(buf[0], column_size, improvement_name_translation(target.value));
 
   /* from city.c get_impr_name_ex() */
-  if (pcity && is_building_replaced(pcity, target.value)) {
+  if (pcity && is_building_replaced(pcity, target.value, RPT_CERTAIN)) {
 	my_snprintf(buf[1], column_size, "*");
   } else {
 	const char *state = "";
diff -Nurd -X.diff_ignore freeciv/client/gui-gtk-2.0/wldlg.c freeciv/client/gui-gtk-2.0/wldlg.c
--- freeciv/client/gui-gtk-2.0/wldlg.c	2007-07-04 14:04:26.0 +0300
+++ freeciv/client/gui-gtk-2.0/wldlg.c	2007-08-12 14:09:37.0 +0300
@@ -1013,7 +1013,9 @@
 if (!target.is_unit && *pcity) {
   plr = city_owner(*pcity);
   useless = improvement_obsolete(plr, target.value)
-	|| is_building_replaced(*pcity, target.value);
+	|| is_building_replaced(*pcity, target.value, RPT_CERTAIN);
+  /* Mark building redundant if we are really certain that there is
+   * no use for it. */
   g_object_set(rend, "strikethrough", useless, NULL);
 } else {
   g_object_set(rend, "strikethrough", FALSE, NULL);
diff -Nurd -X.diff_ignore freeciv/client/repodlgs_common.c freeciv/client/repodlgs_common.c
--- freeciv/client/repodlgs_common.c	2007-07-04 14:04:27.0 +0300
+++ freeciv/client/repodlgs_common.c	2007-08-12 14:09:37.0 +0300
@@ -334,7 +334,7 @@
 if (!pcity->did_sell && city_got_building(pcity, impr)
 	&& (!obsolete_only
 	|| improvement_obsolete(game.player_ptr, impr)
-	|| is_building_replaced(pcity, impr))) {
+	|| is_building_replaced(pcity, impr, RPT_CERTAIN))) {
   count++;
   gold += impr_sell_gold(impr);
   city_sell_improvement(pcity, impr);
diff -Nurd -X.diff_ignore freeciv/common/city.c freeciv/common/city.c
--- freeciv/common/city.c	2007-07-04 14:04:25.0 +0300
+++ freeciv/common/city.c	2007-08-12 14:09:37.0 +0300
@@ -347,7 +347,8 @@
 
 if (improvement_obsolete(p

Re: [Freeciv-Dev] (PR#38245) [Bug] Sun Tzu always marked redundant

2007-08-07 Thread Marko Lindqvist

http://bugs.freeciv.org/Ticket/Display.html?id=38245 >

On 06/08/07, Marko Lindqvist <[EMAIL PROTECTED]> wrote:
>
>  - Made code more intuitive. Instead of booleans use problem_type enum
> values RPT_POSSIBLE and RPT_CERTAIN

 - Some places were still using TRUE and FALSE. Fixed


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/aicity.c freeciv/ai/aicity.c
--- freeciv/ai/aicity.c	2007-08-04 18:38:34.0 +0300
+++ freeciv/ai/aicity.c	2007-08-08 02:52:30.0 +0300
@@ -683,7 +683,8 @@
 
   requirement_vector_iterate(&pimpr->reqs, preq) {
 const bool active = is_req_active(pplayer, pcity, pimpr,
-  pcity->tile, NULL, NULL, NULL, preq);
+  pcity->tile, NULL, NULL, NULL, preq,
+  RPT_POSSIBLE);
 
 if (preq->source.type == REQ_TECH && !active) {
   /* Found a missing technology requirement for this improvement. */
@@ -844,7 +845,12 @@
 
 if (is_effect_disabled(pplayer, pcity, pimpr,
 			   NULL, NULL, NULL, NULL,
-			   peffect)) {
+			   peffect, RPT_CERTAIN)) {
+  /* We believe that effect if disabled only if there is no change that it
+   * is not. This should lead AI using wider spectrum of improvements.
+   *
+   * TODO: Select between RPT_POSSIBLE and RPT_CERTAIN dynamically
+   * depending how much AI can take risks. */
   continue;
 }
 
@@ -859,7 +865,7 @@
 continue;
   }
   if (!is_req_active(pplayer, pcity, pimpr, NULL, NULL, NULL, NULL,
-			 preq)) {
+			 preq, RPT_POSSIBLE)) {
 	active = FALSE;
 	if (preq->source.type == REQ_TECH) {
 	  /* This missing requirement is a missing tech requirement.
@@ -1133,7 +1139,7 @@
   pcity->ai.building_want[id] = 0;
 } else if ((!is_coinage
 && !can_eventually_build_improvement(pcity, id))
-   || is_building_replaced(pcity, id)) {
+   || is_building_replaced(pcity, id, RPT_CERTAIN)) {
   /* Don't consider impossible or redundant buildings */
   pcity->ai.building_want[id] = 0;
 } else if (pplayer->ai.control
@@ -1203,7 +1209,8 @@
  wonder_city->production.value)
 && !improvement_obsolete(pplayer, wonder_city->production.value)
 && !is_building_replaced(wonder_city, 
- wonder_city->production.value))
+ wonder_city->production.value,
+ RPT_CERTAIN))
   || wonder_city == NULL) {
 /* Find a new wonder city! */
 int best_candidate_value = 0;
@@ -1713,7 +1720,7 @@
 if(can_city_sell_building(pcity, i) 
&& !building_has_effect(i, EFT_DEFEND_BONUS)
 	  /* selling city walls is really, really dumb -- Syela */
-   && (is_building_replaced(pcity, i)
+   && (is_building_replaced(pcity, i, RPT_CERTAIN)
 	   || building_unwanted(city_owner(pcity), i))) {
   do_sell_building(pplayer, pcity, i);
   notify_player(pplayer, pcity->tile, E_IMP_SOLD,
diff -Nurd -X.diff_ignore freeciv/client/citydlg_common.c freeciv/client/citydlg_common.c
--- freeciv/client/citydlg_common.c	2007-08-05 16:40:59.0 +0300
+++ freeciv/client/citydlg_common.c	2007-08-08 02:32:16.0 +0300
@@ -321,7 +321,7 @@
   my_snprintf(buf[0], column_size, improvement_name_translation(target.value));
 
   /* from city.c get_impr_name_ex() */
-  if (pcity && is_building_replaced(pcity, target.value)) {
+  if (pcity && is_building_replaced(pcity, target.value, RPT_CERTAIN)) {
 	my_snprintf(buf[1], column_size, "*");
   } else {
 	const char *state = "";
diff -Nurd -X.diff_ignore freeciv/client/gui-gtk-2.0/wldlg.c freeciv/client/gui-gtk-2.0/wldlg.c
--- freeciv/client/gui-gtk-2.0/wldlg.c	2007-08-04 18:38:42.0 +0300
+++ freeciv/client/gui-gtk-2.0/wldlg.c	2007-08-08 02:32:16.0 +0300
@@ -988,7 +988,9 @@
 
 if (!target.is_unit && *pcity) {
   useless = improvement_obsolete(city_owner(*pcity), target.value)
-	|| is_building_replaced(*pcity, target.value);
+	|| is_building_replaced(*pcity, target.value, RPT_CERTAIN);
+  /* Mark building redundant if we are really certain that there is
+   * no use for it. */
   g_object_set(rend, "strikethrough", useless, NULL);
 } else {
   g_object_set(rend, "strikethrough", FALSE, NULL);
diff -Nurd -X.diff_ignore freeciv/client/repodlgs_common.c freeciv/client/repodlgs_common.c
--- freeciv/client/repodlgs_common.c	2007-08-04 18:39:15.0 +0300
+++ freeciv/client/repodlgs_common.c	2007-08-08 02:32:16.0 +0300
@@ -341,7 +341,7 @@
 if (!pcity->did_sell && city_got_building(pcity, impr)
 	&& (!obsolete_only
 	|| improvement_obsolete(game.player_ptr, impr)
-	|| is_building_replaced(pcity, impr))) {
+	|| is_building_replaced(pcity, impr, RPT_CERTAIN))) {
   count++;
   gold += impr_sell_gold(impr);
   city_sell_improvement(pcity, impr);

Re: [Freeciv-Dev] (PR#38245) [Bug] Sun Tzu always marked redundant

2007-08-06 Thread Marko Lindqvist

http://bugs.freeciv.org/Ticket/Display.html?id=38245 >

 S2_1 version.


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/aicity.c freeciv/ai/aicity.c
--- freeciv/ai/aicity.c	2007-07-04 14:04:26.0 +0300
+++ freeciv/ai/aicity.c	2007-08-06 22:38:35.0 +0300
@@ -310,7 +310,12 @@
 
 if (is_effect_disabled(pplayer, pcity, pimpr,
 			   NULL, NULL, NULL, NULL,
-			   peffect)) {
+ 			   peffect, RPT_CERTAIN)) {
+  /* We believe that effect if disabled only if there is no change that it
+   * is not. This should lead AI using wider spectrum of improvements.
+   *
+   * TODO: Select between RPT_POSSIBLE and RPT_CERTAIN dynamically
+   * depending how much AI can take risks. */
   CITY_LOG(LOG_DEBUG, pcity, "%s has a disabled effect: %s", 
improvement_rule_name(id),
effect_type_name(peffect->type));
@@ -328,7 +333,7 @@
 continue;
   }
   if (!is_req_active(pplayer, pcity, pimpr, NULL, NULL, NULL, NULL,
-			 preq)) {
+			 preq, RPT_POSSIBLE)) {
 	useful = FALSE;
 	break;
   }
@@ -830,7 +835,8 @@
  wonder_city->production.value)
 && !improvement_obsolete(pplayer, wonder_city->production.value)
 && !is_building_replaced(wonder_city, 
- wonder_city->production.value))
+ wonder_city->production.value,
+ RPT_CERTAIN))
   || wonder_city == NULL) {
 /* Find a new wonder city! */
 int best_candidate_value = 0;
@@ -899,7 +905,7 @@
   }
   if (city_got_building(pcity, id)
   || !can_build_improvement(pcity, id)
-  || is_building_replaced(pcity, id)) {
+  || is_building_replaced(pcity, id, RPT_CERTAIN)) {
 continue; /* Don't build redundant buildings */
   }
   adjust_building_want_by_effects(pcity, id);
@@ -1363,7 +1369,7 @@
 if(can_city_sell_building(pcity, i) 
&& !building_has_effect(i, EFT_DEFEND_BONUS)
 	  /* selling city walls is really, really dumb -- Syela */
-   && (is_building_replaced(pcity, i)
+   && (is_building_replaced(pcity, i, RPT_CERTAIN)
 	   || building_unwanted(city_owner(pcity), i))) {
   do_sell_building(pplayer, pcity, i);
   notify_player(pplayer, pcity->tile, E_IMP_SOLD,
diff -Nurd -X.diff_ignore freeciv/client/citydlg_common.c freeciv/client/citydlg_common.c
--- freeciv/client/citydlg_common.c	2007-07-04 14:04:27.0 +0300
+++ freeciv/client/citydlg_common.c	2007-08-06 22:26:34.0 +0300
@@ -321,7 +321,7 @@
   my_snprintf(buf[0], column_size, improvement_name_translation(target.value));
 
   /* from city.c get_impr_name_ex() */
-  if (pcity && is_building_replaced(pcity, target.value)) {
+  if (pcity && is_building_replaced(pcity, target.value, RPT_CERTAIN)) {
 	my_snprintf(buf[1], column_size, "*");
   } else {
 	const char *state = "";
diff -Nurd -X.diff_ignore freeciv/client/gui-gtk-2.0/wldlg.c freeciv/client/gui-gtk-2.0/wldlg.c
--- freeciv/client/gui-gtk-2.0/wldlg.c	2007-07-04 14:04:26.0 +0300
+++ freeciv/client/gui-gtk-2.0/wldlg.c	2007-08-06 23:00:28.0 +0300
@@ -1013,7 +1013,9 @@
 if (!target.is_unit && *pcity) {
   plr = city_owner(*pcity);
   useless = improvement_obsolete(plr, target.value)
-	|| is_building_replaced(*pcity, target.value);
+	|| is_building_replaced(*pcity, target.value, RPT_CERTAIN);
+  /* Mark building redundant if we are really certain that there is
+   * no use for it. */
   g_object_set(rend, "strikethrough", useless, NULL);
 } else {
   g_object_set(rend, "strikethrough", FALSE, NULL);
diff -Nurd -X.diff_ignore freeciv/client/repodlgs_common.c freeciv/client/repodlgs_common.c
--- freeciv/client/repodlgs_common.c	2007-07-04 14:04:27.0 +0300
+++ freeciv/client/repodlgs_common.c	2007-08-06 22:26:34.0 +0300
@@ -334,7 +334,7 @@
 if (!pcity->did_sell && city_got_building(pcity, impr)
 	&& (!obsolete_only
 	|| improvement_obsolete(game.player_ptr, impr)
-	|| is_building_replaced(pcity, impr))) {
+	|| is_building_replaced(pcity, impr, RPT_CERTAIN))) {
   count++;
   gold += impr_sell_gold(impr);
   city_sell_improvement(pcity, impr);
diff -Nurd -X.diff_ignore freeciv/common/city.c freeciv/common/city.c
--- freeciv/common/city.c	2007-07-04 14:04:25.0 +0300
+++ freeciv/common/city.c	2007-08-06 23:20:39.0 +0300
@@ -347,7 +347,8 @@
 
 if (improvement_obsolete(pplayer, id)) {
   state = Q_("?obsolete:O");
-} else if (is_building_replaced(pcity, id)) {
+} else if (is_building_replaced(pcity, id, RPT_CERTAIN)) {
+  /* Mark building redundant only if we are CERTAIN that it has no use. */
   state = Q_("?redundant:*");
 }
   }
@@ -411,7 +412,7 @@
 
   return are_reqs_active(city_owner(pcity), pcity, NULL,
 			 pcity->tile, NULL, NULL, NULL,
-			 &building->reqs);
+			 &building->reqs, RPT_CERTAIN);
 }
 

Re: [Freeciv-Dev] (PR#38245) [Bug] Sun Tzu always marked redundant

2007-08-06 Thread Marko Lindqvist

http://bugs.freeciv.org/Ticket/Display.html?id=38245 >

On 04/08/07, Marko Lindqvist <[EMAIL PROTECTED]> wrote:
>
> On 16/03/07, Marko Lindqvist <[EMAIL PROTECTED]> wrote:
> >
> >  Sun Tzu's War Academy is always displayed as redundant.
> >
> >  I think this relates to the fact that its effects have nreq UnitFlag 
> > Diplomat.
>
>  Totally untested patch
>
>  Be always optimistic about effects: enabling requirements are
> considered TRUE by default, disabling requirements FALSE.

 - Made code more intuitive. Instead of booleans use problem_type enum
values RPT_POSSIBLE and RPT_CERTAIN for determining what kind of
answer is_xxx() functions want.
 - It was not just TRUE -> RPT_POSSIBLE, FALSE -> RPT_CERTAIN type
conversion, but values really make sense related to function names.
 - problem_type parameters added for some upper level functions.
Previous patch only just fixed Sun Tzu problem from default ruleset.
Now this should work sensibly with wider spectrum of different
rulesets.
 - Added comments
 - In theory this causes behavior changes, but only in such rulesets
that make no sense anyway (if effects have requirements that are never
actually checked)

 Testing has been minimal.


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/aicity.c freeciv/ai/aicity.c
--- freeciv/ai/aicity.c	2007-08-04 18:38:34.0 +0300
+++ freeciv/ai/aicity.c	2007-08-06 21:19:44.0 +0300
@@ -683,7 +683,8 @@
 
   requirement_vector_iterate(&pimpr->reqs, preq) {
 const bool active = is_req_active(pplayer, pcity, pimpr,
-  pcity->tile, NULL, NULL, NULL, preq);
+  pcity->tile, NULL, NULL, NULL, preq,
+  TRUE);
 
 if (preq->source.type == REQ_TECH && !active) {
   /* Found a missing technology requirement for this improvement. */
@@ -844,7 +845,12 @@
 
 if (is_effect_disabled(pplayer, pcity, pimpr,
 			   NULL, NULL, NULL, NULL,
-			   peffect)) {
+			   peffect, RPT_CERTAIN)) {
+  /* We believe that effect if disabled only if there is no change that it
+   * is not. This should lead AI using wider spectrum of improvements.
+   *
+   * TODO: Select between RPT_POSSIBLE and RPT_CERTAIN dynamically
+   * depending how much AI can take risks. */
   continue;
 }
 
@@ -859,7 +865,7 @@
 continue;
   }
   if (!is_req_active(pplayer, pcity, pimpr, NULL, NULL, NULL, NULL,
-			 preq)) {
+			 preq, TRUE)) {
 	active = FALSE;
 	if (preq->source.type == REQ_TECH) {
 	  /* This missing requirement is a missing tech requirement.
@@ -1133,7 +1139,7 @@
   pcity->ai.building_want[id] = 0;
 } else if ((!is_coinage
 && !can_eventually_build_improvement(pcity, id))
-   || is_building_replaced(pcity, id)) {
+   || is_building_replaced(pcity, id, RPT_CERTAIN)) {
   /* Don't consider impossible or redundant buildings */
   pcity->ai.building_want[id] = 0;
 } else if (pplayer->ai.control
@@ -1203,7 +1209,8 @@
  wonder_city->production.value)
 && !improvement_obsolete(pplayer, wonder_city->production.value)
 && !is_building_replaced(wonder_city, 
- wonder_city->production.value))
+ wonder_city->production.value,
+ RPT_CERTAIN))
   || wonder_city == NULL) {
 /* Find a new wonder city! */
 int best_candidate_value = 0;
@@ -1713,7 +1720,7 @@
 if(can_city_sell_building(pcity, i) 
&& !building_has_effect(i, EFT_DEFEND_BONUS)
 	  /* selling city walls is really, really dumb -- Syela */
-   && (is_building_replaced(pcity, i)
+   && (is_building_replaced(pcity, i, RPT_CERTAIN)
 	   || building_unwanted(city_owner(pcity), i))) {
   do_sell_building(pplayer, pcity, i);
   notify_player(pplayer, pcity->tile, E_IMP_SOLD,
diff -Nurd -X.diff_ignore freeciv/client/citydlg_common.c freeciv/client/citydlg_common.c
--- freeciv/client/citydlg_common.c	2007-08-05 16:40:59.0 +0300
+++ freeciv/client/citydlg_common.c	2007-08-06 21:27:13.0 +0300
@@ -321,7 +321,7 @@
   my_snprintf(buf[0], column_size, improvement_name_translation(target.value));
 
   /* from city.c get_impr_name_ex() */
-  if (pcity && is_building_replaced(pcity, target.value)) {
+  if (pcity && is_building_replaced(pcity, target.value, RPT_CERTAIN)) {
 	my_snprintf(buf[1], column_size, "*");
   } else {
 	const char *state = "";
diff -Nurd -X.diff_ignore freeciv/client/gui-gtk-2.0/wldlg.c freeciv/client/gui-gtk-2.0/wldlg.c
--- freeciv/client/gui-gtk-2.0/wldlg.c	2007-08-04 18:38:42.0 +0300
+++ freeciv/client/gui-gtk-2.0/wldlg.c	2007-08-06 21:25:38.0 +0300
@@ -988,7 +988,9 @@
 
 if (!target.is_unit && *pcity) {
   useless = improvement_obsolete(city_owner(*pcity), target.value)
-	|| is_building_replaced(*pcity,

Re: [Freeciv-Dev] (PR#38245) [Bug] Sun Tzu always marked redundant

2007-08-03 Thread Marko Lindqvist

http://bugs.freeciv.org/Ticket/Display.html?id=38245 >

On 16/03/07, Marko Lindqvist <[EMAIL PROTECTED]> wrote:
>
>  Sun Tzu's War Academy is always displayed as redundant.
>
>  I think this relates to the fact that its effects have nreq UnitFlag 
> Diplomat.

 Totally untested patch

 Be always optimistic about effects: enabling requirements are
considered TRUE by default, disabling requirements FALSE.


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/aicity.c freeciv/ai/aicity.c
--- freeciv/ai/aicity.c	2007-08-01 17:17:27.0 +0300
+++ freeciv/ai/aicity.c	2007-08-04 05:10:41.0 +0300
@@ -683,7 +683,8 @@
 
   requirement_vector_iterate(&pimpr->reqs, preq) {
 const bool active = is_req_active(pplayer, pcity, pimpr,
-  pcity->tile, NULL, NULL, NULL, preq);
+  pcity->tile, NULL, NULL, NULL, preq,
+  TRUE);
 
 if (preq->source.type == REQ_TECH && !active) {
   /* Found a missing technology requirement for this improvement. */
@@ -859,7 +860,7 @@
 continue;
   }
   if (!is_req_active(pplayer, pcity, pimpr, NULL, NULL, NULL, NULL,
-			 preq)) {
+			 preq, TRUE)) {
 	active = FALSE;
 	if (preq->source.type == REQ_TECH) {
 	  /* This missing requirement is a missing tech requirement.
diff -Nurd -X.diff_ignore freeciv/common/base.c freeciv/common/base.c
--- freeciv/common/base.c	2007-08-01 17:17:24.0 +0300
+++ freeciv/common/base.c	2007-08-04 05:06:01.0 +0300
@@ -91,7 +91,7 @@
   }
 
   return are_reqs_active(unit_owner(punit), NULL, NULL, ptile,
- unit_type(punit), NULL, NULL, &pbase->reqs);
+ unit_type(punit), NULL, NULL, &pbase->reqs, TRUE);
 }
 
 /
diff -Nurd -X.diff_ignore freeciv/common/city.c freeciv/common/city.c
--- freeciv/common/city.c	2007-08-01 17:17:24.0 +0300
+++ freeciv/common/city.c	2007-08-04 05:08:09.0 +0300
@@ -411,7 +411,7 @@
 
   return are_reqs_active(city_owner(pcity), pcity, NULL,
 			 pcity->tile, NULL, NULL, NULL,
-			 &building->reqs);
+			 &building->reqs, TRUE);
 }
 
 /**
@@ -448,7 +448,7 @@
   requirement_vector_iterate(&building->reqs, preq) {
 if (is_req_unchanging(preq)
 	&& !is_req_active(city_owner(pcity), pcity, NULL,
-	  		  pcity->tile, NULL, NULL, NULL, preq)) {
+	  		  pcity->tile, NULL, NULL, NULL, preq, TRUE)) {
   return FALSE;
 }
   } requirement_vector_iterate_end;
@@ -531,7 +531,7 @@
 {
   return are_reqs_active(city_owner(pcity), pcity, NULL,
 			 NULL, NULL, NULL, NULL,
-			 &get_specialist(type)->reqs);
+			 &get_specialist(type)->reqs, TRUE);
 }
 
 /
@@ -1102,7 +1102,7 @@
   while ((replace = city_styles[prev].replaced_by) != -1) {
 prev = replace;
 if (are_reqs_active(plr, NULL, NULL, NULL, NULL, NULL, NULL,
-			&city_styles[replace].reqs)) {
+			&city_styles[replace].reqs, TRUE)) {
   style = replace;
 }
   }
diff -Nurd -X.diff_ignore freeciv/common/effects.c freeciv/common/effects.c
--- freeciv/common/effects.c	2007-08-01 17:17:24.0 +0300
+++ freeciv/common/effects.c	2007-08-04 05:01:06.0 +0300
@@ -573,7 +573,7 @@
 if (is_req_active(target_player, target_city, target_building,
 		  target_tile, target_unittype, target_output,
 		  target_specialist,
-		  preq)) {
+		  preq, FALSE)) {
   return TRUE;
 }
   } requirement_list_iterate_end;
@@ -581,7 +581,7 @@
 }
 
 /**
-  Return TRUE iff any of the disabling requirements for this effect are
+  Return TRUE iff all of the enabling requirements for this effect are
   active (an effect is active if all of its enabling requirements and
   none of its disabling ones are active).
 **/
@@ -598,7 +598,7 @@
 if (!is_req_active(target_player, target_city, target_building,
 		   target_tile, target_unittype, target_output,
 		   target_specialist,
-		   preq)) {
+		   preq, TRUE)) {
   return FALSE;
 }
   } requirement_list_iterate_end;
@@ -668,7 +668,7 @@
 if (!is_req_active(target_player, target_city, target_building,
 		   target_tile, target_unittype, target_output,
 		   target_specialist,
-		   preq)) {
+		   preq, TRUE)) {
   return FALSE;
 }
   } requirement_list_iterate_end;
diff -Nurd -X.diff_ignore freeciv/common/government.c freeciv/common/government.c
--- freeciv/common/government.c	2007-08-02 23:25:07.0 +0300
+++ freeciv/common/government.c	2007-08-04 05:08:23.0 +0300
@@ -228,7 +228,7 @@
   }
 
   return are_reqs_active(pplayer, NULL, NULL, NULL, NULL, NULL, NULL,
-			 &gov->reqs);
+			 &