Author: sveinung
Date: Tue Feb  9 17:48:39 2016
New Revision: 31837

URL: http://svn.gna.org/viewcvs/freeciv?rev=31837&view=rev
Log:
Hard action reqs: improve sees tile readability.

The evaluation can see the target tile if the evaluation is omniscient or
if the player can see it. Move the player can see target tile check to a
separate static function named plr_sees_tile().

See patch #6923

Modified:
    trunk/common/actions.c

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=31837&r1=31836&r2=31837&view=diff
==============================================================================
--- trunk/common/actions.c      (original)
+++ trunk/common/actions.c      Tue Feb  9 17:48:39 2016
@@ -674,6 +674,15 @@
 }
 
 /**************************************************************************
+  Returns TRUE iff the specified player can see the specified tile.
+**************************************************************************/
+static bool plr_sees_tile(const struct player *plr,
+                          const struct tile *ttile)
+{
+  return plr && ttile && (tile_get_known(ttile, plr) == TILE_KNOWN_SEEN);
+}
+
+/**************************************************************************
   Returns the local building type of a city target.
 
   target_city can't be NULL
@@ -1087,9 +1096,7 @@
    * or if the evaluator is omniscient. The game checking the rules is
    * omniscient. The player asking about his odds isn't. */
   can_see_tgt_tile = (omniscient
-                      || (target_tile
-                          && (tile_get_known(target_tile, actor_player)
-                              == TILE_KNOWN_SEEN)));
+                      || plr_sees_tile(actor_player, target_tile));
 
   if (!action_actor_utype_hard_reqs_ok(wanted_action, actor_unittype)) {
     /* Info leak: The actor player knows the type of his unit. */


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

Reply via email to