Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2005:
[Freeciv-Dev] (PR#14826) rename is_game_over
Home

[Freeciv-Dev] (PR#14826) rename is_game_over

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#14826) rename is_game_over
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 10 Dec 2005 19:15:40 -0800
Reply-to: bugs@xxxxxxxxxxx

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

is_game_over is renamed: it's not a simple query since it has side effects.

This patch renames it to check_for_game_over.  A future patch could move 
the server state check into check_for_game_over.

-jason

Index: server/srv_main.c
===================================================================
--- server/srv_main.c   (revision 11338)
+++ server/srv_main.c   (working copy)
@@ -200,9 +200,13 @@
 }
 
 /**************************************************************************
-  Returns TRUE if any one game end condition is fulfilled, FALSE otherwise
+  Returns TRUE if any one game end condition is fulfilled, FALSE otherwise.
+
+  This function will notify players but will not set the server_state. The
+  caller must set the server state to GAME_OVER_STATE if the function
+  returns TRUE.
 **************************************************************************/
-bool is_game_over(void)
+bool check_for_game_over(void)
 {
   int barbs = 0, alive = 0;
   struct player *victor = NULL, *spacer = NULL;
@@ -1648,7 +1652,7 @@
     freelog(LOG_DEBUG, "Sendinfotometaserver");
     (void) send_server_info_to_metaserver(META_REFRESH);
 
-    if (server_state != GAME_OVER_STATE && is_game_over()) {
+    if (server_state != GAME_OVER_STATE && check_for_game_over()) {
       server_state=GAME_OVER_STATE;
     }
   }
Index: server/srv_main.h
===================================================================
--- server/srv_main.h   (revision 11338)
+++ server/srv_main.h   (working copy)
@@ -55,7 +55,7 @@
 void server_quit(void);
 void save_game_auto(const char *save_reason);
 
-bool is_game_over(void);
+bool check_for_game_over(void);
 
 bool handle_packet_input(struct connection *pconn, void *packet, int type);
 void start_game(void);
Index: server/stdinhand.c
===================================================================
--- server/stdinhand.c  (revision 11338)
+++ server/stdinhand.c  (working copy)
@@ -3632,7 +3632,7 @@
                    _("%s has conceded the game and can no longer win."),
                    caller->player->name);
     caller->player->surrendered = TRUE;
-    if (is_game_over()) {
+    if (check_for_game_over()) {
       server_state = GAME_OVER_STATE;
       force_end_of_sniff = TRUE;
     }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#14826) rename is_game_over, Jason Short <=