Author: sveinung
Date: Wed Dec 31 12:26:24 2014
New Revision: 27461

URL: http://svn.gna.org/viewcvs/freeciv?rev=27461&view=rev
Log:
Send the correct action to maybe_cause_incident()

in stead of always sending the untargeted version. They are still handled
the same way.

See patch #5630

Modified:
    trunk/server/diplomats.c
    trunk/server/diplomats.h
    trunk/server/unithand.c

Modified: trunk/server/diplomats.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/diplomats.c?rev=27461&r1=27460&r2=27461&view=diff
==============================================================================
--- trunk/server/diplomats.c    (original)
+++ trunk/server/diplomats.c    Wed Dec 31 12:26:24 2014
@@ -549,7 +549,8 @@
   not at war with
 ****************************************************************************/
 void diplomat_get_tech(struct player *pplayer, struct unit *pdiplomat, 
-                      struct city  *pcity, Tech_type_id technology)
+                       struct city  *pcity, Tech_type_id technology,
+                       const enum gen_action action_id)
 {
   struct research *presearch, *cresearch;
   struct player *cplayer;
@@ -658,7 +659,7 @@
                   unit_tile_link(pdiplomat),
                   city_link(pcity));
     /* this may cause a diplomatic incident */
-    maybe_cause_incident(ACTION_SPY_STEAL_TECH, pplayer, cplayer,
+    maybe_cause_incident(action_id, pplayer, cplayer,
                          city_tile(pcity), city_link(pcity));
     wipe_unit(pdiplomat, ULR_CAUGHT, cplayer);
     return;
@@ -683,7 +684,7 @@
   (pcity->server.steal)++;
 
   /* this may cause a diplomatic incident */
-  maybe_cause_incident(ACTION_SPY_STEAL_TECH, pplayer, cplayer,
+  maybe_cause_incident(action_id, pplayer, cplayer,
                        city_tile(pcity), city_link(pcity));
 
   /* Check if a spy survives her mission. Diplomats never do. */
@@ -830,7 +831,8 @@
   - The saboteur may be captured and executed, or escape to its home town.
 **************************************************************************/
 void diplomat_sabotage(struct player *pplayer, struct unit *pdiplomat,
-                      struct city *pcity, Impr_type_id improvement)
+                       struct city *pcity, Impr_type_id improvement,
+                       const enum gen_action action_id)
 {
   struct player *cplayer;
   struct impr_type *ptarget;
@@ -1069,7 +1071,7 @@
   send_city_info(NULL, pcity);
 
   /* this may cause a diplomatic incident */
-  maybe_cause_incident(ACTION_SPY_SABOTAGE_CITY, pplayer, cplayer,
+  maybe_cause_incident(action_id, pplayer, cplayer,
                        city_tile(pcity), city_link(pcity));
 
   /* Check if a spy survives her mission. Diplomats never do. */

Modified: trunk/server/diplomats.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/diplomats.h?rev=27461&r1=27460&r2=27461&view=diff
==============================================================================
--- trunk/server/diplomats.h    (original)
+++ trunk/server/diplomats.h    Wed Dec 31 12:26:24 2014
@@ -28,11 +28,13 @@
 void diplomat_bribe(struct player *pplayer, struct unit *pdiplomat, 
                    struct unit *pvictim);
 void diplomat_get_tech(struct player *pplayer, struct unit *pdiplomat, 
-                      struct city  *pcity, int technology);
+                       struct city  *pcity, int technology,
+                       const enum gen_action action_id);
 void diplomat_incite(struct player *pplayer, struct unit *pdiplomat, 
                     struct city *pcity);
-void diplomat_sabotage(struct player *pplayer, struct unit *pdiplomat, 
-                      struct city *pcity, Impr_type_id improvement);
+void diplomat_sabotage(struct player *pplayer, struct unit *pdiplomat,
+                       struct city *pcity, Impr_type_id improvement,
+                       const enum gen_action action_id);
 void spy_steal_gold(struct player *act_player, struct unit *act_unit,
                    struct city *tgt_city);
 

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=27461&r1=27460&r2=27461&view=diff
==============================================================================
--- trunk/server/unithand.c     (original)
+++ trunk/server/unithand.c     Wed Dec 31 12:26:24 2014
@@ -702,7 +702,8 @@
       if (is_action_enabled_unit_on_city(action_type, actor_unit, pcity)) {
         ACTION_STARTED_UNIT_CITY(action_type, actor_unit, pcity);
 
-        diplomat_sabotage(pplayer, actor_unit, pcity, B_LAST);
+        diplomat_sabotage(pplayer, actor_unit, pcity, B_LAST,
+                          action_type);
       } else {
         illegal_action(pplayer, actor_unit, action_type,
                        city_owner(pcity));
@@ -715,7 +716,8 @@
         ACTION_STARTED_UNIT_CITY(action_type, actor_unit, pcity);
 
         /* packet value is improvement ID + 1 (or some special codes) */
-        diplomat_sabotage(pplayer, actor_unit, pcity, value - 1);
+        diplomat_sabotage(pplayer, actor_unit, pcity, value - 1,
+                          action_type);
       } else {
         illegal_action(pplayer, actor_unit, action_type,
                        city_owner(pcity));
@@ -787,7 +789,8 @@
         ACTION_STARTED_UNIT_CITY(action_type, actor_unit, pcity);
 
         /* packet value is technology ID (or some special codes) */
-        diplomat_get_tech(pplayer, actor_unit, pcity, A_UNSET);
+        diplomat_get_tech(pplayer, actor_unit, pcity, A_UNSET,
+                          action_type);
       } else {
         illegal_action(pplayer, actor_unit, action_type,
                        city_owner(pcity));
@@ -801,7 +804,8 @@
         ACTION_STARTED_UNIT_CITY(action_type, actor_unit, pcity);
 
         /* packet value is technology ID (or some special codes) */
-        diplomat_get_tech(pplayer, actor_unit, pcity, value);
+        diplomat_get_tech(pplayer, actor_unit, pcity, value,
+                          action_type);
       } else {
         illegal_action(pplayer, actor_unit, action_type,
                        city_owner(pcity));


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

Reply via email to