Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2003:
[Freeciv-Dev] (PR#5580) [Patch] Assert initial cost >= 0 in PF
Home

[Freeciv-Dev] (PR#5580) [Patch] Assert initial cost >= 0 in PF

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#5580) [Patch] Assert initial cost >= 0 in PF
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Sat, 30 Aug 2003 12:10:40 -0700
Reply-to: rt@xxxxxxxxxxxxxx

The attached is a trivial patch, but I have a feeling it might help track 
down some strange crashes like 4568...

G.

Index: common/aicore/path_finding.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/aicore/path_finding.c,v
retrieving revision 1.10
diff -u -r1.10 path_finding.c
--- common/aicore/path_finding.c        2003/07/17 22:33:34     1.10
+++ common/aicore/path_finding.c        2003/08/30 19:08:25
@@ -396,6 +396,7 @@
    * need to subtract this value before we return cost to the user */
   pf_map->lattice[pf_map->index].cost = pf_map->params->move_rate
       - pf_map->params->moves_left_initially;
+  assert(pf_map->lattice[pf_map->index].cost >= 0);
   pf_map->lattice[pf_map->index].extra_cost = 0;
   if (pf_map->params->is_pos_dangerous) {
     /* The starting point is safe */

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#5580) [Patch] Assert initial cost >= 0 in PF, Gregory Berkolaiko <=