Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2005:
[Freeciv-Dev] (PR#12913) send the ruleset to the clients always
Home

[Freeciv-Dev] (PR#12913) send the ruleset to the clients always

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12913) send the ruleset to the clients always
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 27 Apr 2005 11:01:52 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12913 >

Currently the rulesets are sent to the client only on game start.
There's a complicated mechanism for determining when they need to be
sent.  In the new design the server always knows the rulesets and so
should the client.  Ideally this should be quite simple:

1.  Any time a client connects we send them the ruleset.
2.  Any time rulesets are changed we send out rulesets to everyone.

This patch accomplishes both of these, removing all other sending of the
rulesets.  Thus the client *should* know the rulesets at all times.
However it doesn't work because the client "automatically" forgets the
rulesets sometimes, for instance if you do /observe.  So under this
patch the client will crash if you try this.  However I can't figure out
where the client is freeing this data so I don't see how to fix it.
Mike, can you offer advice here?

-jason

Index: server/connecthand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/connecthand.c,v
retrieving revision 1.42
diff -u -r1.42 connecthand.c
--- server/connecthand.c        31 Mar 2005 17:48:34 -0000      1.42
+++ server/connecthand.c        27 Apr 2005 17:59:37 -0000
@@ -112,6 +112,10 @@
     }
   } conn_list_iterate_end;
 
+  send_packet_freeze_hint(pconn);
+  send_rulesets(dest);
+  send_packet_thaw_hint(pconn);
+
   /* a player has already been created for this user, reconnect him */
   if ((pplayer = find_player_by_user(pconn->username))) {
     attach_connection_to_player(pconn, pplayer);
@@ -120,7 +124,6 @@
       /* Player and other info is only updated when the game is running.
        * See the comment in lost_connection_to_client(). */
       send_packet_freeze_hint(pconn);
-      send_rulesets(dest);
       send_all_info(dest);
       send_game_state(dest, CLIENT_GAME_RUNNING_STATE);
       send_player_info(NULL,NULL);
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.247
diff -u -r1.247 ruleset.c
--- server/ruleset.c    27 Apr 2005 16:31:46 -0000      1.247
+++ server/ruleset.c    27 Apr 2005 17:59:38 -0000
@@ -3129,6 +3129,10 @@
   load_ruleset_effects(&effectfile);
   load_ruleset_game();
   translate_data_names();
+
+  /* Now that the rulesets are loaded we immediately send updates to any
+   * connected clients. */
+  send_rulesets(game.all_connections);
 }
 
 /**************************************************************************
Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.247
diff -u -r1.247 srv_main.c
--- server/srv_main.c   27 Apr 2005 16:31:46 -0000      1.247
+++ server/srv_main.c   27 Apr 2005 17:59:38 -0000
@@ -1750,8 +1750,6 @@
 
 main_start_players:
 
-  send_rulesets(game.game_connections);
-
   if (map.num_start_positions > 0) {
     start_nations = TRUE;
 
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.399
diff -u -r1.399 stdinhand.c
--- server/stdinhand.c  27 Apr 2005 16:31:47 -0000      1.399
+++ server/stdinhand.c  27 Apr 2005 17:59:39 -0000
@@ -2811,7 +2811,6 @@
 
   if (server_state == RUN_GAME_STATE) {
     send_packet_freeze_hint(pconn);
-    send_rulesets(pconn->self);
     send_all_info(pconn->self);
     send_game_state(pconn->self, CLIENT_GAME_RUNNING_STATE);
     send_player_info(NULL, NULL);
@@ -2973,7 +2972,6 @@
 
   if (server_state == RUN_GAME_STATE) {
     send_packet_freeze_hint(pconn);
-    send_rulesets(pconn->self);
     send_all_info(pconn->self);
     send_game_state(pconn->self, CLIENT_GAME_RUNNING_STATE);
     send_player_info(NULL, NULL);
@@ -3145,9 +3143,6 @@
   if (load_successful) {
     int i = 0;
 
-    /* We have to send ruleset info before sending the nations, below. */
-    send_rulesets(game.est_connections);
-
     players_iterate(pplayer) {
       if (game.nation_count && is_barbarian(pplayer)) {
        continue;

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12913) send the ruleset to the clients always, Jason Short <=