Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2003:
[Freeciv-Dev] Re: (PR#4815) failed assertion in client goto
Home

[Freeciv-Dev] Re: (PR#4815) failed assertion in client goto

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#4815) failed assertion in client goto
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 10 Aug 2003 23:19:55 -0700
Reply-to: rt@xxxxxxxxxxxxxx

Jason Short wrote:
> Jason Short wrote:
> 
>>I suspect the assertions are spurious.  Too bad there's no comment 
>>explaining why they're there.  Really, I don't understand why they 
>>didn't always fail.  These values are initialized when you enter the 
>>goto state, and never unitialized.  What am I missing?
> 
> 
> Ahh.  They are set to NULL by pft_fill_[default|unit]_parameter.  I 
> suppose this means they're always spurious.  But since I don't know why 
> they were there in the first place, maybe they should be kept around?

Here's a correct version of the patch.

jason

? rc
Index: client/goto.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/goto.c,v
retrieving revision 1.56
diff -u -r1.56 goto.c
--- client/goto.c       2003/08/11 02:31:38     1.56
+++ client/goto.c       2003/08/11 06:18:55
@@ -364,7 +364,9 @@
 {
   pft_fill_default_parameter(parameter);
   pft_fill_unit_parameter(parameter, punit);
+  assert(parameter->get_EC == NULL);
   parameter->get_EC = get_EC;
+  assert(parameter->get_TB == NULL);
   if (unit_type(punit)->attack_strength > 0) {
     parameter->get_TB = get_TB_aggr;
   } else {
@@ -389,8 +391,6 @@
   goto_map.unit_id = punit->id;
   assert(goto_map.num_parts == 0);
 
-  assert(goto_map.template.get_EC == NULL);
-  assert(goto_map.template.get_TB == NULL);
   fill_client_goto_parameter(punit, &goto_map.template);
 
   add_part();

[Prev in Thread] Current Thread [Next in Thread]