Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2005:
[Freeciv-Dev] (PR#13451) client tech crash when connecting to server
Home

[Freeciv-Dev] (PR#13451) client tech crash when connecting to server

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#13451) client tech crash when connecting to server
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Wed, 13 Jul 2005 10:58:53 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13451 >

> [mstefek - Tue Jul 12 07:08:30 2005]:
> 
> > [jdorje - Mon Jul 11 23:28:24 2005]:
> > 
> > If I use one client to "start new game" then connect to this pregame
> > server with another client, the second client crashes:
> > 
> > civclient: tech.c:504: base_total_bulbs_required: Assertion
> > `pplayer->ai.science_cost > 0' failed.
[...]
> Sorry, I can't reproduce this with the latest CVS version, nor have I
> any valgrind errors (besides the gtk ones).
> --
> mateusz
> 
Jason, can you try this patch?

Seems like ai.science_cost is undefined for human players and at the
time when the assertion occurs ai.science_cost is just a garbage. This
is why I can't reproduce that.
--
mateusz

Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.528
diff -u -r1.528 packhand.c
--- client/packhand.c   9 Jul 2005 17:46:07 -0000       1.528
+++ client/packhand.c   13 Jul 2005 17:57:57 -0000
@@ -1459,7 +1459,17 @@
   for (i = 0; i < B_LAST/*game.control.num_impr_types*/; i++) {
      pplayer->small_wonders[i] = pinfo->small_wonders[i];
   }
-  
+
+  /* We need to set ai.control before read_player_info_techs */
+  if(pplayer->ai.control!=pinfo->ai)  {
+    pplayer->ai.control=pinfo->ai;
+    if(pplayer==game.player_ptr)  {
+      my_snprintf(msg, sizeof(msg), _("AI Mode is now %s."),
+                 game.player_ptr->ai.control?_("ON"):_("OFF"));
+      append_output_window(msg);
+    }
+  }
+
   pplayer->ai.science_cost = pinfo->science_cost;
 
   /* If the server sends out player information at the wrong time, it is
@@ -1515,14 +1525,6 @@
 
   pplayer->ai.barbarian_type = pinfo->barbarian_type;
   pplayer->revolution_finishes = pinfo->revolution_finishes;
-  if(pplayer->ai.control!=pinfo->ai)  {
-    pplayer->ai.control=pinfo->ai;
-    if(pplayer==game.player_ptr)  {
-      my_snprintf(msg, sizeof(msg), _("AI Mode is now %s."),
-                 game.player_ptr->ai.control?_("ON"):_("OFF"));
-      append_output_window(msg);
-    }
-  }
   pplayer->ai.skill_level = pinfo->ai_skill_level;
 
   update_players_dialog();

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