Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 9869 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
RevLine 
[6067]1/*!
2 * @file entity_manager.h
3 *  Manages creation and destruction of entities
4 */
[6111]5
[6116]6#ifndef _NETWORK_GAME_MANGER
7#define _NETWORK_GAME_MANAGER
[6067]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"
[8147]14#include "playable.h"
[7954]15#include "message_manager.h"
[6067]16
[6111]17
[6341]18class TiXmlElement;
[6695]19class PNode;
[6111]20
[6695]21
[6111]22
[6341]23struct clientBuffer
24{
25  int length;
26  int maxLength;
27  byte * buffer;
28};
[6111]29
[6067]30/*!
[9406]31 * a class that can create and remove entities over the network
[6067]32 */
[6116]33class NetworkGameManager: public Synchronizeable
[6067]34{
[9869]35  ObjectListDeclaration(NetworkGameManager);
[6067]36  public:
[6981]37    virtual ~NetworkGameManager();
[9406]38
[9869]39    static NetworkGameManager* getInstance()
[6341]40    { if (!NetworkGameManager::singletonRef) NetworkGameManager::singletonRef = new NetworkGameManager(); return NetworkGameManager::singletonRef; }
41
[6111]42
[8068]43    bool signalNewPlayer( int userId );
44    bool signalLeftPlayer( int userID );
[9406]45
[8147]46    void prefereTeam( int teamId );
[6111]47
[9406]48
[8068]49    inline void setGameState( int gameState ){ this->gameState = gameState; }
50    inline int getGameState(){ return this->gameState; }
[9406]51
[8147]52    void tick( float ds );
[9406]53
54    void removeSynchronizeable( int uniqueId );
[8708]55    void sendChatMessage( const std::string & message, int messageType );
[6111]56
[9406]57
[6067]58  private:
[6341]59    NetworkGameManager();
[9406]60
[9656]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  );
[9406]64
[8147]65    void setPreferedTeam( int userId, int teamId );
[6111]66
[9406]67
68  private:
[6341]69    static NetworkGameManager*    singletonRef;
[9406]70
[8068]71    int                           gameState;
[9406]72
[8147]73    std::list<Playable*>          playablesToDelete;
[6067]74};
75
76#endif /*_ENTITY_MANGER*/
Note: See TracBrowser for help on using the repository browser.