Complete.Org: Mailing Lists: Archives: freeciv-ai: August 2004:
[freeciv-ai] (PR#9631) server blocked
Home

[freeciv-ai] (PR#9631) server blocked

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: ggracian@xxxxxxx
Subject: [freeciv-ai] (PR#9631) server blocked
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxxx>
Date: Sat, 7 Aug 2004 10:43:27 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9631 >

> [eneg - Sat Aug 07 16:12:38 2004]:
>  
> when turn done the game freezes and the only way to stop the server is
> to ctrl-c in the console.

It was new AI settler code using uninitialized values.
The bug would appear only for fulltradesize != 1

Attached is a fix (I couldn't stop myself for reformatting some places).

G.

Index: ai/aisettler.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aisettler.c,v
retrieving revision 1.2
diff -u -r1.2 aisettler.c
--- ai/aisettler.c      6 Aug 2004 10:35:48 -0000       1.2
+++ ai/aisettler.c      7 Aug 2004 17:41:15 -0000
@@ -232,26 +232,28 @@
      * never make cities. */
     if (game.fulltradesize == 1) {
       result->corruption = ai->science_priority
-                     * city_corruption(pcity, 
-                                 result->tile[result->o_x][result->o_y].trade
-                                 + result->tile[2][2].trade);
+       * city_corruption(pcity, 
+                         result->tile[result->o_x][result->o_y].trade
+                         + result->tile[2][2].trade);
+    } else {
+      result->corruption = 0;
     }
     result->waste = ai->shield_priority
-                     * city_waste(pcity,
-                                  result->tile[result->o_x][result->o_y].shield
-                                  + result->tile[2][2].shield);
+      * city_waste(pcity,
+                  result->tile[result->o_x][result->o_y].shield
+                  + result->tile[2][2].shield);
   } else {
     /* Deduct difference in corruption and waste for real cities. Note that it
      * is possible (with notradesize) that we _gain_ value here. */
     pcity->size++;
     result->corruption = ai->science_priority
-                     * (city_corruption(pcity,
-                                 result->tile[result->o_x][result->o_y].trade)
-                        - pcity->corruption);
+      * (city_corruption(pcity,
+                        result->tile[result->o_x][result->o_y].trade)
+        - pcity->corruption);
     result->waste = ai->shield_priority
-                     * (city_waste(pcity,
-                                   
result->tile[result->o_x][result->o_y].shield)
-                        - pcity->shield_waste);
+      * (city_waste(pcity,
+                   result->tile[result->o_x][result->o_y].shield)
+        - pcity->shield_waste);
     pcity->size--;
   }
   result->total -= result->corruption;
@@ -460,8 +462,8 @@
   TODO: Transparently check if we should add ourselves to an existing city.
 **************************************************************************/
 static bool settler_map_iterate(struct pf_parameter *parameter,
-                                        struct unit *punit,
-                                        struct cityresult *best,
+                               struct unit *punit,
+                               struct cityresult *best,
                                struct player *pplayer, 
                                int boat_cost)
 {

[Prev in Thread] Current Thread [Next in Thread]
  • [freeciv-ai] (PR#9631) server blocked, Gregory Berkolaiko <=