Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/network/network_game_manager.h @ 8076

Last change on this file since 8076 was 8068, checked in by patrick, 18 years ago

trunk: merged the network branche back to trunk

File size: 1.7 KB
Line 
1/*!
2 * @file entity_manager.h
3 *  Manages creation and destruction of entities
4 */
5
6#ifndef _NETWORK_GAME_MANGER
7#define _NETWORK_GAME_MANAGER
8
9/* include this file, it contains some default definitions */
10#include "netdefs.h"
11
12/* include base_object.h since all classes are derived from this one */
13#include "synchronizeable.h"
14#include "message_manager.h"
15
16
17class TiXmlElement;
18class PNode;
19
20typedef enum NetworkGameManagerProtocol {
21  NET_CREATE_ENTITY = 0,
22  NET_REMOVE_ENTITY,
23  NET_CREATE_ENTITY_LIST,
24  NET_REMOVE_ENTITY_LIST,
25  NET_REQUEST_CREATE,
26  NET_REQUEST_REMOVE,
27  NET_YOU_ARE_ENTITY,
28  NET_REQUEST_ENTITY_LIST,
29  NET_REQUEST_PNODE_PATH,
30  NET_SEND_PNODE_PATH,
31
32  NET_NUMBER
33};
34
35struct clientBuffer
36{
37  int length;
38  int maxLength;
39  byte * buffer;
40};
41
42/*!
43 * a class that can create and remove entities
44 */
45class NetworkGameManager: public Synchronizeable
46{
47  public:
48    virtual ~NetworkGameManager();
49   
50    static NetworkGameManager* NetworkGameManager::getInstance()
51    { if (!NetworkGameManager::singletonRef) NetworkGameManager::singletonRef = new NetworkGameManager(); return NetworkGameManager::singletonRef; }
52
53
54    bool signalNewPlayer( int userId );
55    bool signalLeftPlayer( int userID );
56   
57    void removeSynchronizeable( int uniqueId );
58
59    inline void setGameState( int gameState ){ this->gameState = gameState; }
60    inline int getGameState(){ return this->gameState; }
61
62  private:
63    NetworkGameManager();
64   
65    static bool delSynchronizeableHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId );
66
67    static NetworkGameManager*    singletonRef;
68   
69    int                           gameState;
70};
71
72#endif /*_ENTITY_MANGER*/
Note: See TracBrowser for help on using the repository browser.