diff --git a/common/EQStreamIntf.h b/common/EQStreamIntf.h index 22818c0a1..e3e3ac092 100644 --- a/common/EQStreamIntf.h +++ b/common/EQStreamIntf.h @@ -4,6 +4,7 @@ //this is the only part of an EQStream that is seen by the application. #include +#include "clientversions.h" typedef enum { ESTABLISHED, @@ -34,6 +35,7 @@ public: virtual const uint32 GetBytesRecieved() const { return 0; } virtual const uint32 GetBytesSentPerSecond() const { return 0; } virtual const uint32 GetBytesRecvPerSecond() const { return 0; } + virtual const EQClientVersion ClientVersion() const { return EQClientUnknown; } }; #endif /*EQSTREAMINTF_H_*/ diff --git a/common/EQStreamProxy.cpp b/common/EQStreamProxy.cpp index 7a1053d47..7480662af 100644 --- a/common/EQStreamProxy.cpp +++ b/common/EQStreamProxy.cpp @@ -22,6 +22,11 @@ std::string EQStreamProxy::Describe() const { return(m_structs->Describe()); } +const EQClientVersion EQStreamProxy::ClientVersion() const +{ + return m_structs->ClientVersion(); +} + void EQStreamProxy::QueuePacket(const EQApplicationPacket *p, bool ack_req) { if(p == NULL) return; diff --git a/common/EQStreamProxy.h b/common/EQStreamProxy.h index 56c847f2c..d2266ab9c 100644 --- a/common/EQStreamProxy.h +++ b/common/EQStreamProxy.h @@ -27,6 +27,7 @@ public: virtual void RemoveData(); virtual bool CheckState(EQStreamState state); virtual std::string Describe() const; + virtual const EQClientVersion ClientVersion() const; virtual const uint32 GetBytesSent() const; virtual const uint32 GetBytesRecieved() const; diff --git a/common/StructStrategy.h b/common/StructStrategy.h index 46ae9ffbb..b504db6a5 100644 --- a/common/StructStrategy.h +++ b/common/StructStrategy.h @@ -4,6 +4,7 @@ class EQApplicationPacket; class EQStream; #include "emu_opcodes.h" +#include "clientversions.h" #include @@ -23,6 +24,7 @@ public: void Decode(EQApplicationPacket *p) const; virtual std::string Describe() const = 0; + virtual const EQClientVersion ClientVersion() const = 0; protected: //some common coders: diff --git a/common/clientversions.h b/common/clientversions.h new file mode 100644 index 000000000..583648148 --- /dev/null +++ b/common/clientversions.h @@ -0,0 +1,27 @@ +#ifndef CLIENTVERSIONS_H +#define CLIENTVERSIONS_H + +static const uint32 BIT_Client62 = 1; +static const uint32 BIT_Titanium = 2; +static const uint32 BIT_SoF = 4; +static const uint32 BIT_SoD = 8; +static const uint32 BIT_Underfoot = 16; +static const uint32 BIT_RoF = 32; +static const uint32 BIT_TitaniumAndEarlier = 3; +static const uint32 BIT_SoFAndLater = 0xFFFFFFFC; +static const uint32 BIT_SoDAndLater = 0xFFFFFFF8; +static const uint32 BIT_UnderfootAndLater = 0xFFFFFFF0; +static const uint32 BIT_RoFAndLater = 0xFFFFFFE0; +static const uint32 BIT_AllClients = 0xFFFFFFFF; + +typedef enum { + EQClientUnknown = 0, + EQClient62, + EQClientTitanium, + EQClientSoF, + EQClientSoD, + EQClientUnderfoot, + EQClientRoF +} EQClientVersion; + +#endif /* CLIENTVERSIONS_H */ diff --git a/common/eq_constants.h b/common/eq_constants.h index c3267419d..1d5db537a 100644 --- a/common/eq_constants.h +++ b/common/eq_constants.h @@ -18,19 +18,6 @@ #ifndef EQ_CONSTANTS_H #define EQ_CONSTANTS_H -#define BIT_Client62 1 -#define BIT_Titanium 2 -#define BIT_SoF 4 -#define BIT_SoD 8 -#define BIT_Underfoot 16 -#define BIT_RoF 32 -#define BIT_TitaniumAndEarlier 3 -#define BIT_SoFAndLater 0xFFFFFFFC -#define BIT_SoDAndLater 0xFFFFFFF8 -#define BIT_UnderfootAndLater 0xFFFFFFF0 -#define BIT_RoFAndLater 0xFFFFFFE0 -#define BIT_AllClients 0xFFFFFFFF - #include "skills.h" /* diff --git a/common/patches/Client62.cpp b/common/patches/Client62.cpp index ed16c464c..98d856ae4 100644 --- a/common/patches/Client62.cpp +++ b/common/patches/Client62.cpp @@ -9,6 +9,7 @@ #include "../eq_packet_structs.h" #include "../MiscFunctions.h" #include "../Item.h" +#include "../clientversions.h" #include "Client62_structs.h" namespace Client62 { @@ -93,6 +94,10 @@ std::string Strategy::Describe() const { return(r); } +const EQClientVersion Strategy::ClientVersion() const +{ + return EQClient62; +} #include "SSDefine.h" diff --git a/common/patches/Client62.h b/common/patches/Client62.h index 244b6f1ef..e34b8cb48 100644 --- a/common/patches/Client62.h +++ b/common/patches/Client62.h @@ -24,6 +24,7 @@ namespace Client62 { protected: virtual std::string Describe() const; + virtual const EQClientVersion ClientVersion() const; //magic macro to declare our opcode processors #include "SSDeclare.h" diff --git a/common/patches/RoF.cpp b/common/patches/RoF.cpp index abc5be853..97cfd927a 100644 --- a/common/patches/RoF.cpp +++ b/common/patches/RoF.cpp @@ -98,9 +98,12 @@ std::string Strategy::Describe() const { r += name; return(r); } + +const EQClientVersion Strategy::ClientVersion() const +{ + return EQClientRoF; +} - - #include "SSDefine.h" // Converts Titanium Slot IDs to RoF Slot IDs for use in Encodes diff --git a/common/patches/RoF.h b/common/patches/RoF.h index 877f61973..411a0a99b 100644 --- a/common/patches/RoF.h +++ b/common/patches/RoF.h @@ -23,6 +23,7 @@ namespace RoF { protected: virtual std::string Describe() const; + virtual const EQClientVersion ClientVersion() const; //magic macro to declare our opcode processors #include "SSDeclare.h" diff --git a/common/patches/SoD.cpp b/common/patches/SoD.cpp index 151099a47..685595737 100644 --- a/common/patches/SoD.cpp +++ b/common/patches/SoD.cpp @@ -99,7 +99,10 @@ std::string Strategy::Describe() const { return(r); } - +const EQClientVersion Strategy::ClientVersion() const +{ + return EQClientSoD; +} #include "SSDefine.h" diff --git a/common/patches/SoD.h b/common/patches/SoD.h index ffcee7b25..7af599e4b 100644 --- a/common/patches/SoD.h +++ b/common/patches/SoD.h @@ -23,6 +23,7 @@ namespace SoD { protected: virtual std::string Describe() const; + virtual const EQClientVersion ClientVersion() const; //magic macro to declare our opcode processors #include "SSDeclare.h" diff --git a/common/patches/SoF.cpp b/common/patches/SoF.cpp index 67aea22e4..b2794d9af 100644 --- a/common/patches/SoF.cpp +++ b/common/patches/SoF.cpp @@ -99,7 +99,10 @@ std::string Strategy::Describe() const { return(r); } - +const EQClientVersion Strategy::ClientVersion() const +{ + return EQClientSoF; +} #include "SSDefine.h" diff --git a/common/patches/SoF.h b/common/patches/SoF.h index 6b1fff745..c3d7da4ce 100644 --- a/common/patches/SoF.h +++ b/common/patches/SoF.h @@ -23,6 +23,7 @@ namespace SoF { protected: virtual std::string Describe() const; + virtual const EQClientVersion ClientVersion() const; //magic macro to declare our opcode processors #include "SSDeclare.h" diff --git a/common/patches/Titanium.cpp b/common/patches/Titanium.cpp index b9db73cd1..469ba9b57 100644 --- a/common/patches/Titanium.cpp +++ b/common/patches/Titanium.cpp @@ -97,7 +97,10 @@ std::string Strategy::Describe() const { return(r); } - +const EQClientVersion Strategy::ClientVersion() const +{ + return EQClientTitanium; +} #include "SSDefine.h" diff --git a/common/patches/Titanium.h b/common/patches/Titanium.h index 185e55252..c2ed6136e 100644 --- a/common/patches/Titanium.h +++ b/common/patches/Titanium.h @@ -23,6 +23,7 @@ namespace Titanium { protected: virtual std::string Describe() const; + virtual const EQClientVersion ClientVersion() const; //magic macro to declare our opcode processors #include "SSDeclare.h" diff --git a/common/patches/Underfoot.cpp b/common/patches/Underfoot.cpp index ed4371f7e..656decd55 100644 --- a/common/patches/Underfoot.cpp +++ b/common/patches/Underfoot.cpp @@ -100,7 +100,10 @@ std::string Strategy::Describe() const { return(r); } - +const EQClientVersion Strategy::ClientVersion() const +{ + return EQClientUnderfoot; +} #include "SSDefine.h" diff --git a/common/patches/Underfoot.h b/common/patches/Underfoot.h index 52436385d..1f1c8312f 100644 --- a/common/patches/Underfoot.h +++ b/common/patches/Underfoot.h @@ -23,6 +23,7 @@ namespace Underfoot { protected: virtual std::string Describe() const; + virtual const EQClientVersion ClientVersion() const; //magic macro to declare our opcode processors #include "SSDeclare.h" diff --git a/common/patches/template.h b/common/patches/template.h index 3e379eefe..9e570cc56 100644 --- a/common/patches/template.h +++ b/common/patches/template.h @@ -23,7 +23,7 @@ namespace TEMPLATE { protected: virtual std::string Describe() const; - + virtual const EQClientVersion ClientVersion() const; //magic macro to declare our opcodes #include "SSDeclare.h" #include "TEMPLATE_ops.h" diff --git a/world/client.cpp b/world/client.cpp index fa83ecf98..e4a9c4e95 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -58,6 +58,7 @@ using namespace std; #include "wguild_mgr.h" #include "../common/rulesys.h" #include "SoFCharCreateData.h" +#include "../common/clientversions.h" std::vector character_create_allocations; std::vector character_create_race_class_combos; @@ -93,32 +94,7 @@ Client::Client(EQStreamInterface* ieqs) ClientVersionBit = 0; numclients++; - string StreamDescription = eqs->Describe(); - - if(StreamDescription == "Patch Titanium") - { - ClientVersionBit = BIT_Titanium; - } - else if(StreamDescription == "Patch 6.2") - { - ClientVersionBit = BIT_Client62; - } - else if(StreamDescription == "Patch SoF") - { - ClientVersionBit = BIT_SoF; - } - else if(StreamDescription == "Patch SoD") - { - ClientVersionBit = BIT_SoD; - } - else if(StreamDescription == "Patch Underfoot") - { - ClientVersionBit = BIT_Underfoot; - } - else if(StreamDescription == "Patch RoF") - { - ClientVersionBit = BIT_RoF; - } + ClientVersionBit = 1 << (eqs->ClientVersion() - 1); } Client::~Client() { diff --git a/zone/client.h b/zone/client.h index ab283140b..1cc8f4e42 100644 --- a/zone/client.h +++ b/zone/client.h @@ -47,6 +47,7 @@ class Client; #include #include #include "../common/item_struct.h" +#include "../common/clientversions.h" #include "QGlobals.h" #define CLIENT_TIMEOUT 90000 @@ -120,16 +121,6 @@ typedef enum { MQGhost } CheatTypes; -typedef enum { - EQClientUnknown = 0, - EQClient62, - EQClientTitanium, - EQClientSoF, - EQClientSoD, - EQClientUnderfoot, - EQClientRoF -} EQClientVersion; - enum { HideCorpseNone = 0, HideCorpseAll = 1, diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 7d9971900..72780eaf7 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -517,38 +517,10 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) conn_state = ReceivedZoneEntry; - string StreamDescription = Connection()->Describe(); - if(StreamDescription == "Patch Titanium") - { - ClientVersion = EQClientTitanium; - ClientVersionBit = BIT_Titanium; - } - else if(StreamDescription == "Patch 6.2") - { - ClientVersion = EQClient62; - ClientVersionBit = BIT_Client62; - } - else if(StreamDescription == "Patch SoF") - { - ClientVersion = EQClientSoF; - ClientVersionBit = BIT_SoF; - } - else if(StreamDescription == "Patch SoD") - { - ClientVersion = EQClientSoD; - ClientVersionBit = BIT_SoD; - } - else if(StreamDescription == "Patch Underfoot") - { - ClientVersion = EQClientUnderfoot; - ClientVersionBit = BIT_Underfoot; - } - else if(StreamDescription == "Patch RoF") - { - ClientVersion = EQClientRoF; - ClientVersionBit = BIT_RoF; - } + ClientVersion = Connection()->ClientVersion(); + ClientVersionBit = 1 << (ClientVersion - 1); + // Antighost code // tmp var is so the search doesnt find this object Client* client = entity_list.GetClientByName(cze->char_name); diff --git a/zone/zone.cpp b/zone/zone.cpp index e6f63bb6b..ce4b38623 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -689,7 +689,7 @@ void Zone::LoadMercTemplates(){ mysql_free_result(DatasetResult); } - safe_delete(Query); + safe_delete_array(Query); Query = 0; if(!errorMessage.empty()) { @@ -763,7 +763,7 @@ void Zone::LoadMercSpells(){ LogFile->write(EQEMuLog::Debug, "Mercenary Debug: Loaded %i merc spells.", merc_spells_list[1].size() + merc_spells_list[2].size() + merc_spells_list[9].size() + merc_spells_list[12].size()); } - safe_delete(Query); + safe_delete_array(Query); Query = 0; if(!errorMessage.empty()) { @@ -2648,4 +2648,4 @@ void Zone::ReloadWorld(uint32 Option){ zone->Repop(0); parse->ReloadQuests(); } -} \ No newline at end of file +}