Changeset 8496 in orxonox.OLD
- Timestamp:
- Jun 15, 2006, 10:11:56 PM (18 years ago)
- Location:
- branches/network/src/lib/network
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/network_stream.cc
r8494 r8496 95 95 remainingBytesToWriteToDict = Preferences::getInstance()->getInt( "compression", "writedict", 0 ); 96 96 97 assert( Zip::getInstance()->loadDictionary( "testdict" ) ); 97 assert( Zip::getInstance()->loadDictionary( "testdict" ) >= 0 ); 98 this->dictClient = Zip::getInstance()->loadDictionary( "dict2pl_client" ); 99 assert( this->dictClient >= 0 ); 100 this->dictServer = Zip::getInstance()->loadDictionary( "dict2pl_server" ); 101 assert( this->dictServer >= 0 ); 98 102 } 99 103 … … 504 508 assert( Converter::intToByteArray( offset, buf, INTSIZE ) == INTSIZE ); 505 509 506 int compLength = Zip::getInstance()->zip( buf, offset, compBuf, UDP_PACKET_SIZE ); 510 int compLength = 0; 511 if ( this->isServer() ) 512 Zip::getInstance()->zip( buf, offset, compBuf, UDP_PACKET_SIZE, dictServer ); 513 else 514 Zip::getInstance()->zip( buf, offset, compBuf, UDP_PACKET_SIZE, dictClient ); 507 515 508 516 if ( compLength < 0 ) -
branches/network/src/lib/network/network_stream.h
r8494 r8496 107 107 108 108 int remainingBytesToWriteToDict; //!< if > 0 NetworkStream will write packets to DATA/dicts/newdict 109 110 int dictServer; 111 int dictClient; 109 112 }; 110 113 #endif /* _NETWORK_STREAM */ -
branches/network/src/lib/network/zip.cc
r7954 r8496 48 48 * @return true on success 49 49 */ 50 boolZip::loadDictionary( std::string name )50 int Zip::loadDictionary( std::string name ) 51 51 { 52 52 std::string fileName = ResourceManager::getInstance()->getDataDir(); … … 60 60 { 61 61 PRINTF(1)("Could not open %d\n", fileName.c_str()); 62 return false;62 return -1; 63 63 } 64 64 … … 87 87 PRINTF(3)("Loaded dictionary '%s' with adler = %d\n", name.c_str(), entry.adler ); 88 88 89 return true;89 return dicts.size()-1; 90 90 } 91 91 -
branches/network/src/lib/network/zip.h
r7954 r8496 28 28 inline static Zip* getInstance(void) { if (!singletonRef) singletonRef = new Zip(); return singletonRef; }; 29 29 30 boolloadDictionary( std::string name );30 int loadDictionary( std::string name ); 31 31 int zip( byte * from, int fromLength, byte * to, int maxLength, int dict = 0 ); 32 32 int unZip( byte * from, int fromLength, byte * to, int maxLength );
Note: See TracChangeset
for help on using the changeset viewer.