From 24fbafdd51442698abb7d7fba697e4551bbbdaf9 Mon Sep 17 00:00:00 2001 From: shlainn Date: Mon, 8 Dec 2008 18:19:24 +0000 Subject: [PATCH] * Restored compilation on Linux after last revision * Inserted some GCC 4.3 specific headers * Shaddar & bLuma: fix for SMSG_UPDATE_OBJECT on antrix --- src/Client/ControlSocket.cpp | 2 +- src/Client/World/UpdateData.cpp | 7 ++++--- src/Client/World/UpdateMask.h | 10 ++++++---- src/Client/main.cpp | 4 ++-- src/shared/ByteBuffer.h | 3 +++ src/shared/Network/Socket.h | 3 +++ src/shared/SysDefs.h | 1 + 7 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/Client/ControlSocket.cpp b/src/Client/ControlSocket.cpp index e83ef43..753807a 100644 --- a/src/Client/ControlSocket.cpp +++ b/src/Client/ControlSocket.cpp @@ -98,7 +98,7 @@ void ControlSocket::SendTelnetText(std::string s) void ControlSocket::_Execute(std::string s) { - DefReturnResult& r = _instance->GetScripts()->RunSingleLine(s); + DefReturnResult r = _instance->GetScripts()->RunSingleLine(s); if(r.ok) { std::stringstream ss; diff --git a/src/Client/World/UpdateData.cpp b/src/Client/World/UpdateData.cpp index 13fa168..2d63eb9 100644 --- a/src/Client/World/UpdateData.cpp +++ b/src/Client/World/UpdateData.cpp @@ -38,11 +38,11 @@ void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket) { uint8 utype; uint8 hasTransport; - uint32 usize, ublocks; + uint32 usize, ublocks, readblocks=0; uint64 uguid; recvPacket >> ublocks >> hasTransport; - logdev("UpdateObject: hasTransport = %u", hasTransport); - while(recvPacket.rpos() < recvPacket.size()) + logdev("UpdateObject: blocks = %u, hasTransport = %u", ublocks, hasTransport); + while((recvPacket.rpos() < recvPacket.size())&& (readblocks < ublocks)) { recvPacket >> utype; switch(utype) @@ -226,6 +226,7 @@ void WorldSession::_HandleUpdateObjectOpcode(WorldPacket& recvPacket) return; } } // switch + readblocks++; } // while } // func diff --git a/src/Client/World/UpdateMask.h b/src/Client/World/UpdateMask.h index 5c2f1a6..b18b9d1 100644 --- a/src/Client/World/UpdateMask.h +++ b/src/Client/World/UpdateMask.h @@ -44,10 +44,12 @@ class UpdateMask ( (uint8 *)mUpdateMask )[ index >> 3 ] &= (0xff ^ (1 << ( index & 0x7 ) ) ); } - inline bool GetBit (uint32 index) - { - return ( ( (uint8 *)mUpdateMask)[ index >> 3 ] & ( 1 << ( index & 0x7 ) )) != 0; - } + inline bool GetBit (uint32 index) + { + if ( (index >> 3) >= mCount ) + return false; + return ( ( (uint8 *)mUpdateMask)[ index >> 3 ] & ( 1 << ( index & 0x7 ) )) != 0; + } inline uint32 GetBlockCount() { return mBlocks; } inline uint32 GetLength() { return mBlocks << 2; } diff --git a/src/Client/main.cpp b/src/Client/main.cpp index e7392d1..0f6d75c 100644 --- a/src/Client/main.cpp +++ b/src/Client/main.cpp @@ -1,4 +1,4 @@ -#include +#include #include "common.h" #include "main.h" @@ -80,7 +80,7 @@ void _new_handler(void) int main(int argc, char* argv[]) { try { - set_new_handler(_new_handler); + std::set_new_handler(_new_handler); log_prepare("logfile.txt","a"); logcustom(0,LGREEN,"+----------------------------------+"); logcustom(0,LGREEN,"| (C) 2006-2008 Snowstorm Software |"); diff --git a/src/shared/ByteBuffer.h b/src/shared/ByteBuffer.h index 07c3f8b..43aec74 100644 --- a/src/shared/ByteBuffer.h +++ b/src/shared/ByteBuffer.h @@ -23,6 +23,9 @@ #include #include #include +#if defined( __GNUC__ ) && (__GNUC__ * 10000 + __GNUC_MINOR__ * 100)>=40300 + #include +#endif class ByteBufferException { diff --git a/src/shared/Network/Socket.h b/src/shared/Network/Socket.h index 79340bd..ac532e6 100644 --- a/src/shared/Network/Socket.h +++ b/src/shared/Network/Socket.h @@ -22,6 +22,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _SOCKETBASE_H #define _SOCKETBASE_H +#if defined( __GNUC__ ) && (__GNUC__ * 10000 + __GNUC_MINOR__ * 100)>=40300 + #include +#endif #include #include diff --git a/src/shared/SysDefs.h b/src/shared/SysDefs.h index db404e4..dc187ab 100644 --- a/src/shared/SysDefs.h +++ b/src/shared/SysDefs.h @@ -70,6 +70,7 @@ #else #define stricmp strcasecmp #define strnicmp strncasecmp + #define memicmp memcmp #define I64FMT "%016llX" #define I64FMTD "%llu" #define SI64FMTD "%lld"