<URL: 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.000000000 +0300
+++ freeciv/ai/aicity.c	2007-08-12 14:47:34.000000000 +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.000000000 +0300
+++ freeciv/client/citydlg_common.c	2007-08-12 14:09:37.000000000 +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.000000000 +0300
+++ freeciv/client/gui-gtk-2.0/wldlg.c	2007-08-12 14:09:37.000000000 +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.000000000 +0300
+++ freeciv/client/repodlgs_common.c	2007-08-12 14:09:37.000000000 +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.000000000 +0300
+++ freeciv/common/city.c	2007-08-12 14:09:37.000000000 +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);
 }
 
 /**************************************************************************
@@ -448,7 +449,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, RPT_POSSIBLE)) {
       return FALSE;
     }
   } requirement_vector_iterate_end;
@@ -529,7 +530,7 @@
 {
   return are_reqs_active(city_owner(pcity), pcity, NULL,
 			 NULL, NULL, NULL, NULL,
-			 &get_specialist(type)->reqs);
+			 &get_specialist(type)->reqs, RPT_POSSIBLE);
 }
 
 /****************************************************************************
@@ -1116,7 +1117,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, RPT_CERTAIN)) {
       style = replace;
     }
   }
diff -Nurd -X.diff_ignore freeciv/common/effects.c freeciv/common/effects.c
--- freeciv/common/effects.c	2007-07-04 14:04:25.000000000 +0300
+++ freeciv/common/effects.c	2007-08-12 14:09:37.000000000 +0300
@@ -604,13 +604,14 @@
 			const struct unit_type *target_unittype,
 			const struct output_type *target_output,
 			const struct specialist *target_specialist,
-		        const struct effect *peffect)
+		        const struct effect *peffect,
+                        const enum   req_problem_type prob_type)
 {
   requirement_list_iterate(peffect->nreqs, preq) {
     if (is_req_active(target_player, target_city, target_building,
 		      target_tile, target_unittype, target_output,
 		      target_specialist,
-		      preq)) {
+		      preq, prob_type)) {
       return TRUE;
     }
   } requirement_list_iterate_end;
@@ -618,7 +619,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).
 **************************************************************************/
@@ -629,13 +630,14 @@
 			      const struct unit_type *target_unittype,
 			      const struct output_type *target_output,
 			      const struct specialist *target_specialist,
-			      const struct effect *peffect)
+			      const struct effect *peffect,
+                              const enum   req_problem_type prob_type)
 {
   requirement_list_iterate(peffect->reqs, preq) {
     if (!is_req_active(target_player, target_city, target_building,
 		       target_tile, target_unittype, target_output,
 		       target_specialist,
-		       preq)) {
+		       preq, prob_type)) {
       return FALSE;
     }
   } requirement_list_iterate_end;
@@ -658,16 +660,18 @@
 			     const struct unit_type *target_unittype,
 			     const struct output_type *target_output,
 			     const struct specialist *target_specialist,
-			     const struct effect *peffect)
+			     const struct effect *peffect,
+                             const enum   req_problem_type prob_type)
 {
+  /* Reversed prob_type when checking disabling effects */
   return is_effect_enabled(target_player, target_city, target_building,
 			   target_tile, target_unittype, target_output,
 			   target_specialist,
-			   peffect)
+			   peffect, prob_type)
     && !is_effect_disabled(target_player, target_city, target_building,
 			   target_tile, target_unittype, target_output,
 			   target_specialist,
-			   peffect);
+			   peffect, REVERSED_RPT(prob_type));
 }
 
 /**************************************************************************
@@ -689,12 +693,14 @@
 		      const struct unit_type *target_unittype,
 		      const struct output_type *target_output,
 		      const struct specialist *target_specialist,
-		      Impr_type_id source, const struct effect *peffect)
+		      Impr_type_id source, const struct effect *peffect,
+                      const enum   req_problem_type prob_type)
 {
+  /* Reversed prob_type when checking disabling effects */
   if (is_effect_disabled(target_player, target_city, target_building,
 			 target_tile, target_unittype, target_output,
 			 target_specialist,
-			 peffect)) {
+			 peffect, REVERSED_RPT(prob_type))) {
     return FALSE;
   }
   requirement_list_iterate(peffect->reqs, preq) {
@@ -705,7 +711,7 @@
     if (!is_req_active(target_player, target_city, target_building,
 		       target_tile, target_unittype, target_output,
 		       target_specialist,
-		       preq)) {
+		       preq, prob_type)) {
       return FALSE;
     }
   } requirement_list_iterate_end;
@@ -715,8 +721,10 @@
 /**************************************************************************
   Returns TRUE if a building is replaced.  To be replaced, all its effects
   must be made redundant by groups that it is in.
+  prob_type CERTAIN or POSSIBLE is answer to function name.
 **************************************************************************/
-bool is_building_replaced(const struct city *pcity, Impr_type_id building)
+bool is_building_replaced(const struct city *pcity, Impr_type_id building,
+                          const enum req_problem_type prob_type)
 {
   struct req_source source;
   struct effect_list *plist;
@@ -740,10 +748,12 @@
     /* We use TARGET_BUILDING as the lowest common denominator.  Note that
      * the building is its own target - but whether this is actually
      * checked depends on the range of the effect. */
+    /* Prob_type is not reversed here. disabled is equal to replaced, not
+     * reverse */
     if (!is_effect_disabled(city_owner(pcity), pcity,
 			    improvement_by_number(building),
 			    NULL, NULL, NULL, NULL,
-			    peffect)) {
+			    peffect, prob_type)) {
       return FALSE;
     }
   } effect_list_iterate_end;
@@ -780,7 +790,7 @@
     if (is_effect_active(target_player, target_city, target_building,
 			 target_tile, target_unittype, target_output,
 			 target_specialist,
-			 peffect)) {
+			 peffect, RPT_CERTAIN)) {
       /* And if so add on the value. */
       bonus += peffect->value;
 
@@ -991,9 +1001,13 @@
 
   Note this is not called get_current_production_bonus because that would
   be confused with EFT_PROD_BONUS.
+
+  Problem type tells if we need to be CERTAIN about bonus before counting
+  it or is POSSIBLE bonus enough.
 **************************************************************************/
 int get_current_construction_bonus(const struct city *pcity,
-				   enum effect_type effect_type)
+				   enum effect_type effect_type,
+                                   const enum req_problem_type prob_type)
 {
   if (!pcity->production.is_unit) {
     Impr_type_id id = pcity->production.value;
@@ -1014,7 +1028,7 @@
 	}
 	if (is_effect_useful(city_owner(pcity), pcity, building,
 			     NULL, NULL, NULL, NULL,
-			     id, peffect)) {
+			     id, peffect, prob_type)) {
 	  power += peffect->value;
 	}
       } effect_list_iterate_end;
diff -Nurd -X.diff_ignore freeciv/common/effects.h freeciv/common/effects.h
--- freeciv/common/effects.h	2007-08-04 19:55:23.000000000 +0300
+++ freeciv/common/effects.h	2007-08-12 14:09:37.000000000 +0300
@@ -163,9 +163,11 @@
 		      const struct unit_type *target_unittype,
 		      const struct output_type *target_output,
 		      const struct specialist *target_specialist,
-		      Impr_type_id source, const struct effect *effect);
+		      Impr_type_id source, const struct effect *effect,
+                      const enum   req_problem_type prob_type);
 
-bool is_building_replaced(const struct city *pcity, Impr_type_id building);
+bool is_building_replaced(const struct city *pcity, Impr_type_id building,
+                          const enum req_problem_type prob_type);
 
 /* functions to know the bonuses a certain effect is granting */
 int get_world_bonus(enum effect_type effect_type);
@@ -202,7 +204,8 @@
 			const struct unit_type *target_unittype,
 			const struct output_type *target_output,
 			const struct specialist *target_specialist,
-		        const struct effect *peffect);
+		        const struct effect *peffect,
+                        const enum   req_problem_type prob_type);
 
 int get_player_bonus_effects(struct effect_list *plist,
     const struct player *pplayer, enum effect_type effect_type);
@@ -214,7 +217,8 @@
 bool building_has_effect(Impr_type_id building,
 			 enum effect_type effect_type);
 int get_current_construction_bonus(const struct city *pcity,
-				   enum effect_type effect_type);
+				   enum effect_type effect_type,
+                                   const enum req_problem_type prob_type);
 
 Impr_type_id ai_find_source_building(struct player *pplayer,
 				     enum effect_type effect_type);
diff -Nurd -X.diff_ignore freeciv/common/fc_types.h freeciv/common/fc_types.h
--- freeciv/common/fc_types.h	2007-07-04 14:04:25.000000000 +0300
+++ freeciv/common/fc_types.h	2007-08-12 14:09:37.000000000 +0300
@@ -171,6 +171,18 @@
 #define DIR8_LAST 8
 #define DIR8_COUNT DIR8_LAST
 
+/* Sometimes we don't know (or don't care) if some requirements for effect
+ * are currently fulfilled or not. This enum tells lower level functions
+ * how to handle uncertain requirements.
+ */
+enum req_problem_type {
+  RPT_POSSIBLE, /* We want to know if it is possible that effect is active */
+  RPT_CERTAIN   /* We want to know if it is certain that effect is active  */
+};
+
+#define REVERSED_RPT(x) \
+  (x == RPT_CERTAIN ? RPT_POSSIBLE : RPT_CERTAIN)
+
 /* ruleset strings (such as names) are kept in their original vernacular, 
  * translated upon first use.  The translation is cached for future use.
  */
diff -Nurd -X.diff_ignore freeciv/common/government.c freeciv/common/government.c
--- freeciv/common/government.c	2007-07-04 14:04:25.000000000 +0300
+++ freeciv/common/government.c	2007-08-12 14:09:37.000000000 +0300
@@ -199,7 +199,7 @@
   }
 
   return are_reqs_active(pplayer, NULL, NULL, NULL, NULL, NULL, NULL,
-			 &gov->reqs);
+			 &gov->reqs, RPT_CERTAIN);
 }
 
 /***************************************************************
diff -Nurd -X.diff_ignore freeciv/common/improvement.c freeciv/common/improvement.c
--- freeciv/common/improvement.c	2007-07-04 14:04:25.000000000 +0300
+++ freeciv/common/improvement.c	2007-08-12 14:09:37.000000000 +0300
@@ -324,7 +324,8 @@
 
   requirement_vector_iterate(&impr->reqs, preq) {
     if (preq->range >= REQ_RANGE_PLAYER
-        && !is_req_active(p, NULL, NULL, NULL, NULL, NULL, NULL, preq)) {
+        && !is_req_active(p, NULL, NULL, NULL, NULL, NULL, NULL, preq,
+                          RPT_CERTAIN)) {
       return FALSE;
     }
   } requirement_vector_iterate_end;
@@ -404,7 +405,8 @@
   requirement_vector_iterate(&building->reqs, preq) {
     if (preq->range >= REQ_RANGE_PLAYER
 	&& is_req_unchanging(preq)
-        && !is_req_active(p, NULL, NULL, NULL, NULL, NULL, NULL, preq)) {
+        && !is_req_active(p, NULL, NULL, NULL, NULL, NULL, NULL, preq,
+                          RPT_POSSIBLE)) {
       return FALSE;
     }
   } requirement_vector_iterate_end;
diff -Nurd -X.diff_ignore freeciv/common/requirements.c freeciv/common/requirements.c
--- freeciv/common/requirements.c	2007-07-04 14:04:25.000000000 +0300
+++ freeciv/common/requirements.c	2007-08-12 14:09:37.000000000 +0300
@@ -746,14 +746,23 @@
 ****************************************************************************/
 static bool is_unitflag_in_range(const struct unit_type *target_unittype,
 				 enum req_range range, bool survives,
-				 enum unit_flag_id unitflag)
+				 enum unit_flag_id unitflag,
+                                 enum req_problem_type prob_type)
 {
   /* If no target_unittype is given, we allow the req to be met.  This is
    * to allow querying of certain effect types (like the presence of city
    * walls) without actually knowing the target unit. */
-  return (range == REQ_RANGE_LOCAL
-	  && (!target_unittype
-	      || utype_has_flag(target_unittype, unitflag)));
+  if (range != REQ_RANGE_LOCAL) {
+    return FALSE;
+  }
+  if (!target_unittype) {
+    /* Unknow means TRUE  for RPT_POSSIBLE
+     *              FALSE for RPT_CERTAIN
+     */
+    return prob_type == RPT_POSSIBLE;
+  }
+
+  return utype_has_flag(target_unittype, unitflag);
 }
 
 /****************************************************************************
@@ -789,7 +798,8 @@
 		   const struct unit_type *target_unittype,
 		   const struct output_type *target_output,
 		   const struct specialist *target_specialist,
-		   const struct requirement *req)
+		   const struct requirement *req,
+                   const enum   req_problem_type prob_type)
 {
   bool eval = FALSE;
 
@@ -841,7 +851,8 @@
   case REQ_UNITFLAG:
     eval = is_unitflag_in_range(target_unittype,
 				req->range, req->survives,
-				req->source.value.unitflag);
+				req->source.value.unitflag,
+                                prob_type);
     break;
   case REQ_UNITCLASS:
     eval = is_unitclass_in_range(target_unittype,
@@ -891,13 +902,14 @@
 		     const struct unit_type *target_unittype,
 		     const struct output_type *target_output,
 		     const struct specialist *target_specialist,
-		     const struct requirement_vector *reqs)
+		     const struct requirement_vector *reqs,
+                     const enum   req_problem_type prob_type)
 {
   requirement_vector_iterate(reqs, preq) {
     if (!is_req_active(target_player, target_city, target_building,
 		       target_tile, target_unittype, target_output,
 		       target_specialist,
-		       preq)) {
+		       preq, prob_type)) {
       return FALSE;
     }
   } requirement_vector_iterate_end;
diff -Nurd -X.diff_ignore freeciv/common/requirements.h freeciv/common/requirements.h
--- freeciv/common/requirements.h	2007-03-05 19:14:29.000000000 +0200
+++ freeciv/common/requirements.h	2007-08-12 14:09:37.000000000 +0300
@@ -122,7 +122,8 @@
 		   const struct unit_type *target_unittype,
 		   const struct output_type *target_output,
 		   const struct specialist *target_specialist,
-		   const struct requirement *req);
+		   const struct requirement *req,
+                   const enum   req_problem_type prob_type);
 bool are_reqs_active(const struct player *target_player,
 		     const struct city *target_city,
 		     const struct impr_type *target_building,
@@ -130,7 +131,8 @@
 		     const struct unit_type *target_unittype,
 		     const struct output_type *target_output,
 		     const struct specialist *target_specialist,
-		     const struct requirement_vector *reqs);
+		     const struct requirement_vector *reqs,
+                     const enum   req_problem_type prob_type);
 
 bool is_req_unchanging(const struct requirement *req);
 
diff -Nurd -X.diff_ignore freeciv/server/citytools.c freeciv/server/citytools.c
--- freeciv/server/citytools.c	2007-07-04 14:04:17.000000000 +0300
+++ freeciv/server/citytools.c	2007-08-12 14:09:37.000000000 +0300
@@ -2138,7 +2138,7 @@
 	  if (preq->source.type == REQ_TERRAIN
 	      && !is_req_active(city_owner(pcity), pcity, NULL,
 				NULL, NULL, NULL, NULL,
-				preq)) {
+				preq, RPT_CERTAIN)) {
           do_sell_building(pplayer, pcity, impr);
           notify_player(pplayer, tile1, E_IMP_SOLD,
                            _("You sell %s in %s (now landlocked)"
diff -Nurd -X.diff_ignore freeciv/server/cityturn.c freeciv/server/cityturn.c
--- freeciv/server/cityturn.c	2007-07-04 14:04:17.000000000 +0300
+++ freeciv/server/cityturn.c	2007-08-12 14:09:37.000000000 +0300
@@ -323,7 +323,8 @@
 		   / pcity->surplus[O_FOOD];
 
     if (get_city_bonus(pcity, EFT_GROWTH_FOOD) == 0
-	&& get_current_construction_bonus(pcity, EFT_GROWTH_FOOD) > 0
+	&& get_current_construction_bonus(pcity, EFT_GROWTH_FOOD,
+                                          RPT_CERTAIN) > 0
 	&& pcity->surplus[O_SHIELD] > 0) {
       /* From the check above, the surplus must always be positive. */
       turns_granary = (impr_build_shield_cost(pcity->production.value)
@@ -466,8 +467,8 @@
   bool rapture_grow = city_rapture_grow(pcity); /* check before size increase! */
 
   if (!city_can_grow_to(pcity, pcity->size + 1)) { /* need improvement */
-    if (get_current_construction_bonus(pcity, EFT_SIZE_ADJ) > 0
-        || get_current_construction_bonus(pcity, EFT_SIZE_UNLIMIT) > 0) {
+    if (get_current_construction_bonus(pcity, EFT_SIZE_ADJ, RPT_CERTAIN) > 0
+        || get_current_construction_bonus(pcity, EFT_SIZE_UNLIMIT, RPT_CERTAIN) > 0) {
       notify_player(powner, pcity->tile, E_CITY_AQ_BUILDING,
 		       _("%s needs %s (being built) "
 			 "to grow any further."),
@@ -716,7 +717,7 @@
 	/* Nope, no use.  *sigh*  */
 	requirement_vector_iterate(&building->reqs, preq) {
 	  if (!is_req_active(pplayer, pcity, NULL, NULL, NULL, NULL, NULL,
-			     preq)) {
+			     preq, RPT_POSSIBLE)) {
 	    known = TRUE;
 	    switch (preq->source.type) {
 	    case REQ_TECH:
@@ -1089,11 +1090,14 @@
     }
 
     space_part = TRUE;
-    if (get_current_construction_bonus(pcity, EFT_SS_STRUCTURAL) > 0) {
+    if (get_current_construction_bonus(pcity, EFT_SS_STRUCTURAL,
+                                       RPT_CERTAIN) > 0) {
       pplayer->spaceship.structurals++;
-    } else if (get_current_construction_bonus(pcity, EFT_SS_COMPONENT) > 0) {
+    } else if (get_current_construction_bonus(pcity, EFT_SS_COMPONENT,
+                                              RPT_CERTAIN) > 0) {
       pplayer->spaceship.components++;
-    } else if (get_current_construction_bonus(pcity, EFT_SS_MODULE) > 0) {
+    } else if (get_current_construction_bonus(pcity, EFT_SS_MODULE,
+                                              RPT_CERTAIN) > 0) {
       pplayer->spaceship.modules++;
     } else {
       space_part = FALSE;
@@ -1128,7 +1132,8 @@
      * the vision range of a city */
     city_refresh_vision(pcity);
 
-    if ((mod = get_current_construction_bonus(pcity, EFT_GIVE_IMM_TECH))) {
+    if ((mod = get_current_construction_bonus(pcity, EFT_GIVE_IMM_TECH,
+                                              RPT_CERTAIN))) {
       int i;
 
       notify_player(pplayer, NULL, E_TECH_GAIN,
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to