Author: sveinung
Date: Sun Mar  1 12:17:41 2015
New Revision: 28337

URL: http://svn.gna.org/viewcvs/freeciv?rev=28337&view=rev
Log:
Add an event type for reporting that a unit's order was against the rules.

Enabler controlled actions are no longer limited to spy actions. It is
therefore no longer appropriate to use E_MY_DIPLOMAT_FAILED when a unit was
ordered to do an action that turned out to be against the rules. Introduce
the new event type E_UNIT_ILLEGAL_ACTION and use it in stead.

See patch #5870

Modified:
    trunk/common/events.c
    trunk/common/events.h
    trunk/data/misc/events.spec
    trunk/data/stdsounds.soundspec
    trunk/fc_version
    trunk/server/unithand.c

Modified: trunk/common/events.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/events.c?rev=28337&r1=28336&r2=28337&view=diff
==============================================================================
--- trunk/common/events.c       (original)
+++ trunk/common/events.c       Sun Mar  1 12:17:41 2015
@@ -204,7 +204,8 @@
   GEN_EV(E_SCRIPT,             E_S_XYZZY,      N_("Scenario/ruleset script 
message")),
   /* TRANS: Event name for when the game year changes. */
   GEN_EV(E_NEXT_YEAR,          E_S_XYZZY,      N_("Year Advance")),
-  GEN_EV(E_EXTRA_SPREAD,        E_S_XYZZY,      N_("Extra Spreads"))
+  GEN_EV(E_EXTRA_SPREAD,        E_S_XYZZY,      N_("Extra Spreads")),
+  GEN_EV(E_UNIT_ILLEGAL_ACTION, E_S_UNIT,       N_("Unit Illegal Action"))
   /* The sound system also generates "e_game_quit", although there's no
    * corresponding identifier E_GAME_QUIT. */
 };
@@ -294,6 +295,7 @@
   case E_UNIT_WIN_ATT:
   case E_UPRISING:
   case E_UNIT_RELOCATED:
+  case E_UNIT_ILLEGAL_ACTION:
     return FALSE;
 
   default:

Modified: trunk/common/events.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/events.h?rev=28337&r1=28336&r2=28337&view=diff
==============================================================================
--- trunk/common/events.h       (original)
+++ trunk/common/events.h       Sun Mar  1 12:17:41 2015
@@ -152,6 +152,7 @@
 #define SPECENUM_VALUE114 E_MY_SPY_STEAL_GOLD
 #define SPECENUM_VALUE115 E_ENEMY_SPY_STEAL_GOLD
 #define SPECENUM_VALUE116 E_EXTRA_SPREAD
+#define SPECENUM_VALUE117 E_UNIT_ILLEGAL_ACTION
 /*
  * Note: If you add a new event, make sure you make a similar change
  * to the events array in "common/events.c" using GEN_EV, to

Modified: trunk/data/misc/events.spec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/misc/events.spec?rev=28337&r1=28336&r2=28337&view=diff
==============================================================================
--- trunk/data/misc/events.spec (original)
+++ trunk/data/misc/events.spec Sun Mar  1 12:17:41 2015
@@ -88,6 +88,7 @@
   3, 15, "e_enemy_spy_steal_gold"
 ;  3, 16, "e_enemy_diplomatic_incident"
 ;  3, 17, "e_enemy_diplomat_escape" ; base sprite for enemy diplomats
+  1,  4, "e_unit_illegal_action"
 
   4,  0, "e_achievement"
   4,  1, "e_uprising"

Modified: trunk/data/stdsounds.soundspec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/stdsounds.soundspec?rev=28337&r1=28336&r2=28337&view=diff
==============================================================================
--- trunk/data/stdsounds.soundspec      (original)
+++ trunk/data/stdsounds.soundspec      Sun Mar  1 12:17:41 2015
@@ -315,7 +315,7 @@
 ;e_wonder_stopped = ""
 ;e_wonder_will_be_built = ""
 ;e_worklist = ""
-
+;e_unit_illegal_action = ""
 ;e_extra_spread = ""
 
 ; This pseudo-event is only used in the sound system.

Modified: trunk/fc_version
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/fc_version?rev=28337&r1=28336&r2=28337&view=diff
==============================================================================
--- trunk/fc_version    (original)
+++ trunk/fc_version    Sun Mar  1 12:17:41 2015
@@ -54,7 +54,7 @@
 #   - Avoid adding a new mandatory capability to the development branch for
 #     as long as possible.  We want to maintain network compatibility with
 #     the stable branch for as long as possible.
-NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.0-2015.Feb.22"
+NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.0-2015.Mar.01"
 NETWORK_CAPSTRING_OPTIONAL=""
 
 FREECIV_DISTRIBUTOR=""

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=28337&r1=28336&r2=28337&view=diff
==============================================================================
--- trunk/server/unithand.c     (original)
+++ trunk/server/unithand.c     Sun Mar  1 12:17:41 2015
@@ -700,9 +700,6 @@
   Tell the client that the action it requested is illegal. This can be
   caused by the player (and therefore the client) not knowing that some
   condition of an action no longer is true.
-
-  Remember to stop using E_MY_DIPLOMAT_FAILED if non diplomat actions start
-  using it.
 **************************************************************************/
 static void illegal_action(struct player *pplayer,
                            struct unit *actor,
@@ -725,7 +722,7 @@
   send_unit_info(NULL, actor);
 
   notify_player(pplayer, unit_tile(actor),
-                E_MY_DIPLOMAT_FAILED, ftc_server,
+                E_UNIT_ILLEGAL_ACTION, ftc_server,
                 _("Your %s was unable to %s."),
                 unit_name_translation(actor),
                 gen_action_translated_name(stopped_action));


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

Reply via email to