Author: sveinung
Date: Fri Oct 23 13:39:05 2015
New Revision: 30178

URL: http://svn.gna.org/viewcvs/freeciv?rev=30178&view=rev
Log:
Abort some actions on domestic target

Have the action doer functions responsible for map theft, gold theft, city
inciting and unit bribery abort if the target is domestic.

Note that the functions currently aren't called with domestic targets
because doing so is against the hard coded rules.

See patch #6465

Modified:
    trunk/server/diplomats.c

Modified: trunk/server/diplomats.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/diplomats.c?rev=30178&r1=30177&r2=30178&view=diff
==============================================================================
--- trunk/server/diplomats.c    (original)
+++ trunk/server/diplomats.c    Fri Oct 23 13:39:05 2015
@@ -479,6 +479,12 @@
     return FALSE;
   }
 
+  /* Sanity check: The target is foreign. */
+  if (uplayer == pplayer) {
+    /* Nothing to do to a domestic target. */
+    return FALSE;
+  }
+
   /* Sanity check: The victim isn't a unique unit the actor player already
    * has. */
   if (utype_player_already_has_this_unique(pplayer,
@@ -794,6 +800,12 @@
 
   /* Sanity check: The actor still exists. */
   if (!pplayer || !pdiplomat || !unit_alive(pdiplomat->id)) {
+    return FALSE;
+  }
+
+  /* Sanity check: The target is foreign. */
+  if (cplayer == pplayer) {
+    /* Nothing to do to a domestic target. */
     return FALSE;
   }
 
@@ -1212,6 +1224,12 @@
     return FALSE;
   }
 
+  /* Sanity check: The target is foreign. */
+  if (tgt_player == act_player) {
+    /* Nothing to do to a domestic target. */
+    return FALSE;
+  }
+
   /* Sanity check: There is something to steal. */
   if (tgt_player->economic.gold <= 0) {
     return FALSE;
@@ -1339,6 +1357,12 @@
 
   /* Sanity check: The target player still exists. */
   if (!tgt_player) {
+    return FALSE;
+  }
+
+  /* Sanity check: The target is foreign. */
+  if (tgt_player == act_player) {
+    /* Nothing to do to a domestic target. */
     return FALSE;
   }
 


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

Reply via email to