Author: sveinung
Date: Fri Aug 14 15:05:15 2015
New Revision: 29499

URL: http://svn.gna.org/viewcvs/freeciv?rev=29499&view=rev
Log:
orders system: explain known illegal action

A perform action order can be canceled if the player has enough information
to know that the ordered action is illegal. This is done to escape any
punishment trying to do an illegal action may bring. Try to explanation why
the action was illegal in case the player haven't noticed the information or
doesn't know the rules.

See patch #6228

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

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=29499&r1=29498&r2=29499&view=diff
==============================================================================
--- trunk/server/unithand.c     (original)
+++ trunk/server/unithand.c     Fri Aug 14 15:05:15 2015
@@ -1021,13 +1021,13 @@
   action is illegal or E_UNIT_ILLEGAL_ACTION if the player potentially new
   information is being revealed.
 **************************************************************************/
-static void illegal_action_msg(struct player *pplayer,
-                               const enum event_type event,
-                               struct unit *actor,
-                               const int stopped_action,
-                               const struct tile *target_tile,
-                               const struct city *target_city,
-                               const struct unit *target_unit)
+void illegal_action_msg(struct player *pplayer,
+                        const enum event_type event,
+                        struct unit *actor,
+                        const int stopped_action,
+                        const struct tile *target_tile,
+                        const struct city *target_city,
+                        const struct unit *target_unit)
 {
   struct ane_expl *expl;
 

Modified: trunk/server/unithand.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.h?rev=29499&r1=29498&r2=29499&view=diff
==============================================================================
--- trunk/server/unithand.h     (original)
+++ trunk/server/unithand.h     Fri Aug 14 15:05:15 2015
@@ -37,4 +37,12 @@
                          const char *name,
                          const enum gen_action action_type);
 
+void illegal_action_msg(struct player *pplayer,
+                        const enum event_type event,
+                        struct unit *actor,
+                        const int stopped_action,
+                        const struct tile *target_tile,
+                        const struct city *target_city,
+                        const struct unit *target_unit);
+
 #endif  /* FC__UNITHAND_H */

Modified: trunk/server/unittools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unittools.c?rev=29499&r1=29498&r2=29499&view=diff
==============================================================================
--- trunk/server/unittools.c    (original)
+++ trunk/server/unittools.c    Fri Aug 14 15:05:15 2015
@@ -4101,6 +4101,10 @@
                       action_get_ui_name(order.action),
                       tile_link(dst_tile));
 
+        /* Try to explain what rule made it illegal. */
+        illegal_action_msg(unit_owner(punit), E_BAD_COMMAND, punit,
+                           order.action, dst_tile, tgt_city, NULL);
+
         return TRUE;
       }
 


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

Reply via email to