Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10672 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File size: 2.0 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 "playable.h"
15#include "message_manager.h"
16
17
18class TiXmlElement;
19class PNode;
20
21
22
23struct clientBuffer
24{
25  int length;
26  int maxLength;
27  byte * buffer;
28};
29
30/*!
31 * a class that can create and remove entities over the network
32 */
33class NetworkGameManager: public Synchronizeable
34{
35  ObjectListDeclaration(NetworkGameManager);
36  public:
37    virtual ~NetworkGameManager();
38
39    static NetworkGameManager* getInstance()
40    { if (!NetworkGameManager::singletonRef) NetworkGameManager::singletonRef = new NetworkGameManager(); return NetworkGameManager::singletonRef; }
41
42
43    bool signalNewPlayer( int userId );
44    bool signalLeftPlayer( int userID );
45
46    void prefereTeam( int teamId );
47
48
49    inline void setGameState( int gameState ){ this->gameState = gameState; }
50    inline int getGameState(){ return this->gameState; }
51
52    void tick( float ds );
53
54    void removeSynchronizeable( int uniqueId );
55    void sendChatMessage( const std::string & message, int messageType );
56
57
58  private:
59    NetworkGameManager();
60
61    static bool delSynchronizeableHandler( MessageType messageType, byte * data, int dataLength, void * someData, int senderId, int destinationId  );
62    static bool preferedTeamHandler( MessageType messageType, byte * data, int dataLength, void * someData, int senderId, int destinationId  );
63    static bool chatMessageHandler( MessageType messageType, byte * data, int dataLength, void * someData, int senderId, int destinationId  );
64
65    void setPreferedTeam( int userId, int teamId );
66
67
68  private:
69    static NetworkGameManager*    singletonRef;
70
71    int                           gameState;
72
73    std::list<Playable*>          playablesToDelete;
74};
75
76#endif /*_ENTITY_MANGER*/
Note: See TracBrowser for help on using the repository browser.