eq2go/old/common/opcodes/emu_opcodes.hpp
2025-08-06 19:00:30 -05:00

50 lines
1.2 KiB
C++

// Copyright (C) 2007 EQ2EMulator Development Team - GNU GPL v3+ License
#pragma once
// Maximum opcode value used in the regular EQ protocol
#define MAX_EQ_OPCODE 0xFFFF
/*
* EQEmu internal opcodes enumeration
*
* The opcode list is maintained in emu_oplist.h or login_oplist.h depending on build configuration.
* We rely on having more than 255 opcodes to ensure the enum type is at least 16 bits,
* allowing protocol flags to be used with opcode values.
*/
typedef enum
{
OP_Unknown = 0, // Default opcode for unrecognized packets
// Preprocessor hack to avoid maintaining duplicate opcode lists
#define N(x) x
#if !defined(LOGIN)
#include "emu_oplist.hpp"
#endif
#ifdef LOGIN
#include "login_oplist.hpp"
#endif
#undef N
_maxEmuOpcode // Sentinel value marking the end of valid opcodes
} EmuOpcode;
/*
* String names corresponding to each opcode value
* Used for debugging and logging purposes to provide human-readable opcode names
*/
const char *OpcodeNames[_maxEmuOpcode+1] = {
"OP_Unknown",
// Preprocessor hack to generate string literals from opcode names
#define N(x) #x
#if !defined(LOGIN)
#include "emu_oplist.hpp"
#endif
#ifdef LOGIN
#include "login_oplist.hpp"
#endif
#undef N
"" // Empty string terminator
};