Updated to latest PTR client build 9868.

This commit is contained in:
tomrus88 2009-05-05 10:41:22 +04:00
parent 966e12a9cd
commit 7e938af972
29 changed files with 172 additions and 121 deletions

View file

@ -101,24 +101,20 @@ void UpdateData::Compress(void* dst, uint32 *dst_size, void* src, int src_size)
*dst_size = c_stream.total_out;
}
bool UpdateData::BuildPacket(WorldPacket *packet, bool hasTransport)
bool UpdateData::BuildPacket(WorldPacket *packet)
{
ByteBuffer buf(m_data.size() + 10 + m_outOfRangeGUIDs.size()*8);
ByteBuffer buf(m_data.size());
buf << (uint32) (!m_outOfRangeGUIDs.empty() ? m_blockCount + 1 : m_blockCount);
//buf << (uint8) (hasTransport ? 1 : 0);
if(!m_outOfRangeGUIDs.empty())
{
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 << (uint8)0xFF;
buf << (uint64) *i;
buf.appendPackGUID(*i);
}
}
@ -126,24 +122,23 @@ bool UpdateData::BuildPacket(WorldPacket *packet, bool hasTransport)
packet->clear();
if (m_data.size() > 50 )
size_t pSize = buf.size();
if (pSize > 100 ) // compress large packets
{
uint32 destsize = buf.size() + buf.size()/10 + 16;
packet->resize( destsize );
packet->resize(pSize);
packet->put(0, (uint32)buf.size());
packet->put<uint32>(0, pSize);
Compress(const_cast<uint8*>(packet->contents()) + sizeof(uint32),
&destsize,
(void*)buf.contents(),
buf.size());
uint32 destsize = 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
else // send small packets without compression
{
packet->append( buf );
packet->SetOpcode( SMSG_UPDATE_OBJECT );