Beetle Posted April 17, 2005 Report Share Posted April 17, 2005 Hi I think that we should talking about player class. Place where we put all player stuff, money, bases, craft, etc... Waiting from comments from senior (Red Knight, Rincewind ) Greetings,Beetle Link to comment Share on other sites More sharing options...
rincewind Posted April 18, 2005 Report Share Posted April 18, 2005 Hi I think that we should talking about player class. Place where we put all player stuff, money, bases, craft, etc... Waiting from comments from senior (Red Knight, Rincewind ) Greetings,BeetleThats pretty much what I've been working on yesterday. Still have some problems with the serialization (serialization and shared_ptr to base classes still pose some problems) but I will post a working draft very soon.Basicly, it contains all the data that is dynamic to the game. Current Planetview-Simulation (Alien-AI including current Alien-missions), players bases (which I extended with a geoposition and a name, btw).Also included are save and load methods. So just a little more patience (as I'm on my way to work now). Rincewind P.S: On another thing: while including HumanBase in there, I noticed your interface to iterate over the facilities, you might want to take a look at the file iterator.h in xenocommon. It provides a nice little wrapper for this functionality, including helper functions for binding it to Lua. Link to comment Share on other sites More sharing options...
rincewind Posted April 19, 2005 Report Share Posted April 19, 2005 Ok, preliminary draft in SVN now , please comment (but be gentle with me) :-) class GameState : public TSingleton<GameState> { private: TScopedPtr<Xenocide::Common::Simulation::Simulation> simulationSingleton; typedef TList< TSharedPtr<HumanBase> > HumanBaseList; typedef Iterator<HumanBaseList::iterator> HumanBaseListIterator; HumanBaseList humanBases; public: /** \brief constructs a new and empty GameState (effectively "New Game") */ GameState(); ~GameState(); /** \brief loads the GameState from the indicated file into this GameState */ void loadGame(const ::String & fileName); /** \brief saves the current GameState into the indicated file */ void saveGame(const ::String & fileName); /** \brief return an iterator over all the human bases in the current gamestate */ HumanBaseListIterator getHumanBases(); }; Serialization is not working right now, but hopefully I'll get it fixed soon. Rincewind Link to comment Share on other sites More sharing options...
Recommended Posts