Author: cazfi
Date: Thu Nov 19 21:22:47 2015
New Revision: 30695

URL: http://svn.gna.org/viewcvs/freeciv?rev=30695&view=rev
Log:
Send the turn event originally took place to the client with the event packet.

See patch #6600

Modified:
    trunk/client/climisc.c
    trunk/client/climisc.h
    trunk/client/packhand.c
    trunk/common/packets.def
    trunk/fc_version
    trunk/server/notify.c

Modified: trunk/client/climisc.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/climisc.c?rev=30695&r1=30694&r2=30695&view=diff
==============================================================================
--- trunk/client/climisc.c      (original)
+++ trunk/client/climisc.c      Thu Nov 19 21:22:47 2015
@@ -938,7 +938,7 @@
   Handles a chat or event message.
 **************************************************************************/
 void handle_event(const char *featured_text, struct tile *ptile,
-                 enum event_type event, int conn_id)
+                 enum event_type event, int turn, int conn_id)
 {
   char plain_text[MAX_LEN_MSG];
   struct text_tag_list *tags;
@@ -1075,9 +1075,9 @@
 
     featured_text_apply_tag(message, colored_text, sizeof(colored_text),
                             TTT_COLOR, 0, FT_OFFSET_UNSET, color);
-    handle_event(colored_text, ptile, event, -1);
-  } else {
-    handle_event(message, ptile, event, -1);
+    handle_event(colored_text, ptile, event, game.info.turn, -1);
+  } else {
+    handle_event(message, ptile, event, game.info.turn, -1);
   }
 }
 

Modified: trunk/client/climisc.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/climisc.h?rev=30695&r1=30694&r2=30695&view=diff
==============================================================================
--- trunk/client/climisc.h      (original)
+++ trunk/client/climisc.h      Thu Nov 19 21:22:47 2015
@@ -106,7 +106,7 @@
 int num_supported_units_in_city(struct city* pcity);   
 
 void handle_event(const char *featured_text, struct tile *ptile,
-                  enum event_type event, int conn_id);
+                  enum event_type event, int turn, int conn_id);
 void create_event(struct tile *ptile, enum event_type event,
                   const struct ft_color color, const char *format, ...)
                   fc__attribute((__format__ (__printf__, 4, 5)));

Modified: trunk/client/packhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/packhand.c?rev=30695&r1=30694&r2=30695&view=diff
==============================================================================
--- trunk/client/packhand.c     (original)
+++ trunk/client/packhand.c     Thu Nov 19 21:22:47 2015
@@ -1351,9 +1351,9 @@
   in-game messages and chats from other players.
 **************************************************************************/
 void handle_chat_msg(const char *message, int tile,
-                     enum event_type event, int conn_id)
-{
-  handle_event(message, index_to_tile(tile), event, conn_id);
+                     enum event_type event, int turn, int conn_id)
+{
+  handle_event(message, index_to_tile(tile), event, turn, conn_id);
 }
 
 /**************************************************************************

Modified: trunk/common/packets.def
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/packets.def?rev=30695&r1=30694&r2=30695&view=diff
==============================================================================
--- trunk/common/packets.def    (original)
+++ trunk/common/packets.def    Thu Nov 19 21:22:47 2015
@@ -584,6 +584,7 @@
   STRING message[MAX_LEN_MSG];
   TILE tile;
   EVENT event;
+  TURN turn;
   CONNECTION conn_id;
 end
 

Modified: trunk/fc_version
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/fc_version?rev=30695&r1=30694&r2=30695&view=diff
==============================================================================
--- trunk/fc_version    (original)
+++ trunk/fc_version    Thu Nov 19 21:22:47 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.Nov.19"
+NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.0-2015.Nov.19b"
 NETWORK_CAPSTRING_OPTIONAL=""
 
 FREECIV_DISTRIBUTOR=""

Modified: trunk/server/notify.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/notify.c?rev=30695&r1=30694&r2=30695&view=diff
==============================================================================
--- trunk/server/notify.c       (original)
+++ trunk/server/notify.c       Thu Nov 19 21:22:47 2015
@@ -67,6 +67,7 @@
   packet->tile = (NULL != ptile ? tile_index(ptile) : -1);
   packet->event = event;
   packet->conn_id = pconn ? pconn->id : -1;
+  packet->turn = game.info.turn;
 
   fc_vsnprintf(buf, sizeof(buf), format, vargs);
   if (is_capitalization_enabled()) {
@@ -444,7 +445,6 @@
 /* Events are saved in that structure. */
 struct event_cache_data {
   struct packet_chat_msg packet;
-  int turn;
   time_t timestamp;
   enum server_states server_state;
   enum event_cache_target target_type;
@@ -518,7 +518,6 @@
 
   pdata = fc_malloc(sizeof(*pdata));
   pdata->packet = *packet;
-  pdata->turn = turn;
   pdata->timestamp = timestamp;
   pdata->server_state = server_status;
   pdata->target_type = target_type;
@@ -582,7 +581,7 @@
 void event_cache_remove_old(void)
 {
   event_cache_iterate(pdata) {
-    if (pdata->turn + game.server.event_cache.turns <= game.info.turn) {
+    if (pdata->packet.turn + game.server.event_cache.turns <= game.info.turn) {
       event_cache_data_destroy(pdata);
     }
   } event_cache_iterate_end;
@@ -703,8 +702,8 @@
   }
 
   if (server_state() == S_S_RUNNING
-      && game.info.turn < pdata->turn
-      && game.info.turn > pdata->turn - game.server.event_cache.turns) {
+      && game.info.turn < pdata->packet.turn
+      && game.info.turn > pdata->packet.turn - game.server.event_cache.turns) {
     return FALSE;
   }
 
@@ -741,7 +740,7 @@
                  localtime(&pdata->timestamp));
         pcm = pdata->packet;
         fc_snprintf(pcm.message, sizeof(pcm.message), "(T%d - %s) %s",
-                    pdata->turn, timestr, pdata->packet.message);
+                    pdata->packet.turn, timestr, pdata->packet.message);
         notify_conn_packet(pconn->self, &pcm);
       } else {
         notify_conn_packet(pconn->self, &pdata->packet);
@@ -881,7 +880,7 @@
       index_to_map_pos(&tile_x, &tile_y, tile_index(ptile));
     }
 
-    secfile_insert_int(file, pdata->turn, "%s.events%d.turn",
+    secfile_insert_int(file, pdata->packet.turn, "%s.events%d.turn",
                        section, event_count);
     secfile_insert_int(file, pdata->timestamp, "%s.events%d.timestamp",
                        section, event_count);


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

Reply via email to