mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
Fixed typos, merge errors.
This commit is contained in:
parent
1f87157edf
commit
8a0f9f61f9
4 changed files with 26 additions and 28 deletions
|
|
@ -423,7 +423,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
|
||||||
m_lastPotionId = 0;
|
m_lastPotionId = 0;
|
||||||
|
|
||||||
m_activeSpec = 0;
|
m_activeSpec = 0;
|
||||||
m_speakCount = 0;
|
m_specsCount = 0;
|
||||||
|
|
||||||
for (int i = 0; i < BASEMOD_END; ++i)
|
for (int i = 0; i < BASEMOD_END; ++i)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,7 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data )
|
||||||
data << uint8(ci->RacialLeader);
|
data << uint8(ci->RacialLeader);
|
||||||
for(uint32 i = 0; i < 4; ++i)
|
for(uint32 i = 0; i < 4; ++i)
|
||||||
data << uint32(ci->questItems[i]); // itemId[4], quest drop
|
data << uint32(ci->questItems[i]); // itemId[4], quest drop
|
||||||
data << uint32(0); // CreatureMovementInfo.dbc
|
data << uint32(ci->movementId); // CreatureMovementInfo.dbc
|
||||||
SendPacket( &data );
|
SendPacket( &data );
|
||||||
sLog.outDebug( "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE" );
|
sLog.outDebug( "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE" );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ void UpdateData::AddUpdateBlock(const ByteBuffer &block)
|
||||||
++m_blockCount;
|
++m_blockCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateData::Compress( uint8* dst, uint32 *dst_size, uint8* src, int src_size )
|
void UpdateData::Compress(void* dst, uint32 *dst_size, void* src, int src_size)
|
||||||
{
|
{
|
||||||
z_stream c_stream;
|
z_stream c_stream;
|
||||||
|
|
||||||
|
|
@ -105,44 +105,42 @@ bool UpdateData::BuildPacket(WorldPacket *packet)
|
||||||
{
|
{
|
||||||
ASSERT(packet->empty()); // shouldn't happen
|
ASSERT(packet->empty()); // shouldn't happen
|
||||||
|
|
||||||
ByteBuffer buf(m_outOfRangeGUIDs.empty() ? m_data.size() : 1 + 4 + m_outOfRangeGUIDs.size() * 9 + m_data.size());
|
ByteBuffer buf(4 + (m_outOfRangeGUIDs.empty() ? 0 : 1 + 4 + 9 * m_outOfRangeGUIDs.size()) + m_data.wpos());
|
||||||
|
|
||||||
// put update blocks count
|
buf << (uint32) (!m_outOfRangeGUIDs.empty() ? m_blockCount + 1 : m_blockCount);
|
||||||
buf << uint32(m_outOfRangeGUIDs.empty() ? m_blockCount : m_blockCount + 1);
|
|
||||||
|
|
||||||
if(m_outOfRangeGUIDs.empty())
|
if(!m_outOfRangeGUIDs.empty())
|
||||||
{
|
{
|
||||||
// put update data
|
buf << (uint8) UPDATETYPE_OUT_OF_RANGE_OBJECTS;
|
||||||
buf.append(m_data);
|
buf << (uint32) m_outOfRangeGUIDs.size();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// put out of range GUID's
|
|
||||||
buf << uint8(UPDATETYPE_OUT_OF_RANGE_OBJECTS);
|
|
||||||
buf << uint32(m_outOfRangeGUIDs.size());
|
|
||||||
|
|
||||||
for(std::set<uint64>::const_iterator i = m_outOfRangeGUIDs.begin(); i != m_outOfRangeGUIDs.end(); ++i)
|
for(std::set<uint64>::const_iterator i = m_outOfRangeGUIDs.begin(); i != m_outOfRangeGUIDs.end(); ++i)
|
||||||
|
{
|
||||||
buf.appendPackGUID(*i);
|
buf.appendPackGUID(*i);
|
||||||
|
}
|
||||||
// put update data
|
|
||||||
buf.append(m_data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t pSize = buf.size();
|
buf.append(m_data);
|
||||||
|
|
||||||
if(pSize > 100) // compress large packets
|
size_t pSize = buf.wpos(); // use real used data size
|
||||||
|
|
||||||
|
if (pSize > 100 ) // compress large packets
|
||||||
{
|
{
|
||||||
packet->SetOpcode(SMSG_COMPRESSED_UPDATE_OBJECT);
|
|
||||||
packet->resize(pSize + sizeof(uint32));
|
|
||||||
packet->put<uint32>(0, pSize); // original size
|
|
||||||
uint32 destsize = pSize;
|
uint32 destsize = pSize;
|
||||||
Compress((uint8*)packet->contents() + sizeof(uint32), &destsize, (uint8*)buf.contents(), pSize);
|
packet->resize( destsize + sizeof(uint32) );
|
||||||
packet->resize(destsize + sizeof(uint32)); // resize packet to compressed size + 4
|
|
||||||
|
packet->put<uint32>(0, pSize);
|
||||||
|
Compress(const_cast<uint8*>(packet->contents()) + sizeof(uint32), &destsize, (void*)buf.contents(), pSize);
|
||||||
|
if (destsize == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
packet->resize( destsize + sizeof(uint32) );
|
||||||
|
packet->SetOpcode( SMSG_COMPRESSED_UPDATE_OBJECT );
|
||||||
}
|
}
|
||||||
else // send small packets without compression
|
else // send small packets without compression
|
||||||
{
|
{
|
||||||
packet->SetOpcode(SMSG_UPDATE_OBJECT);
|
packet->append( buf );
|
||||||
packet->append(buf);
|
packet->SetOpcode( SMSG_UPDATE_OBJECT );
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,6 @@ class UpdateData
|
||||||
std::set<uint64> m_outOfRangeGUIDs;
|
std::set<uint64> m_outOfRangeGUIDs;
|
||||||
ByteBuffer m_data;
|
ByteBuffer m_data;
|
||||||
|
|
||||||
void Compress(uint8* dst, uint32 *dst_size, uint8* src, int src_size);
|
void Compress(void* dst, uint32 *dst_size, void* src, int src_size);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue