From f7c733cd21a88c1e3516f91af955679ec71ea600 Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sun, 31 May 2009 12:13:40 +0400 Subject: [PATCH] Fixed warnings. --- src/game/Object.cpp | 14 +++++++------- src/game/UpdateData.cpp | 15 +++++++++++---- win/VC90/mangosd.vcproj | 2 +- win/VC90/script.vcproj | 2 +- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/game/Object.cpp b/src/game/Object.cpp index c7a41b52d..43d0a68f6 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -612,7 +612,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask // 2 specialized loops for speed optimization in non-unit case if(isType(TYPEMASK_UNIT)) // unit (creature/player) case { - for( uint16 index = 0; index < m_valuesCount; index ++ ) + for( uint16 index = 0; index < m_valuesCount; ++index ) { if( updateMask->GetBit( index ) ) { @@ -663,7 +663,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask } else if(isType(TYPEMASK_GAMEOBJECT)) // gameobject case { - for( uint16 index = 0; index < m_valuesCount; index ++ ) + for( uint16 index = 0; index < m_valuesCount; ++index ) { if( updateMask->GetBit( index ) ) { @@ -695,7 +695,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask } else // other objects case (no special index checks) { - for( uint16 index = 0; index < m_valuesCount; index ++ ) + for( uint16 index = 0; index < m_valuesCount; ++index ) { if( updateMask->GetBit( index ) ) { @@ -708,7 +708,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask void Object::ClearUpdateMask(bool remove) { - for( uint16 index = 0; index < m_valuesCount; index ++ ) + for( uint16 index = 0; index < m_valuesCount; ++index ) { if(m_uint32Values_mirror[index]!= m_uint32Values[index]) m_uint32Values_mirror[index] = m_uint32Values[index]; @@ -756,7 +756,7 @@ bool Object::LoadValues(const char* data) void Object::_SetUpdateBits(UpdateMask *updateMask, Player* /*target*/) const { - for( uint16 index = 0; index < m_valuesCount; index ++ ) + for( uint16 index = 0; index < m_valuesCount; ++index ) { if(m_uint32Values_mirror[index]!= m_uint32Values[index]) updateMask->SetBit(index); @@ -765,7 +765,7 @@ void Object::_SetUpdateBits(UpdateMask *updateMask, Player* /*target*/) const void Object::_SetCreateBits(UpdateMask *updateMask, Player* /*target*/) const { - for( uint16 index = 0; index < m_valuesCount; index++ ) + for( uint16 index = 0; index < m_valuesCount; ++index ) { if(GetUInt32Value(index) != 0) updateMask->SetBit(index); @@ -884,7 +884,7 @@ void Object::SetUInt16Value( uint16 index, uint8 offset, uint16 value ) return; } - if(uint8(m_uint32Values[ index ] >> (offset * 16)) != value) + if(uint16(m_uint32Values[ index ] >> (offset * 16)) != value) { m_uint32Values[ index ] &= ~uint32(uint32(0xFFFF) << (offset * 16)); m_uint32Values[ index ] |= uint32(uint32(value) << (offset * 16)); diff --git a/src/game/UpdateData.cpp b/src/game/UpdateData.cpp index 546d84002..e3e51df22 100644 --- a/src/game/UpdateData.cpp +++ b/src/game/UpdateData.cpp @@ -126,14 +126,21 @@ bool UpdateData::BuildPacket(WorldPacket *packet) if (pSize > 100 ) // compress large packets { - packet->resize(pSize); - - packet->put(0, pSize); + *packet << uint32(pSize); + packet->append(buf); uint32 destsize = pSize; - Compress(const_cast(packet->contents()) + sizeof(uint32), &destsize, (void*)buf.contents(), pSize); + + Compress(const_cast(packet->contents()) + sizeof(uint32), + &destsize, + const_cast(packet->contents()) + sizeof(uint32), + pSize); + if (destsize == 0) + { + sLog.outError("Error while compressing update packet!"); return false; + } packet->resize( destsize + sizeof(uint32) ); packet->SetOpcode( SMSG_COMPRESSED_UPDATE_OBJECT ); diff --git a/win/VC90/mangosd.vcproj b/win/VC90/mangosd.vcproj index 1c78276bf..9f3718a5c 100644 --- a/win/VC90/mangosd.vcproj +++ b/win/VC90/mangosd.vcproj @@ -283,7 +283,7 @@ AdditionalDependencies="libmySQL.lib libeay32.lib ws2_32.lib winmm.lib odbc32.lib odbccp32.lib advapi32.lib dbghelp.lib MSVCPRTD.LIB msvcrtd.lib" OutputFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\mangosd.exe" Version="" - LinkIncremental="1" + LinkIncremental="2" SuppressStartupBanner="true" AdditionalLibraryDirectories="..\..\dep\lib\$(PlatformName)_$(ConfigurationName)" GenerateDebugInformation="true" diff --git a/win/VC90/script.vcproj b/win/VC90/script.vcproj index 8593d93e8..a476aa9fb 100644 --- a/win/VC90/script.vcproj +++ b/win/VC90/script.vcproj @@ -69,7 +69,7 @@ Name="VCLinkerTool" AdditionalDependencies="mangosd.lib zlib.lib libmySQL.lib libeay32.lib ws2_32.lib winmm.lib odbc32.lib odbccp32.lib aced.lib" OutputFile="..\..\bin\$(PlatformName)_$(ConfigurationName)\MaNGOSScript.dll" - LinkIncremental="1" + LinkIncremental="2" AdditionalLibraryDirectories=";.\mangosd__$(PlatformName)_$(ConfigurationName);.\zlib__$(PlatformName)_$(ConfigurationName);..\..\dep\lib\$(PlatformName)_$(ConfigurationName)" GenerateDebugInformation="true" ProgramDatabaseFile="$(OutDir)\MaNGOSScript.pdb"