Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2003:
[Freeciv-Dev] Re: (PR#3010) core dump from client air goto
Home

[Freeciv-Dev] Re: (PR#3010) core dump from client air goto

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: per@xxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#3010) core dump from client air goto
From: "Gregory Berkolaiko via RT" <rt@xxxxxxxxxxxxxx>
Date: Fri, 7 Feb 2003 12:53:56 -0800
Reply-to: rt.freeciv.org@xxxxxxxxxxxxxx

Jason,

On Thu, 6 Feb 2003, Jason Short via RT wrote:

> This is caused indirectly by the 2837 warmap patch...
> 
> warmp_cost is set to either warmap.seacost or warmap.cost at the 
> beginning of the function.  But, apparently it is possible that at this 
> point warmap.*cost is still not allocated; it gets allocated at some 
> point during the function.  And then near the end of the function 
> warmap_cost is used.
> 
> The solution is simple: don't set warmap_cost until right before it's used.

You chose a strange place to set things.  It will be reset (unless 
optimized) every time a better route is found -- and that could be lots.

Why not set it right after init_warmap is called?

@@ -765,7 +760,11 @@
        die("Bad move_type in find_the_shortest_path().");
       } /****** end switch ******/

-      /* Add the route to our warmap if it is worth keeping */
+      /* Add the route to our warmap if it is worth keeping.  Land units
+       * use warmap.cost while sea units use warmap.seacost.  The only
+       * significance is that when making defensive calculations sometimes
+       * both will be used. */
+      warmap_cost = (move_type == SEA_MOVING) ? warmap.seacost : warmap.cost;

> 
> I also moved a comment associated with warmap_cost down, and "corrected" 
> it somewhat Greg, is this right?).

Well, it was your comment ;)
But I think the original puzzlement was over why air units use landmap and 
the answer is doesn't matter.  To the question why we need separate maps, 
it's actually for the attack code, when we contemplate taking a ferry to 
get to our victim (aiunit.c:1885).

G.




[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Re: (PR#3010) core dump from client air goto, Gregory Berkolaiko via RT <=