Changeset 7954 in orxonox.OLD for trunk/src/lib/network/network_game_manager.h
- Timestamp:
- May 29, 2006, 3:28:41 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/network/network_game_manager.h
r6981 r7954 12 12 /* include base_object.h since all classes are derived from this one */ 13 13 #include "synchronizeable.h" 14 #include "message_manager.h" 14 15 15 16 16 17 class TiXmlElement; 17 18 class PNode; 18 19 /**20 * protocol definition21 *22 * CREATE_ENTITY: >> CLASS_ID, UNIQUE_ID, OWNER23 * REMOVE_ENTITY: >> UNIQUE_ID24 *25 * CREATE_ENTITY_LIST: >> NUMBER, [CLASS_ID, UNIQUE_ID, OWNER][0..NUMBER]26 * REMOVE_ENTITY_LIST: >> NUMBER, [UNIQUE_ID][0..NUMBER]27 *28 * REQUEST_CREATE: >> CLASS_ID29 * << [Sync Info]30 * REQUEST_REMOVE: >> UNIQUE_ID31 * << [Sync Info]32 *33 * //REQUEST_CREATE_LIST: NUMBER, [CLASS_ID][0..NUMBER]34 * //REQUEST_CREATE_LIST: NUMBER, [UNIQUE_ID][0..NUMBER]35 *36 * REQUEST_ENTITY_LIST: //request the whole world :D37 * REQUEST_SYNC: >> UNIQUE_ID38 * << [Sync Info]39 * //REQUEST_SYNC_LIST: NUMBER, [UNIQUE_ID][0..NUMBER]40 *41 * YOU_ARE_ENTITY: >> UNIQUE_ID42 *43 * REQUEST_PNODE_PATH >> UNIQUE_ID_START UNIQUE_ID_STOP44 * << UNIQUE_ID_1 UNIQUE_ID_2 UNIQUE_ID_3 ... UNIQUE_ID_N45 *46 * SEND_PNODE_PATH >> UNIQUE_ID_START UNIQUE_ID_STOP NUMBER [UNIQUE_ID][0..NUMBER]47 */48 19 49 20 typedef enum NetworkGameManagerProtocol { … … 54 25 NET_REQUEST_CREATE, 55 26 NET_REQUEST_REMOVE, 56 NET_REQUEST_SYNC,57 27 NET_YOU_ARE_ENTITY, 58 28 NET_REQUEST_ENTITY_LIST, … … 81 51 { if (!NetworkGameManager::singletonRef) NetworkGameManager::singletonRef = new NetworkGameManager(); return NetworkGameManager::singletonRef; } 82 52 53 #if 0 83 54 virtual int writeBytes(const byte* data, int length, int sender); 84 55 virtual int readBytes(byte* data, int maxLength, int * reciever); 85 56 virtual void writeDebug() const; 86 57 virtual void readDebug() const; 58 #endif 87 59 88 60 int createEntity( ClassID classID, int owner = 0 ); … … 91 63 void sendYouAre( int uniqueID, int userID ); 92 64 93 void sync(int uniqueID, int owner); 94 65 #if 0 95 66 void sendEntityList(int userID); 67 #endif 96 68 97 69 bool signalNewPlayer(int userId); … … 101 73 private: 102 74 NetworkGameManager(); 75 76 static bool youAreHandler(MessageId messageId, byte * data, int dataLength, void * someData, int userId ); 103 77 104 78 … … 111 85 bool handleRemoveEntityList( int& i, const byte* data, int length, int sender ); 112 86 bool handleYouAreEntity( int& i, const byte* data, int length, int sender ); 113 bool handleRequestSync( int& i, const byte* data, int length, int sender );114 87 bool handleRequestPNodePath(int& i, const byte* data, int length, int sender); 115 88 bool handleSendPNodePath(int& i, const byte* data, int length, int sender); … … 117 90 118 91 /* some network handlers helper functions */ 119 void requestCreateEntity(ClassID classID);92 // void requestCreateEntity(ClassID classID); 120 93 int executeCreateEntity(ClassID classID, int uniqueID = 0, int owner = 0); 121 94 BaseObject* doCreateEntity(ClassID classID, int uniqueID, int owner); 122 95 123 void requestRemoveEntity(int uniqueID);96 // void requestRemoveEntity(int uniqueID); 124 97 void executeRemoveEntity(int uniqueID); 125 98 void doRemoveEntity(int uniqueID); 126 99 127 void executeRequestSync( int uniqueID, int user );128 void doRequestSync(int uniqueID, int userID);129 130 100 void doYouAre( int uniqueID ); 131 101 132 void requestPNodePath(const PNode* node1, const PNode* node2);102 // void requestPNodePath(const PNode* node1, const PNode* node2); 133 103 void executeRequestPNodePath(const PNode* node2, const PNode* node2); 134 104 void doRequestPNodePath(const PNode* node1, const PNode* node2); 135 105 136 106 bool canCreateEntity(ClassID classID); 107 #if 0 108 void resizeBufferVector(int n); 137 109 138 void resizeBufferVector(int n);139 110 140 111 bool writeToClientBuffer( clientBuffer &cb, byte*data, int length ); … … 142 113 bool writeToClientBuffer( clientBuffer &cb, int i ); 143 114 bool readFromClientBuffer( clientBuffer &cb, byte*data, int length ); 144 115 #endif 145 116 146 117 private: 118 #if 0 147 119 std::vector<clientBuffer> outBuffer; 148 120 //clientBuffer allOutBuffer; 121 #endif 149 122 static NetworkGameManager* singletonRef; 150 bool hasRequestedWorld;151 123 }; 152 124
Note: See TracChangeset
for help on using the changeset viewer.