Jump to content
XCOMUFO & Xenocide

Player Class


Recommended Posts

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  :Poke: )

 

Greetings,

Beetle

Thats 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). :Coffee:

 

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

Ok, preliminary draft in SVN now :Deal: , 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

Guest
This topic is now closed to further replies.
×
×
  • Create New...