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

Attached patch makes the aifill call in load_ruleset only
activated when it is actually needed, instead of being
called all the time in the middle of game loads (etc.)
where it stomps all over the server player state.


-----------------------------------------------------------------------
お先に失礼します。
diff --git a/server/ruleset.c b/server/ruleset.c
index 4d541b7..01994a8 100644
--- a/server/ruleset.c
+++ b/server/ruleset.c
@@ -3682,9 +3682,14 @@ void load_rulesets(void)
   /* Build AI unit class cache corresponding to loaded rulesets */
   unit_class_ai_init();
 
-  /* We may need to adjust number of AI players if number of available
-   * nations changed */
-  aifill(game.info.aifill);
+  /* We may need to adjust the number of AI players
+   * if the number of available nations changed. */
+  if (game.info.aifill > server.playable_nations) {
+    freelog(LOG_NORMAL, _("Reducing aifill because there "
+                          "are not enough playable nations."));
+    game.info.aifill = server.playable_nations;
+    aifill(game.info.aifill);
+  }
 }
 
 /**************************************************************************
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to