Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2004:
[Freeciv-Dev] Re: (PR#7315) re: Crashing Freeciv server in Windows XP
Home

[Freeciv-Dev] Re: (PR#7315) re: Crashing Freeciv server in Windows XP

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: sledge@xxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7315) re: Crashing Freeciv server in Windows XP
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Mon, 26 Jan 2004 02:25:31 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7315 >

On Sun, Jan 25, 2004 at 12:14:31AM -0800, Nathaniel Olsen wrote:
> 
> Hi there,
> Got a nice lil crash going on when running a specific save file.  This is 
> with the GTK windows client.  I can send the save file if needed, but this 
> is the way it happens.  Load game and connect with the client with no 
> problem.  Game starts fine and human player is able to do all moves 
> without incident.  Hit end turn and the server dies spewing out the 
> message below.
> 
> > Assertion failed: (tech_exists(tech_found) && get_invention(plr, 
> > tech_found) !
> = TECH_KNOWN) || tech_found == A_FUTURE, file 
> /home/andi/win-snap/freeciv-cvs-Ja
> n-23/server/plrhand.c, line 284

In the savegame an AI player researched a tech which he already
knows. This is bad. I have fixed this at the savegame loading. I have
also added a check in sanitycheck.c. I _guess_ that this is caused by
AI-diplomacy but this is hard from the savegame alone. But this patch
should be applied nevertheless.

Nathaniel: do you have an earlier savegame from which you can
reproduce this error and which doesn't show a warning with this patch?

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Many of my assistants were fans of Tolkien, who wrote 'Lord of the Rings'
  and a number of other children's stories for adults.  The first character
  alphabet that was programmed for my plotter was Elvish rather than Latin."
    -- from SAIs "life as a computer for a quarter of a century"

Index: server/sanitycheck.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/sanitycheck.c,v
retrieving revision 1.40
diff -u -u -r1.40 sanitycheck.c
--- server/sanitycheck.c        2004/01/25 08:04:53     1.40
+++ server/sanitycheck.c        2004/01/26 10:20:30
@@ -343,6 +343,13 @@
        assert(pplayer->diplstates[pplayer2->player_no].turns_left
               == pplayer2->diplstates[pplayer->player_no].turns_left);
     } players_iterate_end;
+
+    assert((tech_exists(pplayer->research.researching)
+           && get_invention(pplayer,
+                            pplayer->research.researching) != TECH_KNOWN)
+          || pplayer->research.researching == A_FUTURE);
+    assert(tech_is_available(pplayer, pplayer->research.researching)
+          || pplayer->research.researching == A_FUTURE);
   } players_iterate_end;
 
   /* Sanity checks on living and dead players. */
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.145
diff -u -u -r1.145 savegame.c
--- server/savegame.c   2004/01/20 21:52:09     1.145
+++ server/savegame.c   2004/01/26 10:20:33
@@ -747,6 +747,16 @@
   } tech_type_iterate_end;
 
   update_research(plr);
+  
+  if (tech_exists(plr->research.researching)
+      && get_invention(plr, plr->research.researching) != TECH_REACHABLE) {
+    freelog(LOG_ERROR, "Player %s researches illegal tech %s", plr->name,
+           get_tech_name(plr, plr->research.researching));
+    choose_random_tech(plr);
+  }
+
+  assert(tech_is_available(plr, plr->research.researching)
+        || plr->research.researching == A_FUTURE);
 
   plr->reputation=secfile_lookup_int_default(file, GAME_DEFAULT_REPUTATION,
                                             "player%d.reputation", plrno);

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