/* $Id: server.hpp,v 1.10 2005/06/28 13:55:22 chfreund Exp $ */ #ifndef _SERVER_HPP_ #define _SERVER_HPP_ #include #include #include "sprite.hpp" #include "wopsprites.hpp" #include "gamereplay.hpp" /**********************************************************/ class World; class ServerCommunicator; class SDL_cond; typedef WopSprites ServerWopSprites; /**********************************************************/ //! server class for WoP /*! Server class for WoP.
* The Dummy Sprite Object
* The server class has a member of type WopSprites. * This is a sprite graphic object, that contains not a single * image, but all the structur information of the real sprite object, * that lives only on a client, in contrary. Besides that it will * never draw an image, it behaves exacly like the object on the * client and is therefore built in the same way from the graphic's * configuration files in the data path. This class allows the * server to keep all objects in the server world synchronized with * those living in a client's world, since it contains for example * the important information about animation sequences lenght. */ class Server { private: //! void updateGraphics(); World* m_world; ServerCommunicator* m_communicator; // Uint8 m_frame; // Uint32 m_realFrame; SDL_mutex* m_syncMutex; SDL_cond* m_syncCond; ServerWopSprites m_sprites; //!< dummy sprite graphic class GameReplay* m_replay; volatile Status m_status; SDL_Thread* m_thread; public: Server(); ~Server(); void run(); void runThreaded(); int exit(); // Uint8 getFrame() { return m_frame; } SDL_mutex* getSyncMutex() { return m_syncMutex; } SDL_cond* getSyncCond() { return m_syncCond; } void processEvents(); GameReplay* getReplay() { return m_replay; } ServerCommunicator* getCommunicator() { return m_communicator; } World* getWorld() { return m_world; } }; int serverRunWrapper( void* data ); /**********************************************************/ #endif // _SERVER_HPP_