forked from oerkki/voxelands
reduce mob client initialisation data
This commit is contained in:
parent
549cfea8de
commit
94d295dacb
|
@ -540,7 +540,7 @@ void MobCAO::initialize(const std::string &data)
|
|||
// version
|
||||
u8 version = readU8(is);
|
||||
// check version
|
||||
if (version != 0)
|
||||
if (version < 0 || version > 1)
|
||||
return;
|
||||
// pos
|
||||
m_position = readV3F1000(is);
|
||||
|
@ -550,13 +550,15 @@ void MobCAO::initialize(const std::string &data)
|
|||
// yaw
|
||||
m_yaw = readF1000(is);
|
||||
pos_translator.init(m_position,m_yaw);
|
||||
// client doesn't use these, but has to read past them
|
||||
// speed
|
||||
readV3F1000(is);
|
||||
// age
|
||||
readF1000(is);
|
||||
// hp
|
||||
readU8(is);
|
||||
if (version == 0) {
|
||||
// client doesn't use these, but has to read past them
|
||||
// speed
|
||||
readV3F1000(is);
|
||||
// age
|
||||
readF1000(is);
|
||||
// hp
|
||||
readU8(is);
|
||||
}
|
||||
// shooting
|
||||
m_shooting = !!readU8(is);
|
||||
}
|
||||
|
|
|
@ -490,7 +490,18 @@ std::string MobSAO::getStaticData()
|
|||
}
|
||||
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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue