From a0898204645c66aacfc4952b6eec4b5c8e31c8c4 Mon Sep 17 00:00:00 2001 From: Uleat Date: Sat, 28 May 2016 04:44:14 -0400 Subject: [PATCH] Merged client_version and inventory_version into emu_versions files --- changelog.txt | 3 + common/CMakeLists.txt | 6 +- common/client_version.cpp | 128 ------------------ common/emu_constants.h | 4 +- ...inventory_version.cpp => emu_versions.cpp} | 109 ++++++++++++++- common/{client_version.h => emu_versions.h} | 45 +++++- common/eq_limits.h | 2 +- common/eq_stream_intf.h | 2 +- common/inventory_version.h | 63 --------- common/patches/rof2_limits.h | 2 +- common/patches/rof_limits.h | 2 +- common/patches/sod_limits.h | 2 +- common/patches/sof_limits.h | 2 +- common/patches/titanium_limits.h | 2 +- common/patches/uf_limits.h | 2 +- common/struct_strategy.h | 2 +- world/client.cpp | 2 +- zone/npc.cpp | 2 +- 18 files changed, 164 insertions(+), 216 deletions(-) delete mode 100644 common/client_version.cpp rename common/{inventory_version.cpp => emu_versions.cpp} (59%) rename common/{client_version.h => emu_versions.h} (61%) delete mode 100644 common/inventory_version.h diff --git a/changelog.txt b/changelog.txt index b300d865d..d5ec9f62a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 05/28/2016 == +Uleat: Merged client_version and inventory_version into emu_versions files + == 05/27/2016 == Uleat: Renamed EQEmu::Item_Struct to EQEmu::ItemBase (and appropriate files) to coincide with new inventory naming conventions diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 71c78b177..fa9e6b342 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -3,7 +3,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) SET(common_sources base_packet.cpp classes.cpp - client_version.cpp condition.cpp crash.cpp crc16.cpp @@ -19,6 +18,7 @@ SET(common_sources emu_opcodes.cpp emu_tcp_connection.cpp emu_tcp_server.cpp + emu_versions.cpp eqdb.cpp eqdb_res.cpp eqemu_exception.cpp @@ -35,7 +35,6 @@ SET(common_sources faction.cpp guild_base.cpp guilds.cpp - inventory_version.cpp ipc_mutex.cpp item.cpp item_base.cpp @@ -112,7 +111,6 @@ SET(common_headers base_data.h bodytypes.h classes.h - client_version.h condition.h crash.h crc16.h @@ -128,6 +126,7 @@ SET(common_headers emu_oplist.h emu_tcp_connection.h emu_tcp_server.h + emu_versions.h eq_constants.h eq_packet_structs.h eqdb.h @@ -155,7 +154,6 @@ SET(common_headers global_define.h guild_base.h guilds.h - inventory_version.h ipc_mutex.h item.h item_base.h diff --git a/common/client_version.cpp b/common/client_version.cpp deleted file mode 100644 index b812e8744..000000000 --- a/common/client_version.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* EQEMu: Everquest Server Emulator - - Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY except by those people which sell it, which - are required to give you total support for your newly bought product; - without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "client_version.h" - - -bool EQEmu::versions::IsValidClientVersion(ClientVersion client_version) -{ - if (client_version <= ClientVersion::Unknown || client_version > LastClientVersion) - return false; - - return true; -} - -EQEmu::versions::ClientVersion EQEmu::versions::ValidateClientVersion(ClientVersion client_version) -{ - if (client_version <= ClientVersion::Unknown || client_version > LastClientVersion) - return ClientVersion::Unknown; - - return client_version; -} - -const char* EQEmu::versions::ClientVersionName(ClientVersion client_version) -{ - switch (client_version) { - case ClientVersion::Unknown: - return "Unknown Version"; - case ClientVersion::Client62: - return "Client 6.2"; - case ClientVersion::Titanium: - return "Titanium"; - case ClientVersion::SoF: - return "SoF"; - case ClientVersion::SoD: - return "SoD"; - case ClientVersion::UF: - return "UF"; - case ClientVersion::RoF: - return "RoF"; - case ClientVersion::RoF2: - return "RoF2"; - default: - return "Invalid Version"; - }; -} - -uint32 EQEmu::versions::ConvertClientVersionToClientVersionBit(ClientVersion client_version) -{ - switch (client_version) { - case ClientVersion::Unknown: - case ClientVersion::Client62: - return bit_Unknown; - case ClientVersion::Titanium: - return bit_Titanium; - case ClientVersion::SoF: - return bit_SoF; - case ClientVersion::SoD: - return bit_SoD; - case ClientVersion::UF: - return bit_UF; - case ClientVersion::RoF: - return bit_RoF; - case ClientVersion::RoF2: - return bit_RoF2; - default: - return bit_Unknown; - } -} - -EQEmu::versions::ClientVersion EQEmu::versions::ConvertClientVersionBitToClientVersion(uint32 client_version_bit) -{ - switch (client_version_bit) { - case (uint32)static_cast(ClientVersion::Unknown) : - case ((uint32)1 << (static_cast(ClientVersion::Client62) - 1)) : - return ClientVersion::Unknown; - case ((uint32)1 << (static_cast(ClientVersion::Titanium) - 1)) : - return ClientVersion::Titanium; - case ((uint32)1 << (static_cast(ClientVersion::SoF) - 1)) : - return ClientVersion::SoF; - case ((uint32)1 << (static_cast(ClientVersion::SoD) - 1)) : - return ClientVersion::SoD; - case ((uint32)1 << (static_cast(ClientVersion::UF) - 1)) : - return ClientVersion::UF; - case ((uint32)1 << (static_cast(ClientVersion::RoF) - 1)) : - return ClientVersion::RoF; - case ((uint32)1 << (static_cast(ClientVersion::RoF2) - 1)) : - return ClientVersion::RoF2; - default: - return ClientVersion::Unknown; - } -} - -uint32 EQEmu::versions::ConvertClientVersionToExpansion(ClientVersion client_version) -{ - switch (client_version) { - case ClientVersion::Unknown: - case ClientVersion::Client62: - case ClientVersion::Titanium: - return 0x000007FFU; - case ClientVersion::SoF: - return 0x00007FFFU; - case ClientVersion::SoD: - return 0x0000FFFFU; - case ClientVersion::UF: - return 0x0001FFFFU; - case ClientVersion::RoF: - case ClientVersion::RoF2: - return 0x000FFFFFU; - default: - return 0; - } -} diff --git a/common/emu_constants.h b/common/emu_constants.h index 5e279d21c..799161aa8 100644 --- a/common/emu_constants.h +++ b/common/emu_constants.h @@ -22,9 +22,7 @@ #include "eq_limits.h" #include "emu_legacy.h" -#include "inventory_version.h" -//#include "deity.h" -//#include "say_link.h" +#include "emu_versions.h" #include diff --git a/common/inventory_version.cpp b/common/emu_versions.cpp similarity index 59% rename from common/inventory_version.cpp rename to common/emu_versions.cpp index 13573eb68..1de91a503 100644 --- a/common/inventory_version.cpp +++ b/common/emu_versions.cpp @@ -17,9 +17,116 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "inventory_version.h" +#include "emu_versions.h" +bool EQEmu::versions::IsValidClientVersion(ClientVersion client_version) +{ + if (client_version <= ClientVersion::Unknown || client_version > LastClientVersion) + return false; + + return true; +} + +EQEmu::versions::ClientVersion EQEmu::versions::ValidateClientVersion(ClientVersion client_version) +{ + if (client_version <= ClientVersion::Unknown || client_version > LastClientVersion) + return ClientVersion::Unknown; + + return client_version; +} + +const char* EQEmu::versions::ClientVersionName(ClientVersion client_version) +{ + switch (client_version) { + case ClientVersion::Unknown: + return "Unknown Version"; + case ClientVersion::Client62: + return "Client 6.2"; + case ClientVersion::Titanium: + return "Titanium"; + case ClientVersion::SoF: + return "SoF"; + case ClientVersion::SoD: + return "SoD"; + case ClientVersion::UF: + return "UF"; + case ClientVersion::RoF: + return "RoF"; + case ClientVersion::RoF2: + return "RoF2"; + default: + return "Invalid Version"; + }; +} + +uint32 EQEmu::versions::ConvertClientVersionToClientVersionBit(ClientVersion client_version) +{ + switch (client_version) { + case ClientVersion::Unknown: + case ClientVersion::Client62: + return bit_Unknown; + case ClientVersion::Titanium: + return bit_Titanium; + case ClientVersion::SoF: + return bit_SoF; + case ClientVersion::SoD: + return bit_SoD; + case ClientVersion::UF: + return bit_UF; + case ClientVersion::RoF: + return bit_RoF; + case ClientVersion::RoF2: + return bit_RoF2; + default: + return bit_Unknown; + } +} + +EQEmu::versions::ClientVersion EQEmu::versions::ConvertClientVersionBitToClientVersion(uint32 client_version_bit) +{ + switch (client_version_bit) { + case (uint32)static_cast(ClientVersion::Unknown) : + case ((uint32)1 << (static_cast(ClientVersion::Client62) - 1)) : + return ClientVersion::Unknown; + case ((uint32)1 << (static_cast(ClientVersion::Titanium) - 1)) : + return ClientVersion::Titanium; + case ((uint32)1 << (static_cast(ClientVersion::SoF) - 1)) : + return ClientVersion::SoF; + case ((uint32)1 << (static_cast(ClientVersion::SoD) - 1)) : + return ClientVersion::SoD; + case ((uint32)1 << (static_cast(ClientVersion::UF) - 1)) : + return ClientVersion::UF; + case ((uint32)1 << (static_cast(ClientVersion::RoF) - 1)) : + return ClientVersion::RoF; + case ((uint32)1 << (static_cast(ClientVersion::RoF2) - 1)) : + return ClientVersion::RoF2; + default: + return ClientVersion::Unknown; + } +} + +uint32 EQEmu::versions::ConvertClientVersionToExpansion(ClientVersion client_version) +{ + switch (client_version) { + case ClientVersion::Unknown: + case ClientVersion::Client62: + case ClientVersion::Titanium: + return 0x000007FFU; + case ClientVersion::SoF: + return 0x00007FFFU; + case ClientVersion::SoD: + return 0x0000FFFFU; + case ClientVersion::UF: + return 0x0001FFFFU; + case ClientVersion::RoF: + case ClientVersion::RoF2: + return 0x000FFFFFU; + default: + return 0; + } +} + bool EQEmu::versions::IsValidInventoryVersion(InventoryVersion inventory_version) { if (inventory_version <= InventoryVersion::Unknown || inventory_version > LastInventoryVersion) diff --git a/common/client_version.h b/common/emu_versions.h similarity index 61% rename from common/client_version.h rename to common/emu_versions.h index a04e5c10b..45bb4ddb1 100644 --- a/common/client_version.h +++ b/common/emu_versions.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef COMMON_CLIENT_VERSION_H -#define COMMON_CLIENT_VERSION_H +#ifndef COMMON_EMU_VERSIONS_H +#define COMMON_EMU_VERSIONS_H #include "types.h" @@ -61,8 +61,8 @@ namespace EQEmu bit_AllClients = 0xFFFFFFFF }; - static const ClientVersion LastClientVersion = ClientVersion::RoF2; - static const size_t ClientVersionCount = (static_cast(LastClientVersion) + 1); + const ClientVersion LastClientVersion = ClientVersion::RoF2; + const size_t ClientVersionCount = (static_cast(LastClientVersion) + 1); extern bool IsValidClientVersion(ClientVersion client_version); extern ClientVersion ValidateClientVersion(ClientVersion client_version); @@ -70,9 +70,42 @@ namespace EQEmu extern uint32 ConvertClientVersionToClientVersionBit(ClientVersion client_version); extern ClientVersion ConvertClientVersionBitToClientVersion(uint32 client_version_bit); extern uint32 ConvertClientVersionToExpansion(ClientVersion client_version); - + + } /*versions*/ + + namespace versions { + enum class InventoryVersion { + Unknown = 0, + Client62, + Titanium, + SoF, + SoD, + UF, + RoF, + RoF2, + NPC, + Merc, + Bot, + Pet + }; + + const InventoryVersion LastInventoryVersion = InventoryVersion::Pet; + const InventoryVersion LastPCInventoryVersion = InventoryVersion::RoF2; + const InventoryVersion LastNonPCInventoryVersion = InventoryVersion::Pet; + const size_t InventoryVersionCount = (static_cast(LastInventoryVersion) + 1); + + extern bool IsValidInventoryVersion(InventoryVersion inventory_version); + extern bool IsValidPCInventoryVersion(InventoryVersion inventory_version); + extern bool IsValidNonPCInventoryVersion(InventoryVersion inventory_version); + extern InventoryVersion ValidateInventoryVersion(InventoryVersion inventory_version); + extern InventoryVersion ValidatePCInventoryVersion(InventoryVersion inventory_version); + extern InventoryVersion ValidateNonPCInventoryVersion(InventoryVersion inventory_version); + extern const char* InventoryVersionName(InventoryVersion inventory_version); + extern ClientVersion ConvertInventoryVersionToClientVersion(InventoryVersion inventory_version); + extern InventoryVersion ConvertClientVersionToInventoryVersion(ClientVersion client_version); + } /*versions*/ } /*EQEmu*/ -#endif /*COMMON_CLIENT_VERSION_H*/ +#endif /*COMMON_EMU_VERSIONS_H*/ diff --git a/common/eq_limits.h b/common/eq_limits.h index d6b03d070..a1168d348 100644 --- a/common/eq_limits.h +++ b/common/eq_limits.h @@ -22,7 +22,7 @@ #include "types.h" #include "eq_constants.h" -#include "inventory_version.h" +#include "emu_versions.h" #include "../common/patches/titanium_limits.h" #include "../common/patches/sof_limits.h" #include "../common/patches/sod_limits.h" diff --git a/common/eq_stream_intf.h b/common/eq_stream_intf.h index f357eb27b..917a13a86 100644 --- a/common/eq_stream_intf.h +++ b/common/eq_stream_intf.h @@ -4,7 +4,7 @@ //this is the only part of an EQStream that is seen by the application. #include -#include "client_version.h" // inv2 watch +#include "emu_versions.h" typedef enum { ESTABLISHED, diff --git a/common/inventory_version.h b/common/inventory_version.h deleted file mode 100644 index 61762e5bc..000000000 --- a/common/inventory_version.h +++ /dev/null @@ -1,63 +0,0 @@ -/* EQEMu: Everquest Server Emulator - - Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY except by those people which sell it, which - are required to give you total support for your newly bought product; - without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef COMMON_INVENTORY_VERSION_H -#define COMMON_INVENTORY_VERSION_H - -#include "client_version.h" - - -namespace EQEmu -{ - namespace versions { - enum class InventoryVersion { - Unknown = 0, - Client62, - Titanium, - SoF, - SoD, - UF, - RoF, - RoF2, - NPC, - Merc, - Bot, - Pet - }; - - static const InventoryVersion LastInventoryVersion = InventoryVersion::Pet; - static const InventoryVersion LastPCInventoryVersion = InventoryVersion::RoF2; - static const InventoryVersion LastNonPCInventoryVersion = InventoryVersion::Pet; - static const size_t InventoryVersionCount = (static_cast(LastInventoryVersion) + 1); - - extern bool IsValidInventoryVersion(InventoryVersion inventory_version); - extern bool IsValidPCInventoryVersion(InventoryVersion inventory_version); - extern bool IsValidNonPCInventoryVersion(InventoryVersion inventory_version); - extern InventoryVersion ValidateInventoryVersion(InventoryVersion inventory_version); - extern InventoryVersion ValidatePCInventoryVersion(InventoryVersion inventory_version); - extern InventoryVersion ValidateNonPCInventoryVersion(InventoryVersion inventory_version); - extern const char* InventoryVersionName(InventoryVersion inventory_version); - extern ClientVersion ConvertInventoryVersionToClientVersion(InventoryVersion inventory_version); - extern InventoryVersion ConvertClientVersionToInventoryVersion(ClientVersion client_version); - - } /*versions*/ - -} /*EQEmu*/ - -#endif /*COMMON_INVENTORY_VERSION_H*/ diff --git a/common/patches/rof2_limits.h b/common/patches/rof2_limits.h index b38e88d7a..79218f67f 100644 --- a/common/patches/rof2_limits.h +++ b/common/patches/rof2_limits.h @@ -21,7 +21,7 @@ #define COMMON_ROF2_LIMITS_H #include "../types.h" -#include "../client_version.h" +#include "../emu_versions.h" #include "../skills.h" diff --git a/common/patches/rof_limits.h b/common/patches/rof_limits.h index 14f9e32a1..5275bfaad 100644 --- a/common/patches/rof_limits.h +++ b/common/patches/rof_limits.h @@ -21,7 +21,7 @@ #define COMMON_ROF_LIMITS_H #include "../types.h" -#include "../client_version.h" +#include "../emu_versions.h" #include "../skills.h" diff --git a/common/patches/sod_limits.h b/common/patches/sod_limits.h index 8bdac4150..e50790793 100644 --- a/common/patches/sod_limits.h +++ b/common/patches/sod_limits.h @@ -21,7 +21,7 @@ #define COMMON_SOD_LIMITS_H #include "../types.h" -#include "../client_version.h" +#include "../emu_versions.h" #include "../skills.h" diff --git a/common/patches/sof_limits.h b/common/patches/sof_limits.h index bd755c820..5243b289b 100644 --- a/common/patches/sof_limits.h +++ b/common/patches/sof_limits.h @@ -21,7 +21,7 @@ #define COMMON_SOF_LIMITS_H #include "../types.h" -#include "../client_version.h" +#include "../emu_versions.h" #include "../skills.h" diff --git a/common/patches/titanium_limits.h b/common/patches/titanium_limits.h index a4ce67faf..0d4620997 100644 --- a/common/patches/titanium_limits.h +++ b/common/patches/titanium_limits.h @@ -21,7 +21,7 @@ #define COMMON_TITANIUM_LIMITS_H #include "../types.h" -#include "../client_version.h" +#include "../emu_versions.h" #include "../skills.h" diff --git a/common/patches/uf_limits.h b/common/patches/uf_limits.h index fb2370a4c..7f1ec33a8 100644 --- a/common/patches/uf_limits.h +++ b/common/patches/uf_limits.h @@ -21,7 +21,7 @@ #define COMMON_UF_LIMITS_H #include "../types.h" -#include "../client_version.h" +#include "../emu_versions.h" #include "../skills.h" diff --git a/common/struct_strategy.h b/common/struct_strategy.h index b7417de8c..fdb596891 100644 --- a/common/struct_strategy.h +++ b/common/struct_strategy.h @@ -4,7 +4,7 @@ class EQApplicationPacket; class EQStream; #include "emu_opcodes.h" -#include "client_version.h" // inv2 watch +#include "emu_versions.h" #include #include diff --git a/world/client.cpp b/world/client.cpp index 057db0961..fdccc8f7d 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -32,7 +32,7 @@ #include "../common/skills.h" #include "../common/extprofile.h" #include "../common/string_util.h" -#include "../common/client_version.h" // inv2 watch +#include "../common/emu_versions.h" #include "../common/random.h" #include "../common/shareddb.h" diff --git a/zone/npc.cpp b/zone/npc.cpp index 1df16ca12..d38ad92b3 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -24,7 +24,7 @@ #include "../common/seperator.h" #include "../common/spdat.h" #include "../common/string_util.h" -#include "../common/client_version.h" // inv2 watch +#include "../common/emu_versions.h" #include "../common/features.h" #include "../common/item.h" #include "../common/item_base.h"