#include "main.h" hash_map gClientOpcodesTable; //Handler function declarations int HandleOpcode_FS_FIRST(NetMessage* pData, LocalData* pLir); int HandleOpcode_FS_CONNECT(NetMessage* pData, LocalData* pLir); int HandleOpcode_FS_REQUEST(NetMessage* pData, LocalData* pLir); int HandleOpcode_FS_REQUEST_MORE(NetMessage* pData, LocalData* pLir); int HandleOpcode_FS_COUNTER_SETTING(NetMessage* pData, LocalData* pLir); //Registers an opcode on the hash table void AddOpcode(char* pName, unsigned char opcode, int (*handler)(NetMessage*, LocalData*)) { OPCODE o; o.handler=handler; strcpy(o.name, pName); o.opcode=opcode; typedef pair opair; gClientOpcodesTable.insert(opair(opcode,o)); } int PopulateOpcodeTable() { gCoreLog.Section("Opcode table..."); AddOpcode("FS_CONNECT", 0, HandleOpcode_FS_CONNECT); AddOpcode("FS_REQUEST", 3, HandleOpcode_FS_REQUEST); AddOpcode("FS_COMPLETE", 7, HandleOpcode_FS_REQUEST_MORE); AddOpcode("FS_COUNTER_SETTING", 16, HandleOpcode_FS_COUNTER_SETTING); gCoreLog.SectionOk(); return 0; }