Unmounting vehicles implemented in the 1.6.1 way
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1650 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
b818addde4
commit
37590c4bd8
|
@ -1200,6 +1200,19 @@ void cClientHandle::HandleEntityAction(int a_EntityID, char a_ActionID)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void cClientHandle::HandleUnmount(void)
|
||||||
|
{
|
||||||
|
if (m_Player == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_Player->Detach();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cClientHandle::SendData(const char * a_Data, int a_Size)
|
void cClientHandle::SendData(const char * a_Data, int a_Size)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
|
|
@ -178,6 +178,7 @@ public:
|
||||||
void HandleKeepAlive (int a_KeepAliveID);
|
void HandleKeepAlive (int a_KeepAliveID);
|
||||||
bool HandleHandshake (const AString & a_Username);
|
bool HandleHandshake (const AString & a_Username);
|
||||||
void HandleEntityAction (int a_EntityID, char a_ActionID);
|
void HandleEntityAction (int a_EntityID, char a_ActionID);
|
||||||
|
void HandleUnmount (void);
|
||||||
|
|
||||||
/** Called when the protocol has finished logging the user in.
|
/** Called when the protocol has finished logging the user in.
|
||||||
Return true to allow the user in; false to kick them.
|
Return true to allow the user in; false to kick them.
|
||||||
|
|
|
@ -37,6 +37,7 @@ enum
|
||||||
{
|
{
|
||||||
PACKET_CHAT = 0x03,
|
PACKET_CHAT = 0x03,
|
||||||
PACKET_UPDATE_HEALTH = 0x08,
|
PACKET_UPDATE_HEALTH = 0x08,
|
||||||
|
PACKET_STEER_VEHICLE = 0x1b,
|
||||||
PACKET_ATTACH_ENTITY = 0x27,
|
PACKET_ATTACH_ENTITY = 0x27,
|
||||||
PACKET_ENTITY_PROPERTIES = 0x2c,
|
PACKET_ENTITY_PROPERTIES = 0x2c,
|
||||||
PACKET_WINDOW_OPEN = 0x64,
|
PACKET_WINDOW_OPEN = 0x64,
|
||||||
|
@ -161,3 +162,34 @@ int cProtocol161::ParsePlayerAbilities(void)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int cProtocol161::ParseSteerVehicle(void)
|
||||||
|
{
|
||||||
|
HANDLE_PACKET_READ(ReadBEFloat, float, Sideways);
|
||||||
|
HANDLE_PACKET_READ(ReadBEFloat, float, Forward);
|
||||||
|
HANDLE_PACKET_READ(ReadBool, bool, Jump);
|
||||||
|
HANDLE_PACKET_READ(ReadBool, bool, Unmount);
|
||||||
|
// TODO: m_Client->HandleSteerVehicle(...);
|
||||||
|
if (Unmount)
|
||||||
|
{
|
||||||
|
m_Client->HandleUnmount();
|
||||||
|
}
|
||||||
|
return PARSE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int cProtocol161::ParsePacket(unsigned char a_PacketType)
|
||||||
|
{
|
||||||
|
switch (a_PacketType)
|
||||||
|
{
|
||||||
|
case PACKET_STEER_VEHICLE: return ParseSteerVehicle();
|
||||||
|
default: return super::ParsePacket(a_PacketType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,12 @@ public:
|
||||||
|
|
||||||
virtual int ParseEntityAction (void) override;
|
virtual int ParseEntityAction (void) override;
|
||||||
virtual int ParsePlayerAbilities(void) override;
|
virtual int ParsePlayerAbilities(void) override;
|
||||||
|
|
||||||
|
// New packets:
|
||||||
|
virtual int ParseSteerVehicle(void);
|
||||||
|
|
||||||
|
// Enable new packets' handling
|
||||||
|
virtual int ParsePacket(unsigned char a_PacketType) override;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user