Danbias/Code/Game/GameProtocols/ControlProtocols.h

66 lines
1.7 KiB
C
Raw Normal View History

2013-12-18 15:28:47 +01:00
#ifndef GAMELOGIC_CONTROL_PROTOCOLS_H
#define GAMELOGIC_CONTROL_PROTOCOLS_H
#include <CustomNetProtocol.h>
#include "ProtocolIdentificationID.h"
namespace GameLogic
{
2013-12-20 09:42:02 +01:00
struct Protocol_General_Status :public Oyster::Network::CustomProtocolObject
2013-12-18 15:28:47 +01:00
{
enum States
{
States_ready,
States_idle,
States_bussy,
States_disconected,
};
States status;
2013-12-20 09:42:02 +01:00
Protocol_General_Status()
2013-12-18 15:28:47 +01:00
{
2014-01-07 10:26:09 +01:00
this->protocol[protocol_INDEX_ID].value = protocol_General_Status;
this->protocol[protocol_INDEX_ID].type = Oyster::Network::NetAttributeType_Short;
2013-12-18 15:28:47 +01:00
this->protocol[1].type = Oyster::Network::NetAttributeType_Short;
}
2014-01-07 10:26:09 +01:00
Protocol_General_Status(States state)
2013-12-20 09:42:02 +01:00
{
2014-01-07 10:26:09 +01:00
this->protocol[protocol_INDEX_ID].value = protocol_General_Status;
this->protocol[protocol_INDEX_ID].type = Oyster::Network::NetAttributeType_Short;
this->status = state;
this->protocol[1].type = Oyster::Network::NetAttributeType_Short;
2013-12-20 09:42:02 +01:00
}
Oyster::Network::CustomNetProtocol* GetProtocol() override
{
2014-01-07 10:26:09 +01:00
this->protocol[1].value = status;
2013-12-20 09:42:02 +01:00
return &protocol;
}
private:
Oyster::Network::CustomNetProtocol protocol;
};
struct Protocol_General_Text :public Oyster::Network::CustomProtocolObject
{
char* text;
Protocol_General_Text()
{
2014-01-07 10:26:09 +01:00
this->protocol[protocol_INDEX_ID].value = protocol_General_Text;
this->protocol[protocol_INDEX_ID].type = Oyster::Network::NetAttributeType_Short;
2013-12-20 09:42:02 +01:00
this->protocol[1].type = Oyster::Network::NetAttributeType_CharArray;
}
Oyster::Network::CustomNetProtocol* GetProtocol() override
{
this->protocol[1].value.netCharPtr = text;
return &protocol;
}
private:
Oyster::Network::CustomNetProtocol protocol;
};
2013-12-18 15:28:47 +01:00
}
#endif //!GAMELOGIC_CONTROL_PROTOCOLS_H