Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2003:
[Freeciv-Dev] Re: (PR#3454) Server crash on Goto
Home

[Freeciv-Dev] Re: (PR#3454) Server crash on Goto

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: ChrisK@xxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#3454) Server crash on Goto
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Mon, 17 Feb 2003 10:04:53 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Mon, 17 Feb 2003, ChrisK@xxxxxxxx wrote:

> On Mon, Feb 17, 2003 at 02:37:38AM -0800, Christian Knoke wrote:
> > 
> > CVS 17 FEB 2003 GTK+ 1.2
> > 
> > Not reproducible server crash,
> 
> Now I can, with Jason's patch for 3455 applied.
> Have not tested without.
> 
> Use attached savegame, login as chris, start, press return,
> send alpine troops from Köln to Berlin.

No need to use a savegame, it crashes always.

The attached knludge fixes some of the crashes.  It is compound with 
Jason's patch for 3455.

Best wisehs,
G.

Index: ai/aitools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aitools.c,v
retrieving revision 1.79
diff -u -r1.79 aitools.c
--- ai/aitools.c        2003/02/17 08:38:34     1.79
+++ ai/aitools.c        2003/02/17 18:02:48
@@ -165,6 +165,10 @@
   enum unit_activity activity = punit->activity;
 
   CHECK_UNIT(punit);
+
+  /* FIXME: We set go pointer here but we never unset it! */
+  punit->go = &punit->goto_struct;
+
   /* TODO: log error on same_pos with punit->x|y */
   handle_unit_activity_request(punit, ACTIVITY_GOTO);
   result = do_unit_goto(punit, GOTO_MOVE_ANY, FALSE, x, y);
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.112
diff -u -r1.112 savegame.c
--- server/savegame.c   2003/02/17 08:38:36     1.112
+++ server/savegame.c   2003/02/17 18:02:49
@@ -981,18 +981,19 @@
                                                "player%d.u%d.connecting",
                                                plrno, i);
 
-    {
-      /* goto */
-      bool has_goto = secfile_lookup_bool_default(file, TRUE, 
"player%d.u%d.go",
-                                                  plrno, i);
-      if (has_goto) {
-        punit->go = &punit->goto_struct;
-        punit->go->x = secfile_lookup_int(file, 
-                                         "player%d.u%d.goto_x", plrno,i);
-        punit->go->y = secfile_lookup_int(file, 
-                                         "player%d.u%d.goto_y", plrno,i);
-      }
+    /* Load the goto information.  Older savegames will not have the
+     * "go" field, so we just load the goto destination by default. */
+    if (secfile_lookup_bool_default(file, TRUE,
+                                   "player%d.u%d.go", plrno, i)) {
+      punit->go = &punit->goto_struct;
+      punit->go->x = secfile_lookup_int(file,
+                                       "player%d.u%d.goto_x", plrno, i);
+      punit->go->y = secfile_lookup_int(file, 
+                                       "player%d.u%d.goto_y", plrno, i);
+    } else {
+      punit->go = NULL;
     }
+
     punit->ai.control=secfile_lookup_bool(file, "player%d.u%d.ai", plrno,i);
     punit->ai.ai_role = AIUNIT_NONE;
     punit->ai.ferryboat = 0;
Index: server/unithand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unithand.c,v
retrieving revision 1.254
diff -u -r1.254 unithand.c
--- server/unithand.c   2003/02/17 08:38:36     1.254
+++ server/unithand.c   2003/02/17 18:02:49
@@ -1466,6 +1466,9 @@
   if (!check_route(pplayer, packet))
     return;
 
+  /* FIXME: We set go pointer here but we never unset it! */
+  punit->go = &punit->goto_struct;
+
   handle_unit_activity_request(punit, ACTIVITY_GOTO);
   handle_route(pplayer, packet);
 }
@@ -1482,6 +1485,9 @@
     packet->pos = NULL;
     return;
   }
+
+  /* FIXME: We set go pointer here but we never unset it! */
+  punit->go = &punit->goto_struct;
 
   handle_unit_activity_request(punit, ACTIVITY_PATROL);
   handle_route(pplayer, packet);

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