Author: sveinung
Date: Wed Dec 28 17:29:11 2016
New Revision: 34743

URL: http://svn.gna.org/viewcvs/freeciv?rev=34743&view=rev
Log:
Explicit action target city is known assumption.

Make the assumption that a city targeted action's target city is know
explicit.

See patch #7974

Modified:
    trunk/common/actions.c
    trunk/doc/README.actions

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=34743&r1=34742&r2=34743&view=diff
==============================================================================
--- trunk/common/actions.c      (original)
+++ trunk/common/actions.c      Wed Dec 28 17:29:11 2016
@@ -1727,13 +1727,31 @@
     return TRI_NO;
   }
 
-  if (action_id_get_target_kind(wanted_action) == ATK_UNIT) {
+  switch (action_id_get_target_kind(wanted_action)) {
+  case ATK_UNIT:
     /* The Freeciv code for all actions that is controlled by action
      * enablers and targets a unit assumes that the acting
      * player can see the target unit. */
     if (!can_player_see_unit(actor_player, target_unit)) {
       return TRI_NO;
     }
+    break;
+  case ATK_CITY:
+    /* The Freeciv code assumes that the player is aware of the target
+     * city's existence. (How can you order an airlift to a city when you
+     * don't know its city ID?) */
+    if (!(plr_knows_tile(actor_player, city_tile(target_city)))) {
+      return TRI_NO;
+    }
+    break;
+  case ATK_UNITS:
+  case ATK_TILE:
+  case ATK_SELF:
+    /* No special player knowledge checks. */
+    break;
+  case ATK_COUNT:
+    fc_assert(action_id_get_target_kind(wanted_action) != ATK_COUNT);
+    break;
   }
 
   if (action_is_blocked_by(wanted_action, actor_unit,

Modified: trunk/doc/README.actions
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/doc/README.actions?rev=34743&r1=34742&r2=34743&view=diff
==============================================================================
--- trunk/doc/README.actions    (original)
+++ trunk/doc/README.actions    Wed Dec 28 17:29:11 2016
@@ -162,63 +162,76 @@
 =====================================
 "Establish Embassy" - Establish a real embassy to the target player
  * UI name can be set using ui_name_establish_embassy
+ * actor must be aware that the target exists
  * actor can't have a real embassy to the target player
  * actor must be on the same tile as the target or on the tile next to it.
  * target must be foreign. (!)
 
 "Investigate City" - Look at the city dialog of a foreign city
  * UI name can be set using ui_name_investigate_city
+ * actor must be aware that the target exists
  * actor must be on the same tile as the target or on the tile next to it.
  * target must be foreign. (!)
 
 "Sabotage City" - Destroy a building or the production in the target city.
  * UI name can be set using ui_name_sabotage_city
+ * actor must be aware that the target exists
  * actor must be on the same tile as the target or on the tile next to it.
 
 "Targeted Sabotage City" - Targeted version of the above.
  * UI name can be set using ui_name_targeted_sabotage_city
+ * actor must be aware that the target exists
  * actor must be on the same tile as the target or on the tile next to it.
 
 "Poison City" - Kill a citizen in the target city.
  * UI name can be set using ui_name_poison_city
+ * actor must be aware that the target exists
  * actor must be on the same tile as the target or on the tile next to it.
 
 "Steal Tech" - Steal a random tech from the targets owner.
  * UI name can be set using ui_name_steal_tech
+ * actor must be aware that the target exists
  * actor must be on the same tile as the target or on the tile next to it.
  * target must be foreign. (!)
 
 "Targeted Steal Tech" - Targeted version of the above.
  * UI name can be set using ui_name_targeted_steal_tech
+ * actor must be aware that the target exists
  * actor must be on the same tile as the target or on the tile next to it.
  * target must be foreign. (!)
 
 "Incite City" - Pay the target city to join the actors owners side.
  * UI name can be set using ui_name_incite_city
+ * actor must be aware that the target exists
  * actor must be on the same tile as the target or on the tile next to it.
  * target must be foreign. (!)
 
 "Steal Gold" - Steal some gold from the owner of the target city.
  * UI name can be set using ui_name_steal_gold
+ * actor must be aware that the target exists
  * the targets owner must have more than 0 gold.
  * actor must be on the same tile as the target or on the tile next to it.
  * target must be foreign. (!)
 
 "Steal Maps" - Steal parts of the owner of the target city's map.
  * UI name can be set using ui_name_steal_maps
+ * actor must be aware that the target exists
  * actor must be on the same tile as the target or on the tile next to it.
  * target must be foreign. (!)
 
 "Suitcase Nuke" - Cause a nuclear explosion in the target city.
  * UI name can be set using ui_name_suitcase_nuke
+ * actor must be aware that the target exists
  * actor must be on the same tile as the target or on the tile next to it.
 
 "Destroy City" - Destroys the target city.
  * UI name can be set using ui_name_destroy_city
+ * actor must be aware that the target exists
  * actor must be on the same tile as the target or on the tile next to it.
 
 "Establish Trade Route" - Establish a trade route to the target city.
  * UI name can be set using ui_name_establish_trade_route
+ * actor must be aware that the target exists
  * actor must be on the same tile as the target or on the tile next to it.
  * actor must have a home city.
  * target must be foreign or trademindist tiles away from that home city.
@@ -230,6 +243,7 @@
 
 "Enter Marketplace" - Get a one time bounus without creating a trade route.
  * UI name can be set using ui_name_enter_marketplace
+ * actor must be aware that the target exists
  * if force_trade_route is true "Establish Trade Route" must be impossible
  * actor must be on the same tile as the target or on the tile next to it.
  * actor must have a home city.
@@ -238,16 +252,19 @@
 
 "Help Wonder" - Add the shields used to build the actor to the target city.
  * UI name can be set using ui_name_help_wonder
+ * actor must be aware that the target exists
  * actor must be on the same tile as the target or on the tile next to it.
  * target city must need the extra shields to complete its production.
 
 "Recycle Unit" - Add half the shields used to build the unit to target
  * UI name can be set using ui_name_recycle_unit
+ * actor must be aware that the target exists
  * "Help Wonder" must be impossible
  * actor must be on the same tile as the target
 
 "Join City" - Add the actor to the target city's population.
  * UI name can be set using ui_name_join_city
+ * actor must be aware that the target exists
  * actor must have population to add (set in pop_cost)
  * actor must be on the same tile as the target or on the tile next to it.
  * target city population must not become higher that the add_to_size_limit
@@ -257,6 +274,7 @@
 
 "Home City" - Set target city as the actor unit's new home city
  * UI name can be set using ui_name_home_city
+ * actor must be aware that the target exists
  * actor must be on the same tile as the target
  * actor must not have the "NoHome" unit type flag. (!)
  * can't set existing home city as new home city
@@ -265,6 +283,7 @@
 
 "Upgrade Unit" - Upgrade the actor unit using the target's facilities.
  * UI name can be set using ui_upgrade_unit.
+ * actor must be aware that the target exists
  * actor must be on the same tile as the target.
  * actor player must have enough gold to pay for the upgrade.
  * actor unit must have a type to upgrade to (obsoleted_by).
@@ -276,6 +295,7 @@
 
 "Airlift Unit" - Airlift actor unit to target city.
  * UI name can be set using ui_airlift_unit
+ * actor must be aware that the target exists
  * the actor unit isn't transporting another unit (!)
  * the actor unit isn't inside the target city
  * the actor unit can exist in the target city (outside a transport)
@@ -288,6 +308,7 @@
 
 "Conquer City" - Conquer the target city.
  * UI name can be set using ui_name_conquer_city
+ * actor must be aware that the target exists
  * if force_capture_units is true "Capture Units" must be impossible
  * if force_bombard is true "Bombard" must be impossible
  * if force_explode_nuclear is true "Explode Nuclear" must be impossible


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

Reply via email to