Author: cazfi
Date: Thu Nov 19 21:23:02 2015
New Revision: 30696

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

See patch #6600

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

Modified: branches/S2_6/client/climisc.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/climisc.c?rev=30696&r1=30695&r2=30696&view=diff
==============================================================================
--- branches/S2_6/client/climisc.c      (original)
+++ branches/S2_6/client/climisc.c      Thu Nov 19 21:23:02 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: branches/S2_6/client/climisc.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/climisc.h?rev=30696&r1=30695&r2=30696&view=diff
==============================================================================
--- branches/S2_6/client/climisc.h      (original)
+++ branches/S2_6/client/climisc.h      Thu Nov 19 21:23:02 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: branches/S2_6/client/packhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/packhand.c?rev=30696&r1=30695&r2=30696&view=diff
==============================================================================
--- branches/S2_6/client/packhand.c     (original)
+++ branches/S2_6/client/packhand.c     Thu Nov 19 21:23:02 2015
@@ -1322,9 +1322,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: branches/S2_6/common/packets.def
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/packets.def?rev=30696&r1=30695&r2=30696&view=diff
==============================================================================
--- branches/S2_6/common/packets.def    (original)
+++ branches/S2_6/common/packets.def    Thu Nov 19 21:23:02 2015
@@ -576,6 +576,7 @@
   STRING message[MAX_LEN_MSG];
   TILE tile;
   EVENT event;
+  TURN turn;
   CONNECTION conn_id;
 end
 

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

Modified: branches/S2_6/server/notify.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/notify.c?rev=30696&r1=30695&r2=30696&view=diff
==============================================================================
--- branches/S2_6/server/notify.c       (original)
+++ branches/S2_6/server/notify.c       Thu Nov 19 21:23:02 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