Changeset 6668 in orxonox.OLD for branches/network/src/lib
- Timestamp:
- Jan 24, 2006, 2:23:44 PM (19 years ago)
- Location:
- branches/network/src/lib/network
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/network_game_manager.cc
r6667 r6668 82 82 b = data[i++]; 83 83 84 /**************** Commands only processed by servers ****************/ 84 85 if ( isServer() ) 85 86 { … … 90 91 continue; 91 92 } 92 if ( b == NET_REQUEST_REMOVE )93 else if ( b == NET_REQUEST_REMOVE ) 93 94 { 94 95 if ( !handleRequestRemove( i, data, length, sender ) ) … … 96 97 continue; 97 98 } 98 if ( b == NET_REQUEST_PNODE_PATH )99 else if ( b == NET_REQUEST_PNODE_PATH ) 99 100 { 100 101 if ( !handleRequestPNodePath( i, data, length, sender ) ) … … 102 103 continue; 103 104 } 105 else 106 { 107 PRINTF(1)("Network is asynchronous: couldn't decode the command sent by %i\n", sender); 108 PRINTF(1)("Probably this is because the network protocol has different \n"); 109 PRINTF(1)("versions or there occured an error in the sending algorithm\n"); 110 } 104 111 } 105 112 else 106 113 { 114 /**************** Commands only processed by clients ****************/ 107 115 if ( b == NET_CREATE_ENTITY ) 108 116 { … … 112 120 continue; 113 121 } 114 if ( b == NET_REMOVE_ENTITY )122 else if ( b == NET_REMOVE_ENTITY ) 115 123 { 116 124 if ( !handleRemoveEntity( i, data, length, sender ) ) … … 118 126 continue; 119 127 } 120 if ( b == NET_CREATE_ENTITY_LIST )128 else if ( b == NET_CREATE_ENTITY_LIST ) 121 129 { 122 130 if ( !handleCreateEntityList( i, data, length, sender ) ) … … 124 132 continue; 125 133 } 126 if ( b == NET_REMOVE_ENTITY_LIST )134 else if ( b == NET_REMOVE_ENTITY_LIST ) 127 135 { 128 136 if ( !handleRemoveEntityList( i, data, length, sender ) ) … … 130 138 continue; 131 139 } 132 if ( b == NET_YOU_ARE_ENTITY )140 else if ( b == NET_YOU_ARE_ENTITY ) 133 141 { 134 142 if ( !handleYouAreEntity( i, data, length, sender ) ) … … 138 146 } 139 147 148 /**************** Commands processed by servers and clients ****************/ 140 149 if ( b == NET_REQUEST_ENTITY_LIST ) 141 150 { … … 143 152 continue; 144 153 } 145 146 if ( b == NET_REQUEST_SYNC ) 154 else if ( b == NET_REQUEST_SYNC ) 147 155 { 148 156 if ( !handleRequestSync( i, data, length, sender ) ) … … 151 159 } 152 160 153 //if we get her something with data is wrong 161 162 PRINTF(1)("Network is asynchronous: couldn't decode the command sent by %i\n", sender); 163 PRINTF(1)("Probably this is because the network protocol has different \n"); 164 PRINTF(1)("versions or there occured an error in the sending algorithm\n"); 154 165 PRINTF(1)("Data is not in the right format! i=%d\n", i); 155 166 return i; … … 869 880 870 881 882 /** 883 * handles the network signal NET_REQUEST_PNODE_PATH 884 * @param i byte offset in the buffer 885 * @param data data array 886 * @param length length of the data arary 887 * @param sender the sender id 888 * @return true if process terminated sucessfully 889 */ 871 890 bool NetworkGameManager::handleRequestPNodePath(int& i, const byte* data, int length, int sender) 872 {} 891 { 892 if( INTSIZE > length-i ) 893 { 894 PRINTF(1)("Cannot read n from buffer! Not enough data left!\n"); 895 return false; 896 } 897 PRINTF(0)("HandleRequestPNodePath: data[i..i+3] = %d %d %d %d\n", data[i], data[i+1], data[i+2], data[i+3]); 898 899 int uniqueID1, uniqueID2; 900 if( INTSIZE > length-i ) 901 { 902 PRINTF(1)("Cannot read uniqueID from buffer! Not enough data left!\n"); 903 return false; 904 } 905 i += Converter::byteArrayToInt( &data[i], &uniqueID1 ); 906 907 if( INTSIZE > length-i ) 908 { 909 PRINTF(1)("Cannot read uniqueID from buffer! Not enough data left!\n"); 910 return false; 911 } 912 i += Converter::byteArrayToInt( &data[i], &uniqueID2 ); 913 914 915 PRINTF(0)("HandleRequestPNodePath: got a request for path from uid %i to uid %i\n", uniqueID1, uniqueID2); 916 917 return true; 918 } 873 919 874 920 -
branches/network/src/lib/network/network_game_manager.h
r6667 r6668 44 44 * << UNIQUE_ID_1 UNIQUE_ID_2 UNIQUE_ID_3 ... UNIQUE_ID_N 45 45 * 46 * SEND_PNODE_PATH >> UNIQUE_ID_START UNIQUE_ID_STOP NUMBER [UNIQUE_ID][0..NUMBER] 46 47 */ 47 48 … … 57 58 NET_REQUEST_ENTITY_LIST, 58 59 NET_REQUEST_PNODE_PATH, 60 NET_SEND_PNODE_PATH, 59 61 60 62 NET_NUMBER … … 108 110 bool handleRequestSync( int& i, const byte* data, int length, int sender ); 109 111 bool handleRequestPNodePath(int& i, const byte* data, int length, int sender); 112 bool handleSendPNodePath(int& i, const byte* data, int length, int sender); 110 113 111 114 … … 125 128 126 129 void requestPNodePath(const PNode* node1, const PNode* node2); 127 void execute PNodePath(const PNode* node2, const PNode* node2);130 void executeRequestPNodePath(const PNode* node2, const PNode* node2); 128 131 void doRequestPNodePath(const PNode* node1, const PNode* node2); 129 132
Note: See TracChangeset
for help on using the changeset viewer.