Complete.Org: Mailing Lists: Archives: freeciv-dev: December 1999:
[Freeciv-Dev] FPE at ai/advmilitary.c:466 (PR#218)
Home

[Freeciv-Dev] FPE at ai/advmilitary.c:466 (PR#218)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] FPE at ai/advmilitary.c:466 (PR#218)
From: Markus Linnala <maage@xxxxxxxxx>
Date: Thu, 30 Dec 1999 15:09:49 -0800 (PST)

Program terminated with signal 8, Floating point exception.
#0  0x80e92a8 in process_defender_want (pplayer=0x8296630, pcity=0x82e4410, 
    danger=100, choice=0x82e4710)
    at /usr/src/freeciv/freeciv/ai/advmilitary.c:466
466           n = desire[i] * unit_types[bestid].build_cost / best;
(gdb) print best
$1 = 0

Maybe this patch fixes this problem.

Index: advmilitary.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advmilitary.c,v
retrieving revision 1.54
diff -u -u -r1.54 advmilitary.c
--- advmilitary.c       1999/08/21 02:10:27     1.54
+++ advmilitary.c       1999/12/30 23:06:45
@@ -459,6 +459,10 @@
     best *= pcity->ai.wallvalue;
     best /= 10;
   } /* was getting four-figure desire for battleships otherwise. -- Syela */
+
+  /* Guard */
+  if (best == 0) best = 1;
+
 /* Phalanx would be 16 * danger / 20.  Pikemen would be 36 * danger / (20 + l) 
*/
 /* multiply by unit_types[bestid].build_cost / best */
   for (i = 0; i < game.num_unit_types; i++) {


-- 
//Markus


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] FPE at ai/advmilitary.c:466 (PR#218), Markus Linnala <=