diff options
author | Vincent_Michael <Vincent_Michael@gmx.de> | 2013-02-12 21:21:06 +0100 |
---|---|---|
committer | Vincent_Michael <Vincent_Michael@gmx.de> | 2013-02-12 21:21:06 +0100 |
commit | d292b05ac1fb04be23161072a7386d7f44905fe1 (patch) | |
tree | d51653352565dd636b3808303ab2013aaccb08fa /src | |
parent | a0cb102538dae7fa2d173b4d1990a4aef8e5d55c (diff) | |
parent | 20cd6cfc61414c47a6ed784e62f967ca6b44960e (diff) |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Diffstat (limited to 'src')
-rw-r--r-- | src/genrev/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/server/authserver/Server/RealmSocket.cpp | 8 | ||||
-rw-r--r-- | src/server/game/Entities/Object/Object.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Entities/Object/Updates/UpdateMask.h | 116 | ||||
-rw-r--r-- | src/server/game/Server/WorldSocket.cpp | 4 | ||||
-rw-r--r-- | src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp | 3 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_item.cpp | 2 | ||||
-rw-r--r-- | src/server/worldserver/RemoteAccess/RASocket.cpp | 5 |
8 files changed, 74 insertions, 68 deletions
diff --git a/src/genrev/CMakeLists.txt b/src/genrev/CMakeLists.txt index c01c57b636f..b54534af827 100644 --- a/src/genrev/CMakeLists.txt +++ b/src/genrev/CMakeLists.txt @@ -10,6 +10,6 @@ # Need to pass old ${CMAKE_BINARY_DIR} as param because its different at build stage add_custom_target(revision.h ALL - COMMAND ${CMAKE_COMMAND} -DBUILDDIR=${CMAKE_BINARY_DIR} -P ${CMAKE_SOURCE_DIR}/cmake/genrev.cmake + COMMAND ${CMAKE_COMMAND} -DNO_GIT=${WITHOUT_GIT} -DGIT_EXEC=${GIT_EXECUTABLE} -DBUILDDIR=${CMAKE_BINARY_DIR} -P ${CMAKE_SOURCE_DIR}/cmake/genrev.cmake WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) diff --git a/src/server/authserver/Server/RealmSocket.cpp b/src/server/authserver/Server/RealmSocket.cpp index e67af783d5f..565a8c9a600 100644 --- a/src/server/authserver/Server/RealmSocket.cpp +++ b/src/server/authserver/Server/RealmSocket.cpp @@ -23,10 +23,6 @@ #include "RealmSocket.h" #include "Log.h" -#ifndef MSG_NOSIGNAL -#define MSG_NOSIGNAL 0 -#endif - RealmSocket::Session::Session(void) {} RealmSocket::Session::~Session(void) { } @@ -138,7 +134,11 @@ ssize_t RealmSocket::noblk_send(ACE_Message_Block &message_block) return -1; // Try to send the message directly. +#ifdef MSG_NOSIGNAL ssize_t n = peer().send(message_block.rd_ptr(), len, MSG_NOSIGNAL); +#else + ssize_t n = peer().send(message_block.rd_ptr(), len); +#endif // MSG_NOSIGNAL if (n < 0) { diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 0be9002e1d8..cb497d11d4f 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -660,7 +660,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* WPAssert(updateMask && updateMask->GetCount() == valCount); *data << (uint8)updateMask->GetBlockCount(); - data->append(updateMask->GetMask(), updateMask->GetLength()); + updateMask->AppendToPacket(data); // 2 specialized loops for speed optimization in non-unit case if (isType(TYPEMASK_UNIT)) // unit (creature/player) case diff --git a/src/server/game/Entities/Object/Updates/UpdateMask.h b/src/server/game/Entities/Object/Updates/UpdateMask.h index 784c4eba96f..8be8dfecdaf 100644 --- a/src/server/game/Entities/Object/Updates/UpdateMask.h +++ b/src/server/game/Entities/Object/Updates/UpdateMask.h @@ -21,106 +21,106 @@ #include "UpdateFields.h" #include "Errors.h" +#include "ByteBuffer.h" class UpdateMask { public: - UpdateMask() : mCount(0), mBlocks(0), mUpdateMask(0) { } - UpdateMask(UpdateMask const& mask) : mUpdateMask(0) { *this = mask; } + /// Type representing how client reads update mask + typedef uint32 ClientUpdateMaskType; - ~UpdateMask() + enum UpdateMaskCount { - delete[] mUpdateMask; - } + CLIENT_UPDATE_MASK_BITS = sizeof(ClientUpdateMaskType) * 8, + }; - void SetBit(uint32 index) - { - ((uint8*)mUpdateMask)[index >> 3] |= 1 << (index & 0x7); - } + UpdateMask() : _fieldCount(0), _blockCount(0), _bits(NULL) { } - void UnsetBit(uint32 index) + UpdateMask(UpdateMask const& right) { - ((uint8*)mUpdateMask)[index >> 3] &= (0xff ^ (1 << (index & 0x7))); + SetCount(right.GetCount()); + memcpy(_bits, right._bits, sizeof(uint8) * _blockCount * 32); } - bool GetBit(uint32 index) const + ~UpdateMask() { delete[] _bits; } + + void SetBit(uint32 index) { _bits[index] = 1; } + void UnsetBit(uint32 index) { _bits[index] = 0; } + bool GetBit(uint32 index) const { return _bits[index] != 0; } + + void AppendToPacket(ByteBuffer* data) { - return (((uint8*)mUpdateMask)[index >> 3] & (1 << (index & 0x7))) != 0; + for (uint32 i = 0; i < GetBlockCount(); ++i) + { + ClientUpdateMaskType maskPart = 0; + for (uint32 j = 0; j < CLIENT_UPDATE_MASK_BITS; ++j) + if (_bits[CLIENT_UPDATE_MASK_BITS * i + j]) + maskPart |= 1 << j; + + *data << maskPart; + } } - uint32 GetBlockCount() const { return mBlocks; } - uint32 GetLength() const { return mBlocks << 2; } - uint32 GetCount() const { return mCount; } - uint8* GetMask() { return (uint8*)mUpdateMask; } + uint32 GetBlockCount() const { return _blockCount; } + uint32 GetCount() const { return _fieldCount; } - void SetCount (uint32 valuesCount) + void SetCount(uint32 valuesCount) { - delete [] mUpdateMask; + delete[] _bits; - mCount = valuesCount; - mBlocks = (valuesCount + 31) / 32; + _fieldCount = valuesCount; + _blockCount = (valuesCount + CLIENT_UPDATE_MASK_BITS - 1) / CLIENT_UPDATE_MASK_BITS; - mUpdateMask = new uint32[mBlocks]; - memset(mUpdateMask, 0, mBlocks << 2); + _bits = new uint8[_blockCount * CLIENT_UPDATE_MASK_BITS]; + memset(_bits, 0, sizeof(uint8) * _blockCount * CLIENT_UPDATE_MASK_BITS); } void Clear() { - if (mUpdateMask) - memset(mUpdateMask, 0, mBlocks << 2); + if (_bits) + memset(_bits, 0, sizeof(uint8) * _blockCount * CLIENT_UPDATE_MASK_BITS); } - UpdateMask& operator=(UpdateMask const& mask) + UpdateMask& operator=(UpdateMask const& right) { - if (this == &mask) + if (this == &right) return *this; - SetCount(mask.mCount); - memcpy(mUpdateMask, mask.mUpdateMask, mBlocks << 2); - + SetCount(right.GetCount()); + memcpy(_bits, right._bits, sizeof(uint8) * _blockCount * CLIENT_UPDATE_MASK_BITS); return *this; } - void operator&=(UpdateMask const& mask) + UpdateMask& operator&=(UpdateMask const& right) { - ASSERT(mask.mCount <= mCount); - for (uint32 i = 0; i < mBlocks; ++i) - mUpdateMask[i] &= mask.mUpdateMask[i]; - } + ASSERT(right.GetCount() <= GetCount()); + for (uint32 i = 0; i < _fieldCount; ++i) + _bits[i] &= right._bits[i]; - void operator|=(UpdateMask const& mask) - { - ASSERT(mask.mCount <= mCount); - for (uint32 i = 0; i < mBlocks; ++i) - mUpdateMask[i] |= mask.mUpdateMask[i]; + return *this; } - UpdateMask operator&(UpdateMask const& mask) const + UpdateMask& operator|=(UpdateMask const& right) { - ASSERT(mask.mCount <= mCount); + ASSERT(right.GetCount() <= GetCount()); + for (uint32 i = 0; i < _fieldCount; ++i) + _bits[i] |= right._bits[i]; - UpdateMask newmask; - newmask = *this; - newmask &= mask; - - return newmask; + return *this; } - UpdateMask operator|(UpdateMask const& mask) const + UpdateMask operator|(UpdateMask const& right) { - ASSERT(mask.mCount <= mCount); - - UpdateMask newmask; - newmask = *this; - newmask |= mask; - - return newmask; + UpdateMask ret(*this); + ret |= right; + return ret; } private: - uint32 mCount; - uint32 mBlocks; - uint32 *mUpdateMask; + uint32 _fieldCount; + uint32 _blockCount; + uint8* _bits; }; + #endif diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index 295432dc956..7c263a62b19 100644 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -384,9 +384,9 @@ int WorldSocket::handle_output_queue (GuardType& g) const size_t send_len = mblk->length(); #ifdef MSG_NOSIGNAL - ssize_t n = peer().send (mblk->rd_ptr(), send_len, MSG_NOSIGNAL); + ssize_t n = peer().send(mblk->rd_ptr(), send_len, MSG_NOSIGNAL); #else - ssize_t n = peer().send (mblk->rd_ptr(), send_len); + ssize_t n = peer().send(mblk->rd_ptr(), send_len); #endif // MSG_NOSIGNAL if (n == 0) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 7ced791f44c..7730a0448fe 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -2159,7 +2159,8 @@ class spell_the_lich_king_necrotic_plague_jump : public SpellScriptLoader void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (Unit* caster = GetCaster()) - caster->GetAI()->SetData(DATA_PLAGUE_STACK, GetStackAmount()); + if (caster->GetAI()) + caster->GetAI()->SetData(DATA_PLAGUE_STACK, GetStackAmount()); } void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index b8e17f4ecca..d57ed6e126b 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -140,7 +140,7 @@ class spell_item_blessing_of_ancient_kings : public SpellScriptLoader protEff->SetAmount(std::min<int32>(protEff->GetAmount() + absorb, 20000)); // Refresh and return to prevent replacing the aura - aurEff->GetBase()->RefreshDuration(); + protEff->GetBase()->RefreshDuration(); } else GetTarget()->CastCustomSpell(SPELL_PROTECTION_OF_ANCIENT_KINGS, SPELLVALUE_BASE_POINT0, absorb, eventInfo.GetProcTarget(), true, NULL, aurEff); diff --git a/src/server/worldserver/RemoteAccess/RASocket.cpp b/src/server/worldserver/RemoteAccess/RASocket.cpp index b939f267233..ee05e83ad4d 100644 --- a/src/server/worldserver/RemoteAccess/RASocket.cpp +++ b/src/server/worldserver/RemoteAccess/RASocket.cpp @@ -336,7 +336,12 @@ int RASocket::subnegotiate() //! Just send back end of subnegotiation packet uint8 const reply[2] = {0xFF, 0xF0}; + +#ifdef MSG_NOSIGNAL + return int(peer().send(reply, 2, MSG_NOSIGNAL)); +#else return int(peer().send(reply, 2)); +#endif // MSG_NOSIGNAL } int RASocket::svc(void) |