mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-13 06:48:20 +00:00
Misc cleanup
This commit is contained in:
@@ -23,12 +23,9 @@
|
|||||||
|
|
||||||
namespace EQEmuCommand {
|
namespace EQEmuCommand {
|
||||||
|
|
||||||
std::map<std::string, void (*)(
|
using CommandFunction = void(*)(int argc, char** argv, argh::parser& cmd, std::string& description);
|
||||||
int argc,
|
|
||||||
char **argv,
|
std::map<std::string, CommandFunction> function_map;
|
||||||
argh::parser &cmd,
|
|
||||||
std::string &description
|
|
||||||
)> function_map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param cmd
|
* @param cmd
|
||||||
|
|||||||
+13
-14
@@ -17,17 +17,16 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
static constexpr char OP_SessionRequest = 0x01;
|
||||||
static const char OP_SessionRequest = 0x01;
|
static constexpr char OP_SessionResponse = 0x02;
|
||||||
static const char OP_SessionResponse = 0x02;
|
static constexpr char OP_Combined = 0x03;
|
||||||
static const char OP_Combined = 0x03;
|
static constexpr char OP_SessionDisconnect = 0x05;
|
||||||
static const char OP_SessionDisconnect = 0x05;
|
static constexpr char OP_KeepAlive = 0x06;
|
||||||
static const char OP_KeepAlive = 0x06;
|
static constexpr char OP_SessionStatRequest = 0x07;
|
||||||
static const char OP_SessionStatRequest = 0x07;
|
static constexpr char OP_SessionStatResponse = 0x08;
|
||||||
static const char OP_SessionStatResponse= 0x08;
|
static constexpr char OP_Packet = 0x09;
|
||||||
static const char OP_Packet = 0x09;
|
static constexpr char OP_Fragment = 0x0d;
|
||||||
static const char OP_Fragment = 0x0d;
|
static constexpr char OP_OutOfOrderAck = 0x11;
|
||||||
static const char OP_OutOfOrderAck = 0x11;
|
static constexpr char OP_Ack = 0x15;
|
||||||
static const char OP_Ack = 0x15;
|
static constexpr char OP_AppCombined = 0x19;
|
||||||
static const char OP_AppCombined = 0x19;
|
static constexpr char OP_OutOfSession = 0x1d;
|
||||||
static const char OP_OutOfSession = 0x1d;
|
|
||||||
|
|||||||
+18
-14
@@ -31,7 +31,8 @@
|
|||||||
#define SHARED_OPCODES
|
#define SHARED_OPCODES
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class OpcodeManager {
|
class OpcodeManager
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
OpcodeManager();
|
OpcodeManager();
|
||||||
virtual ~OpcodeManager() {}
|
virtual ~OpcodeManager() {}
|
||||||
@@ -48,9 +49,10 @@ public:
|
|||||||
EmuOpcode NameSearch(const char *name);
|
EmuOpcode NameSearch(const char *name);
|
||||||
|
|
||||||
//This has to be public for stupid visual studio
|
//This has to be public for stupid visual studio
|
||||||
class OpcodeSetStrategy {
|
class OpcodeSetStrategy
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~OpcodeSetStrategy() {} //shut up compiler!
|
virtual ~OpcodeSetStrategy() = default;
|
||||||
virtual void Set(EmuOpcode emu_op, uint16 eq_op) = 0;
|
virtual void Set(EmuOpcode emu_op, uint16 eq_op) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -62,10 +64,12 @@ protected:
|
|||||||
static bool LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s, bool report_errors);
|
static bool LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s, bool report_errors);
|
||||||
};
|
};
|
||||||
|
|
||||||
class MutableOpcodeManager : public OpcodeManager {
|
class MutableOpcodeManager : public OpcodeManager
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
MutableOpcodeManager() : OpcodeManager() {}
|
MutableOpcodeManager() = default;
|
||||||
virtual bool Mutable() { return(true); }
|
|
||||||
|
virtual bool Mutable() override { return true; }
|
||||||
virtual void SetOpcode(EmuOpcode emu_op, uint16 eq_op) = 0;
|
virtual void SetOpcode(EmuOpcode emu_op, uint16 eq_op) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -108,16 +112,16 @@ public:
|
|||||||
virtual void SetOpcode(EmuOpcode emu_op, uint16 eq_op);
|
virtual void SetOpcode(EmuOpcode emu_op, uint16 eq_op);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
class NormalMemStrategy : public OpcodeManager::OpcodeSetStrategy {
|
class NormalMemStrategy : public OpcodeManager::OpcodeSetStrategy
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~NormalMemStrategy() {} //shut up compiler!
|
RegularOpcodeManager* it;
|
||||||
RegularOpcodeManager *it;
|
|
||||||
void Set(EmuOpcode emu_op, uint16 eq_op);
|
|
||||||
};
|
|
||||||
friend class NormalMemStrategy;
|
|
||||||
|
|
||||||
uint16 *emu_to_eq;
|
virtual void Set(EmuOpcode emu_op, uint16 eq_op) override;
|
||||||
EmuOpcode *eq_to_emu;
|
};
|
||||||
|
|
||||||
|
uint16* emu_to_eq;
|
||||||
|
EmuOpcode* eq_to_emu;
|
||||||
uint32 EQOpcodeCount;
|
uint32 EQOpcodeCount;
|
||||||
uint32 EmuOpcodeCount;
|
uint32 EmuOpcodeCount;
|
||||||
};
|
};
|
||||||
|
|||||||
+3
-1
@@ -23,11 +23,13 @@
|
|||||||
|
|
||||||
inline std::string random_string(size_t length)
|
inline std::string random_string(size_t length)
|
||||||
{
|
{
|
||||||
auto randchar = []() -> char {
|
auto randchar = []() -> char
|
||||||
|
{
|
||||||
const char charset[] = "0123456789" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz";
|
const char charset[] = "0123456789" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz";
|
||||||
const size_t max_index = (sizeof(charset) - 1);
|
const size_t max_index = (sizeof(charset) - 1);
|
||||||
return charset[static_cast<size_t>(std::rand()) % max_index];
|
return charset[static_cast<size_t>(std::rand()) % max_index];
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string str(length, 0);
|
std::string str(length, 0);
|
||||||
std::generate_n(str.begin(), length, randchar);
|
std::generate_n(str.begin(), length, randchar);
|
||||||
return str;
|
return str;
|
||||||
|
|||||||
+1
-1
@@ -44,6 +44,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
inline std::string GetIP() const { return (connection && connection->Handle()) ? connection->Handle()->RemoteIP() : 0; }
|
inline std::string GetIP() const { return (connection && connection->Handle()) ? connection->Handle()->RemoteIP() : 0; }
|
||||||
std::shared_ptr<EQ::Net::ServertalkServerConnection> connection;
|
|
||||||
|
|
||||||
|
std::shared_ptr<EQ::Net::ServertalkServerConnection> connection;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user