Changed if-else to switch-case
This commit is contained in:
@@ -1733,25 +1733,23 @@ void cProtocol172::HandlePacketEntityAction(cByteBuffer & a_ByteBuffer)
|
||||
HANDLE_READ(a_ByteBuffer, ReadByte, Byte, Action);
|
||||
HANDLE_READ(a_ByteBuffer, ReadBEInt, int, JumpBoost);
|
||||
|
||||
if (Action == 1) // Crouch
|
||||
switch (Action)
|
||||
{
|
||||
case 1: // Crouch
|
||||
m_Client->HandleEntityCrouch(PlayerID, true);
|
||||
}
|
||||
else if (Action == 2) // Uncrouch
|
||||
{
|
||||
break;
|
||||
case 2: // Unchrouch
|
||||
m_Client->HandleEntityCrouch(PlayerID, false);
|
||||
}
|
||||
else if (Action == 3) // Leave Bed
|
||||
{
|
||||
break;
|
||||
case 3: // Leave Bed
|
||||
m_Client->HandleEntityLeaveBed(PlayerID);
|
||||
}
|
||||
else if (Action == 4) // Start sprinting
|
||||
{
|
||||
break;
|
||||
case 4: // Start sprinting
|
||||
m_Client->HandleEntitySprinting(PlayerID, true);
|
||||
}
|
||||
else if (Action == 5) // Stop sprinting
|
||||
{
|
||||
break;
|
||||
case 5: // Stop sprinting
|
||||
m_Client->HandleEntitySprinting(PlayerID, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user