1
0

Did some static analysis, fixed some bugs and optimized a lot of code

This commit is contained in:
jfhumann
2014-04-18 21:09:44 +02:00
parent 449afa850e
commit 013da806ec
48 changed files with 257 additions and 212 deletions

View File

@@ -131,9 +131,10 @@ void cProtocol161::SendHealth(void)
{
cCSLock Lock(m_CSPacket);
WriteByte (PACKET_UPDATE_HEALTH);
WriteFloat((float)m_Client->GetPlayer()->GetHealth());
WriteShort((short)m_Client->GetPlayer()->GetFoodLevel());
WriteFloat((float)m_Client->GetPlayer()->GetFoodSaturationLevel());
cPlayer * Player = m_Client->GetPlayer();
WriteFloat((float)Player->GetHealth());
WriteShort((short)Player->GetFoodLevel());
WriteFloat((float)Player->GetFoodSaturationLevel());
Flush();
}
@@ -144,11 +145,12 @@ void cProtocol161::SendHealth(void)
void cProtocol161::SendPlayerMaxSpeed(void)
{
cCSLock Lock(m_CSPacket);
cPlayer * Player = m_Client->GetPlayer();
WriteByte(PACKET_ENTITY_PROPERTIES);
WriteInt(m_Client->GetPlayer()->GetUniqueID());
WriteInt(Player->GetUniqueID());
WriteInt(1);
WriteString("generic.movementSpeed");
WriteDouble(0.1 * m_Client->GetPlayer()->GetMaxSpeed());
WriteDouble(0.1 * Player->GetMaxSpeed());
Flush();
}
@@ -276,11 +278,12 @@ cProtocol162::cProtocol162(cClientHandle * a_Client) :
void cProtocol162::SendPlayerMaxSpeed(void)
{
cCSLock Lock(m_CSPacket);
cPlayer * Player = m_Client->GetPlayer();
WriteByte(PACKET_ENTITY_PROPERTIES);
WriteInt(m_Client->GetPlayer()->GetUniqueID());
WriteInt(Player->GetUniqueID());
WriteInt(1);
WriteString("generic.movementSpeed");
WriteDouble(0.1 * m_Client->GetPlayer()->GetMaxSpeed());
WriteDouble(0.1 * Player->GetMaxSpeed());
WriteShort(0);
Flush();
}