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

 There's duplicate check for available nations count before triggering
civil war - one before civil_war() is called and another in the
beginning of civil_war(). Attached patch removes slow one before the
call. For S2_2 and TRUNK only.


 - ML

diff -Nurd -X.diff_ignore freeciv/server/citytools.c freeciv/server/citytools.c
--- freeciv/server/citytools.c  2008-06-25 12:21:39.000000000 +0300
+++ freeciv/server/citytools.c  2008-06-30 19:09:49.000000000 +0300
@@ -1267,7 +1267,7 @@
 **************************************************************************/
 void unit_enter_city(struct unit *punit, struct city *pcity, bool passenger)
 {
-  bool do_civil_war = FALSE;
+  bool try_civil_war = FALSE;
   int coins;
   struct player *pplayer = unit_owner(punit);
   struct player *cplayer = city_owner(pcity);
@@ -1307,15 +1307,7 @@
       && game.info.civilwarsize < GAME_MAX_CIVILWARSIZE
       && player_count_no_barbarians() < MAX_NUM_PLAYERS
       && civil_war_triggered(cplayer)) {
-    /* Do a civil war only if there's an available unused nation. */
-    nations_iterate(pnation) {
-      if (is_nation_playable(pnation)
-         && pnation->is_available
-         && !pnation->player) {
-       do_civil_war = TRUE;
-       break;
-      }
-    } nations_iterate_end;
+    try_civil_war = TRUE;
   }
 
   /* 
@@ -1331,7 +1323,7 @@
                     city_name(pcity),
                     player_name(pplayer));
     remove_city(pcity);
-    if (do_civil_war) {
+    if (try_civil_war) {
       civil_war(cplayer);
     }
     return;
@@ -1420,7 +1412,7 @@
   city_reduce_size(pcity, 1);
   send_player_info(pplayer, pplayer); /* Update techs */
 
-  if (do_civil_war) {
+  if (try_civil_war) {
     civil_war(cplayer);
   }
 }
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to