1
0

Merge pull request #909 from jfhumann/fixes

Bug fixes and optimizations.

We need to visit the API functions and check that they return only those values expected. `cWorld::CreateProjectile()` seems affected, too, by the same issue of ToLua returning extra values. In the cleanest form, these functions will need moving to ManualBindings.cpp
This commit is contained in:
Mattes D
2014-04-22 13:34:32 +02:00
48 changed files with 263 additions and 218 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();
}
@@ -295,11 +297,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();
}