Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2003:
[Freeciv-Dev] Re: (PR#4733) shuffle_players on game load?
Home

[Freeciv-Dev] Re: (PR#4733) shuffle_players on game load?

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#4733) shuffle_players on game load?
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 31 Jul 2003 22:28:02 -0700
Reply-to: rt@xxxxxxxxxxxxxx

Jason Short wrote:
> When a game is saved in the middle of a turn, shuffle_players should not 
> be called immediately.

Something like this should solve it.  But this implementation is a bit 
of a hack.

jason

Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.132
diff -u -r1.132 srv_main.c
--- server/srv_main.c   2003/07/21 01:23:27     1.132
+++ server/srv_main.c   2003/08/01 05:26:02
@@ -145,6 +145,7 @@
 
 /* server initialized flag */
 static bool has_been_srv_init = FALSE;
+static bool was_game_just_loaded = FALSE;
 
 /**************************************************************************
 ...
@@ -1436,10 +1437,13 @@
 
     force_end_of_sniff = FALSE;
 
-    freelog(LOG_DEBUG, "Shuffleplayers");
-    shuffle_players();
-    freelog(LOG_DEBUG, "Aistartturn");
-    ai_start_turn();
+    if (!was_game_just_loaded) {
+      freelog(LOG_DEBUG, "Shuffleplayers");
+      shuffle_players();
+      freelog(LOG_DEBUG, "Aistartturn");
+      ai_start_turn();
+    }
+    was_game_just_loaded = FALSE;
     send_start_turn_to_clients();
 
     /* 
@@ -1564,6 +1568,7 @@
   /* load a saved game */
   if (srvarg.load_filename) {
     load_command(NULL, srvarg.load_filename);
+    was_game_just_loaded = TRUE;
   } 
 
   if(!(srvarg.metaserver_no_send)) {

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