Player action protocol added

This commit is contained in:
lindaandersson 2014-02-24 14:59:01 +01:00
parent 7bb67b6a85
commit 627063748d
2 changed files with 41 additions and 0 deletions

View File

@ -937,5 +937,45 @@ namespace GameLogic
Oyster::Network::CustomNetProtocol protocol; Oyster::Network::CustomNetProtocol protocol;
}; };
} }
//#define protocol_Gameplay_ObjectAction 368
struct Protocol_ObjectAction :public Oyster::Network::CustomProtocolObject
{
short objectID;
float animationID;
Protocol_ObjectAction()
{
this->protocol[0].value = protocol_Gameplay_ObjectAction;
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
this->protocol[1].type = Oyster::Network::NetAttributeType_Short;
this->protocol[2].type = Oyster::Network::NetAttributeType_Float;
objectID = 0;
animationID = -1;
}
Protocol_ObjectAction(Oyster::Network::CustomNetProtocol& p)
{
objectID = p[1].value.netShort;
animationID = p[2].value.netFloat;
}
Protocol_ObjectAction(float animID, int id)
{
this->protocol[0].value = protocol_Gameplay_ObjectAction;
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
this->protocol[1].type = Oyster::Network::NetAttributeType_Short;
this->protocol[2].type = Oyster::Network::NetAttributeType_Float;
objectID = id;
animationID = animID;
}
Oyster::Network::CustomNetProtocol GetProtocol() override
{
this->protocol[1].value = objectID;
this->protocol[2].value = animationID;
return protocol;
}
private:
Oyster::Network::CustomNetProtocol protocol;
};
#endif // !GAMELOGIC_PLAYER_PROTOCOLS_H #endif // !GAMELOGIC_PLAYER_PROTOCOLS_H

View File

@ -70,6 +70,7 @@
#define protocol_Gameplay_ObjectRespawn 365 #define protocol_Gameplay_ObjectRespawn 365
#define protocol_Gameplay_ObjectDie 366 #define protocol_Gameplay_ObjectDie 366
#define protocol_Gameplay_ObjectDisconnectPlayer 367 #define protocol_Gameplay_ObjectDisconnectPlayer 367
#define protocol_Gameplay_ObjectAction 368
#define protocol_GameplayMAX 399 #define protocol_GameplayMAX 399