Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2002:
[Freeciv-Dev] Re: Wonder obsolesence across games (PR#1434)
Home

[Freeciv-Dev] Re: Wonder obsolesence across games (PR#1434)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Mike Kaufman <kaufman@xxxxxxxxxxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Wonder obsolesence across games (PR#1434)
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 13 May 2002 10:59:23 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Sat, May 11, 2002 at 12:59:15AM -0500, Mike Kaufman wrote:
> On Fri, May 10, 2002 at 10:06:48PM +0200, Raimar Falke wrote:
> > On Sat, May 04, 2002 at 12:53:28PM -0700, dspeyer@xxxxxxxxxxxxxxxxxxxxx 
> > wrote:
> > > Full_Name: Daniel Speyer
> > > Version: latest CVS
> > > Distribution: Built from source
> > > Client: Both (or N/A)
> > > OS: Debian GNU/Linux
> > > Submission from: (NULL) (129.2.159.61)
> > > 
> > > 
> > > If you start a game, build Sun Tzu's War Academy, end the game, and start 
> > > a new
> > > game using the same client, you will be unable to build barracks.  Other
> > > wonders/improvements are presumably similar.
> > > 
> > > This is because the game.players[0].improvements array is not 
> > > innitialized for
> > > each game.  Probably the best solution is to put
> > > 
> > >   for(i=0; i<B_LAST; i++){
> > >     game.players[0].improvements[i]=I_NONE;
> > >   }
> > > 
> > > into the game connection routines, probably in try_to_connect
> > > (freeciv/client/clinet.c).  It's a little ugly there, but it works.  I 
> > > haven't
> > > found another place to put it that works cross-gui.
> > > 
> > > I'd make a patch, but my clinet.c is pretty modified, and I'm still not 
> > > sure
> > > where in the function is least aesthetically offensive.
> > 
> > What about this patch:
> > Index: client/clinet.c
> > ===================================================================
> > RCS file: /home/freeciv/CVS/freeciv/client/clinet.c,v
> > retrieving revision 1.69
> > diff -u -r1.69 clinet.c
> > --- client/clinet.c 2002/04/09 14:10:09     1.69
> > +++ client/clinet.c 2002/05/10 16:49:23
> > @@ -105,6 +105,7 @@
> >    
> >    set_client_state(CLIENT_PRE_GAME_STATE);
> >    agents_disconnect();
> > +  game_init();
> >  }
> >  
> >  /**************************************************************************
> > 
> > It is certainly correct ;) but may introduce other problems.
> 
> this is actually a dreadful fix. 
> 
> we already have a [smaller] memory leak when diconnecting and
> reconnecting to the server (or quitting the server and restarting it).
> this "fix" really intensifies the memory leak---depending on the
> savegame size---by about an order of magnitude.
> 
> We should probably introduce a game_free() function that frees all the
> lists and players and such before calling game_init()

About what memory leak are we talking here?

If you look at idex_init and map_allocate: both free the stuff before
they allocate new memory.

        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"


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