Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
OPCodesTpl.h
Go to the documentation of this file.
1#pragma once
2#ifndef DVD_OPCODES_H_INFO_
3#define DVD_OPCODES_H_INFO_
4
5#ifndef OPCODE_ENUM
6#define OPCODE_ENUM
7#endif
8
9namespace Divide {
10
13class OPCodes {
14public:
15 using ValueType = int32_t;
16
17 static const ValueType MSG_NOP = 0x000;
18 static const ValueType MSG_HEARTBEAT = 0x001;
19 static const ValueType SMSG_SEND_FILE = 0x002;
20 static const ValueType SMSG_DISCONNECT = 0x003;
21 static const ValueType CMSG_REQUEST_DISCONNECT = 0x004;
22 static const ValueType CMSG_ENTITY_UPDATE = 0x005;
23 static const ValueType CMSG_PING = 0x006;
24 static const ValueType SMSG_PONG = 0x007;
25
27
28 static constexpr ValueType OPCODE_ID(const ValueType index) {
29 return FIRST_FREE_OPCODE + index;
30 }
31};
32
33/*To create new OPCodes follow this convention:
34
35class OPCodesEx : public OPCodes { ///<Or whaterver name you wish
36 static const ValueType CMSG_EXAMPLE = OPCODE_ID(1);
37 static const ValueType SMSG_EXAMPLE2 = OPCODE_ID(2);
38};
39
40And use OPCodesEx for switch statements and packet handling
41*/
42
43}; // namespace Divide
44
45#endif //DVD_OPCODES_H_INFO_
int32_t ValueType
Definition: OPCodesTpl.h:15
static const ValueType SMSG_SEND_FILE
Definition: OPCodesTpl.h:19
static constexpr ValueType OPCODE_ID(const ValueType index)
Definition: OPCodesTpl.h:28
static const ValueType CMSG_PING
Definition: OPCodesTpl.h:23
static const ValueType FIRST_FREE_OPCODE
Definition: OPCodesTpl.h:26
static const ValueType MSG_NOP
Definition: OPCodesTpl.h:17
static const ValueType CMSG_ENTITY_UPDATE
Definition: OPCodesTpl.h:22
static const ValueType CMSG_REQUEST_DISCONNECT
Definition: OPCodesTpl.h:21
static const ValueType SMSG_PONG
Definition: OPCodesTpl.h:24
static const ValueType SMSG_DISCONNECT
Definition: OPCodesTpl.h:20
static const ValueType MSG_HEARTBEAT
Definition: OPCodesTpl.h:18
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7