reduce mob client initialisation data

This commit is contained in:
darkrose 2015-04-23 00:02:31 +10:00
parent 549cfea8de
commit 94d295dacb
2 changed files with 22 additions and 9 deletions

View File

@ -540,7 +540,7 @@ void MobCAO::initialize(const std::string &data)
// version // version
u8 version = readU8(is); u8 version = readU8(is);
// check version // check version
if (version != 0) if (version < 0 || version > 1)
return; return;
// pos // pos
m_position = readV3F1000(is); m_position = readV3F1000(is);
@ -550,13 +550,15 @@ void MobCAO::initialize(const std::string &data)
// yaw // yaw
m_yaw = readF1000(is); m_yaw = readF1000(is);
pos_translator.init(m_position,m_yaw); pos_translator.init(m_position,m_yaw);
// client doesn't use these, but has to read past them if (version == 0) {
// speed // client doesn't use these, but has to read past them
readV3F1000(is); // speed
// age readV3F1000(is);
readF1000(is); // age
// hp readF1000(is);
readU8(is); // hp
readU8(is);
}
// shooting // shooting
m_shooting = !!readU8(is); m_shooting = !!readU8(is);
} }

View File

@ -490,7 +490,18 @@ std::string MobSAO::getStaticData()
} }
std::string MobSAO::getClientInitializationData() std::string MobSAO::getClientInitializationData()
{ {
return getStaticData(); std::ostringstream os(std::ios::binary);
// version
writeU8(os, 1);
// pos
writeV3F1000(os, m_base_position);
// content
writeU16(os,m_content);
// yaw
writeF1000(os,m_yaw);
// shooting
writeU8(os,(u8)m_shooting);
return os.str();
} }
void MobSAO::step(float dtime, bool send_recommended) void MobSAO::step(float dtime, bool send_recommended)
{ {