Author: sveinung
Date: Wed Sep 16 13:12:32 2015
New Revision: 29903

URL: http://svn.gna.org/viewcvs/freeciv?rev=29903&view=rev
Log:
Be action enabler aware in can build wonder check

See patch #6355

Modified:
    trunk/common/unit.c
    trunk/common/unit.h

Modified: trunk/common/unit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/unit.c?rev=29903&r1=29902&r2=29903&view=diff
==============================================================================
--- trunk/common/unit.c (original)
+++ trunk/common/unit.c Wed Sep 16 13:12:32 2015
@@ -191,36 +191,18 @@
 }
 
 /**************************************************************************
-  Return TRUE iff this unit can be disbanded at the given city to get full
-  shields for building a wonder.
-**************************************************************************/
-bool unit_can_help_build_wonder(const struct unit *punit,
-                               const struct city *pcity)
-{
-  if (!is_tiles_adjacent(unit_tile(punit), pcity->tile)
-      && !same_pos(unit_tile(punit), pcity->tile)) {
-    return FALSE;
-  }
-
-  return (utype_can_do_action(unit_type(punit), ACTION_HELP_WONDER)
-         && VUT_IMPROVEMENT == pcity->production.kind
-         && is_wonder(pcity->production.value.building)
-         && (pcity->shield_stock
-             < impr_build_shield_cost(pcity->production.value.building)));
-}
-
-
-/**************************************************************************
-  Return TRUE iff this unit can be disbanded at its current position to
-  get full shields for building a wonder.
+  Return TRUE unless it is known to be imposible to disband this unit at
+  its current position to get full shields for building a wonder.
 **************************************************************************/
 bool unit_can_help_build_wonder_here(const struct unit *punit)
 {
   struct city *pcity = tile_city(unit_tile(punit));
 
-  return pcity && unit_can_help_build_wonder(punit, pcity);
-}
-
+  return (pcity
+          && action_prob_possible(action_prob_vs_city(punit,
+                                                      ACTION_HELP_WONDER,
+                                                      pcity)));
+}
 
 /**************************************************************************
   Return TRUE iff this unit can be disbanded at its current location to

Modified: trunk/common/unit.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/unit.h?rev=29903&r1=29902&r2=29903&view=diff
==============================================================================
--- trunk/common/unit.h (original)
+++ trunk/common/unit.h Wed Sep 16 13:12:32 2015
@@ -245,8 +245,6 @@
   activity_type_list_iterate_end                                            \
 }
 
-bool unit_can_help_build_wonder(const struct unit *punit,
-                               const struct city *pcity);
 bool unit_can_help_build_wonder_here(const struct unit *punit);
 bool unit_can_est_trade_route_here(const struct unit *punit);
 enum unit_airlift_result


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

Reply via email to