Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2005:
[Freeciv-Dev] (PR#13327) Scenario and nation selection
Home

[Freeciv-Dev] (PR#13327) Scenario and nation selection

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13327) Scenario and nation selection
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Tue, 20 Sep 2005 03:59:58 -0700
Reply-to: bugs@xxxxxxxxxxx

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

Here's a proper patch.
As you can see there were bugs I had to fix.
--
mateusz
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.548
diff -u -r1.548 packhand.c
--- client/packhand.c   5 Sep 2005 15:55:45 -0000       1.548
+++ client/packhand.c   20 Sep 2005 10:54:37 -0000
@@ -180,7 +180,11 @@
     aconnection.id = conn_id;
     agents_game_joined();
     update_menus();
-    set_client_page(PAGE_START);
+    
+    
+    if (get_client_page() == PAGE_MAIN) {
+      set_client_page(PAGE_START);
+    }
 
     /* we could always use hack, verify we're local */ 
     send_client_wants_hack(challenge_file);
Index: client/gui-gtk-2.0/pages.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/pages.c,v
retrieving revision 1.40
diff -u -r1.40 pages.c
--- client/gui-gtk-2.0/pages.c  5 Sep 2005 15:55:45 -0000       1.40
+++ client/gui-gtk-2.0/pages.c  20 Sep 2005 10:54:52 -0000
@@ -98,7 +98,6 @@
 static void start_scenario_callback(GtkWidget *w, gpointer data)
 {
   set_client_page(PAGE_SCENARIO);
-
   start_new_game_callback(NULL, NULL);
 }
 
@@ -1274,9 +1273,23 @@
 {
   if (!packet->load_successful) {
   } else {
-    update_nation_page(packet);
+    if (game.info.is_new_game) {
+      char message[MAX_LEN_MSG];
+
+      set_client_page(PAGE_START);
+      
+      /* It's pregame. Create a player and connect to him */
+      my_snprintf(message, sizeof(message), "/create %s", user_name);
+      send_chat(message);
+      my_snprintf(message, sizeof(message), "/ai %s", user_name);
+      send_chat(message);
+      my_snprintf(message, sizeof(message), "/take \"%s\"", user_name);
+      send_chat(message);
 
-    set_client_page(PAGE_NATION);
+    } else {
+      update_nation_page(packet);
+      set_client_page(PAGE_NATION);
+    }
   }
 }
 
@@ -1736,6 +1749,13 @@
   return box;
 }
 
+/**************************************************************************
+  Returns current client page
+**************************************************************************/
+enum client_pages get_client_page(void)
+{
+  return old_page;
+}
 
 /**************************************************************************
   changes the current page.
@@ -1746,6 +1766,7 @@
   enum client_pages new_page;
 
   new_page = page;
+  
 
   /* If the page remains the same, don't do anything. */
   if (old_page == new_page) {
@@ -1753,12 +1774,8 @@
   }
 
   switch (old_page) {
-  /* We aren't interested in showing a start page on game load or scenario. */
   case PAGE_SCENARIO:
   case PAGE_LOAD:
-    if (new_page == PAGE_START) {
-      return;
-    }
     break;
   case PAGE_NETWORK:
     if (lan_timer != 0) {
Index: client/include/pages_g.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/include/pages_g.h,v
retrieving revision 1.2
diff -u -r1.2 pages_g.h
--- client/include/pages_g.h    28 Mar 2005 17:19:27 -0000      1.2
+++ client/include/pages_g.h    20 Sep 2005 10:54:52 -0000
@@ -27,5 +27,6 @@
 };
 
 void set_client_page(enum client_pages page);
+enum client_pages get_client_page(void);
 
 #endif  /* FC__PAGES_G_H */
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.436
diff -u -r1.436 stdinhand.c
--- server/stdinhand.c  5 Sep 2005 15:55:47 -0000       1.436
+++ server/stdinhand.c  20 Sep 2005 10:55:43 -0000
@@ -3173,6 +3173,9 @@
           read_timer_seconds_free(uloadtimer));
 
   sanity_check();
+  
+  send_game_info(game.est_connections);
+  send_rulesets(game.est_connections);
 
   /* Everything seemed to load ok; spread the good news. */
   send_load_game_info(TRUE);

[Prev in Thread] Current Thread [Next in Thread]