Changed if-else to switch-case
This commit is contained in:
@@ -185,25 +185,23 @@ int cProtocol161::ParseEntityAction(void)
|
||||
HANDLE_PACKET_READ(ReadChar, char, ActionID);
|
||||
HANDLE_PACKET_READ(ReadBEInt, int, UnknownHorseVal);
|
||||
|
||||
if (ActionID == 1) // Crouch
|
||||
switch (ActionID)
|
||||
{
|
||||
case 1: // Crouch
|
||||
m_Client->HandleEntityCrouch(EntityID, true);
|
||||
}
|
||||
else if (ActionID == 2) // Uncrouch
|
||||
{
|
||||
break;
|
||||
case 2: // Uncrouch
|
||||
m_Client->HandleEntityCrouch(EntityID, false);
|
||||
}
|
||||
else if (ActionID == 3) // Leave Bed
|
||||
{
|
||||
break;
|
||||
case 3: // Leave Bed
|
||||
m_Client->HandleEntityLeaveBed(EntityID);
|
||||
}
|
||||
else if (ActionID == 4) // Start sprinting
|
||||
{
|
||||
break;
|
||||
case 4: // Start sprinting
|
||||
m_Client->HandleEntitySprinting(EntityID, true);
|
||||
}
|
||||
else if (ActionID == 5) // Stop sprinting
|
||||
{
|
||||
break;
|
||||
case 5: // Stop sprinting
|
||||
m_Client->HandleEntitySprinting(EntityID, false);
|
||||
break;
|
||||
}
|
||||
|
||||
return PARSE_OK;
|
||||
|
||||
Reference in New Issue
Block a user