Changeset 6695 in orxonox.OLD for trunk/src/lib/network/network_game_manager.h
- Timestamp:
- Jan 25, 2006, 2:39:53 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/network/network_game_manager.h
r6634 r6695 15 15 16 16 class TiXmlElement; 17 class PNode; 17 18 18 19 /** 19 20 * protocol definition 20 21 * 21 * CREATE_ENTITY: CLASS_ID, UNIQUE_ID, OWNER22 * REMOVE_ENTITY: UNIQUE_ID22 * CREATE_ENTITY: >> CLASS_ID, UNIQUE_ID, OWNER 23 * REMOVE_ENTITY: >> UNIQUE_ID 23 24 * 24 * CREATE_ENTITY_LIST: NUMBER, [CLASS_ID, UNIQUE_ID, OWNER][0..NUMBER]25 * REMOVE_ENTITY_LIST: NUMBER, [UNIQUE_ID][0..NUMBER]25 * CREATE_ENTITY_LIST: >> NUMBER, [CLASS_ID, UNIQUE_ID, OWNER][0..NUMBER] 26 * REMOVE_ENTITY_LIST: >> NUMBER, [UNIQUE_ID][0..NUMBER] 26 27 * 27 * REQUEST_CREATE: CLASS_ID 28 * REQUEST_REMOVE: UNIQUE_ID 28 * REQUEST_CREATE: >> CLASS_ID 29 * << [Sync Info] 30 * REQUEST_REMOVE: >> UNIQUE_ID 31 * << [Sync Info] 29 32 * 30 33 * //REQUEST_CREATE_LIST: NUMBER, [CLASS_ID][0..NUMBER] … … 32 35 * 33 36 * REQUEST_ENTITY_LIST: //request the whole world :D 34 * REQUEST_SYNC: UNIQUE_ID 37 * REQUEST_SYNC: >> UNIQUE_ID 38 * << [Sync Info] 35 39 * //REQUEST_SYNC_LIST: NUMBER, [UNIQUE_ID][0..NUMBER] 36 40 * 37 * YOU_ARE_ENTITY: UNIQUE_ID41 * YOU_ARE_ENTITY: >> UNIQUE_ID 38 42 * 43 * REQUEST_PNODE_PATH >> UNIQUE_ID_START UNIQUE_ID_STOP 44 * << UNIQUE_ID_1 UNIQUE_ID_2 UNIQUE_ID_3 ... UNIQUE_ID_N 45 * 46 * SEND_PNODE_PATH >> UNIQUE_ID_START UNIQUE_ID_STOP NUMBER [UNIQUE_ID][0..NUMBER] 39 47 */ 40 48 41 typedef enum NetworkGameManagerProtocol{ 42 CREATE_ENTITY = 0, 43 REMOVE_ENTITY, 44 CREATE_ENTITY_LIST, 45 REMOVE_ENTITY_LIST, 46 REQUEST_CREATE, 47 REQUEST_REMOVE, 48 REQUEST_SYNC, 49 YOU_ARE_ENTITY, 50 REQUEST_ENTITY_LIST 49 typedef enum NetworkGameManagerProtocol { 50 NET_CREATE_ENTITY = 0, 51 NET_REMOVE_ENTITY, 52 NET_CREATE_ENTITY_LIST, 53 NET_REMOVE_ENTITY_LIST, 54 NET_REQUEST_CREATE, 55 NET_REQUEST_REMOVE, 56 NET_REQUEST_SYNC, 57 NET_YOU_ARE_ENTITY, 58 NET_REQUEST_ENTITY_LIST, 59 NET_REQUEST_PNODE_PATH, 60 NET_SEND_PNODE_PATH, 61 62 NET_NUMBER 51 63 }; 52 64 … … 83 95 void sendEntityList(int userID); 84 96 97 85 98 private: 86 99 NetworkGameManager(); 87 100 101 102 /* some network signal handlers */ 103 bool handleRequestCreate( int& i, const byte* data, int length, int sender ); 104 bool handleRequestRemove( int& i, const byte* data, int length, int sender ); 105 bool handleCreateEntity( int& i, const byte* data, int length, int sender ); 106 bool handleRemoveEntity( int& i, const byte* data, int length, int sender ); 107 bool handleCreateEntityList( int& i, const byte* data, int length, int sender ); 108 bool handleRemoveEntityList( int& i, const byte* data, int length, int sender ); 109 bool handleYouAreEntity( int& i, const byte* data, int length, int sender ); 110 bool handleRequestSync( int& i, const byte* data, int length, int sender ); 111 bool handleRequestPNodePath(int& i, const byte* data, int length, int sender); 112 bool handleSendPNodePath(int& i, const byte* data, int length, int sender); 113 114 115 /* some network handlers helper functions */ 88 116 void requestCreateEntity(ClassID classID); 89 117 int executeCreateEntity(ClassID classID, int uniqueID = 0, int owner = 0); 118 BaseObject* doCreateEntity(ClassID classID, int uniqueID, int owner); 90 119 91 120 void requestRemoveEntity(int uniqueID); 92 121 void executeRemoveEntity(int uniqueID); 122 void doRemoveEntity(int uniqueID); 93 123 94 124 void executeRequestSync( int uniqueID, int user ); 125 void doRequestSync(int uniqueID, int userID); 95 126 96 BaseObject* doCreateEntity(ClassID classID, int uniqueID, int owner);97 void doRemoveEntity(int uniqueID);98 void doRequestSync(int uniqueID, int userID);99 127 void doYouAre( int uniqueID ); 128 129 void requestPNodePath(const PNode* node1, const PNode* node2); 130 void executeRequestPNodePath(const PNode* node2, const PNode* node2); 131 void doRequestPNodePath(const PNode* node1, const PNode* node2); 100 132 101 133 bool canCreateEntity(ClassID classID); … … 105 137 void resizeBufferVector(int n); 106 138 107 inlinebool writeToClientBuffer( clientBuffer &cb, byte*data, int length );108 inlinebool writeToClientBuffer( clientBuffer &cb, byte b );109 inlinebool writeToClientBuffer( clientBuffer &cb, int i );110 inlinebool readFromClientBuffer( clientBuffer &cb, byte*data, int length );139 bool writeToClientBuffer( clientBuffer &cb, byte*data, int length ); 140 bool writeToClientBuffer( clientBuffer &cb, byte b ); 141 bool writeToClientBuffer( clientBuffer &cb, int i ); 142 bool readFromClientBuffer( clientBuffer &cb, byte*data, int length ); 111 143 112 //helper functions for writeBytes113 inline bool handleRequestCreate( int& i, const byte* data, int length, int sender );114 inline bool handleRequestRemove( int& i, const byte* data, int length, int sender );115 inline bool handleCreateEntity( int& i, const byte* data, int length, int sender );116 inline bool handleRemoveEntity( int& i, const byte* data, int length, int sender );117 inline bool handleCreateEntityList( int& i, const byte* data, int length, int sender );118 inline bool handleRemoveEntityList( int& i, const byte* data, int length, int sender );119 inline bool handleYouAreEntity( int& i, const byte* data, int length, int sender );120 inline bool handleRequestSync( int& i, const byte* data, int length, int sender );121 144 122 145 private: … … 124 147 //clientBuffer allOutBuffer; 125 148 static NetworkGameManager* singletonRef; 126 127 int newUniqueID;128 149 bool hasRequestedWorld; 129 150 };
Note: See TracChangeset
for help on using the changeset viewer.