[Freeciv-Dev] (PR#34145) [Bug] Aiferry memory problem

2007-01-20 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=34145 

 Autogames differ between executions.

 This is what valgrind found out:

==6086== Conditional jump or move depends on uninitialised value(s)
==6086==at 0x811ED99: ai_manage_ferryboat (aiferry.c:795)
==6086==by 0x812F8AD: ai_manage_unit (aiunit.c:2150)
==6086==by 0x812FE8F: ai_manage_units (aiunit.c:2268)
==6086==by 0x8120681: ai_do_first_activities (aihand.c:425)
==6086==by 0x80527A5: main_loop (srv_main.c:536)
==6086==by 0x80533E3: srv_main (srv_main.c:1993)
==6086==by 0x804A63B: main (civserver.c:256)


 - ML



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#34145) [Bug] Aiferry memory problem

2007-01-20 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=34145 

On 1/20/07, Marko Lindqvist [EMAIL PROTECTED] wrote:

 URL: http://bugs.freeciv.org/Ticket/Display.html?id=34145 

  Autogames differ between executions.

  This is what valgrind found out:

 ==6086== Conditional jump or move depends on uninitialised value(s)
 ==6086==at 0x811ED99: ai_manage_ferryboat (aiferry.c:795)
 ==6086==by 0x812F8AD: ai_manage_unit (aiunit.c:2150)
 ==6086==by 0x812FE8F: ai_manage_units (aiunit.c:2268)
 ==6086==by 0x8120681: ai_do_first_activities (aihand.c:425)
 ==6086==by 0x80527A5: main_loop (srv_main.c:536)
 ==6086==by 0x80533E3: srv_main (srv_main.c:1993)
 ==6086==by 0x804A63B: main (civserver.c:256)

 Initializing ai.choice for newly built cities and cities from huts
seems to fix autogame problem. I'm still running valgrind test.


 - ML

diff -Nurd -X.diff_ignore freeciv/server/settlers.c freeciv/server/settlers.c
--- freeciv/server/settlers.c	2007-01-18 17:20:23.0 +0200
+++ freeciv/server/settlers.c	2007-01-20 11:23:34.0 +0200
@@ -100,6 +100,9 @@
   assert(pplayer == city_owner(pcity));
   initialize_infrastructure_cache(pplayer);
 
+  /* Init ai.choice. Handling ferryboats might use it. */
+  init_choice(pcity-ai.choice);
+
   return TRUE;
 }
 
diff -Nurd -X.diff_ignore freeciv/server/unittools.c freeciv/server/unittools.c
--- freeciv/server/unittools.c	2007-01-19 14:06:45.0 +0200
+++ freeciv/server/unittools.c	2007-01-20 11:34:38.0 +0200
@@ -2309,6 +2309,9 @@
   initialize_infrastructure_cache(pplayer);
 }
 
+/* Init ai.choice. Handling ferryboats might use it. */
+init_choice(punit-tile-city-ai.choice);
+
   } else {
 notify_player(pplayer, punit-tile, E_HUT_SETTLER,
 		 _(Friendly nomads are impressed by you,
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev