Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2004:
[Freeciv-Dev] Re: (PR#6987) corrupt technology
Home

[Freeciv-Dev] Re: (PR#6987) corrupt technology

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: ggracian@xxxxxxx
Subject: [Freeciv-Dev] Re: (PR#6987) corrupt technology
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Fri, 13 Feb 2004 03:27:47 -0800
Reply-to: rt@xxxxxxxxxxx

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

On Sat, Feb 07, 2004 at 02:37:57AM -0800, Genevieve Gracian wrote:
> > > > It crashes for me with both clean CVS HEAD and veteran patch. You are
> > > > researching a tech which is already researched, triggering an assert. 
> > > > The
> > > > savegame is likely corrupt.
> > > > 
> > > 
> > > corrupted savegames: they occur when techlevel > 0 and compress = 9 
> > > (ok with compress between 5 and 8, not tested with compress 4 or less)
> > 
> > It is possible this is depends on techlevel > 0 but I doubt that it
> > depends on the compression level. Anyway, how do you reproduce this
> > problem? Is it possible to reproduce this with an autogame?
> > 
> 
> Automatic savegames aren't corrupted, only the ones made manually with
> the save command. You only need to 'trigger' research by building one
> city for this to happen, so not a lot of turns are needed.
> 
> set techlevel 5, set compress 9
> start, build a city, end turn (to have more than 0 bulb)
> manual savegame
> endgame 
> reload the game -> corrupted research in science dialog

I can't reproduce this here.

> now, try with :
> techlevel 0 and compress 9 -> seems ok
> and another with 
> techlevel 5 and compress 8 -> seems ok

If it depends on the compression I suspect a timing problem. However I
have no idea what is timing depending here. The server is single
threaded.

Can you please try the attached patch. It adds the same test at
saving. It should either print it for both (compression 8 and 9) or
none.

Also can you do the action outline above using these settings:
 - set techleven 5
 - set compress 9
 - set seed 1234
 - set randseed 5678

and the same with compression 8? If you also replicate the other
actions (client moves for example) the uncompressed savegames should
be the same. Can you test this and if the savegames are different send
the diff.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "I heard if you play the NT-4.0-CD backwards, you get a satanic message."
 "That's nothing, if you play it forward, it installs NT-4.0"

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/02/13 11:19:04
@@ -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/02/13 11:19:06
@@ -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, "loading: 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);
@@ -1420,6 +1430,11 @@
                     "player%d.research_changed_from", plrno);
   secfile_insert_int(file, plr->research.techs_researched,
                     "player%d.researchpoints", plrno);
+  if (tech_exists(plr->research.researching)
+      && get_invention(plr, plr->research.researching) != TECH_REACHABLE) {
+    freelog(LOG_ERROR, "saving: player %s researches illegal tech %s",
+           plr->name, get_tech_name(plr, plr->research.researching));
+  }
   secfile_insert_int(file, plr->research.researching,
                     "player%d.researching", plrno);  
 

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