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

2008/4/16 Marko Lindqvist:
>
>  Even with #40194 restoring check for minplayers -setting, it is not
> same as it used to be. Now that aifill players are created before game
> starts, they count toward minplayers.

 People would use minplayers setting only to make sure that they are
playeing against suitable number of human opponents instead of AI
players. Attahed patch makes only human players to count towards
minplayers.


 - ML

diff -Nurd -X.diff_ignore freeciv/server/settings.c freeciv/server/settings.c
--- freeciv/server/settings.c   2008-03-16 22:19:42.000000000 +0200
+++ freeciv/server/settings.c   2008-06-15 01:08:13.000000000 +0300
@@ -439,7 +439,7 @@
           SSET_TO_CLIENT,
          N_("Minimum number of players"),
          N_("There must be at least this many players (connected "
-            "human players or AI players) before the game can start."),
+            "human players) before the game can start."),
          NULL,
          GAME_MIN_MIN_PLAYERS, GAME_MAX_MIN_PLAYERS, GAME_DEFAULT_MIN_PLAYERS)
 
diff -Nurd -X.diff_ignore freeciv/server/stdinhand.c freeciv/server/stdinhand.c
--- freeciv/server/stdinhand.c  2008-05-10 01:48:22.000000000 +0300
+++ freeciv/server/stdinhand.c  2008-06-15 01:06:41.000000000 +0300
@@ -3782,6 +3782,8 @@
 **************************************************************************/
 bool start_command(struct connection *caller, bool check, bool notify)
 {
+  int human_players;
+
   switch (server_state()) {
   case S_S_INITIAL:
     /* Sanity check scenario */
@@ -3815,10 +3817,17 @@
       }
     }
 
+    human_players = 0;
+    players_iterate(plr) {
+      if (!plr->ai.control) {
+        human_players++;
+      }
+    } players_iterate_end;
+
     /* check min_players */
-    if (game.info.nplayers < game.info.min_players) {
+    if (human_players < game.info.min_players) {
       start_cmd_reply(caller, notify,
-                      _("Not enough players, game will not start."));
+                      _("Not enough human players, game will not start."));
       return FALSE;
     } else if (game.info.nplayers - server.nbarbarians > 
server.playable_nations) {
       cmd_reply(CMD_START_GAME, caller, C_FAIL,
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to