Merged client_version and inventory_version into emu_versions files

This commit is contained in:
Uleat 2016-05-28 04:44:14 -04:00
parent 579efe83af
commit a089820464
18 changed files with 164 additions and 216 deletions

View File

@ -1,5 +1,8 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50) 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 == == 05/27/2016 ==
Uleat: Renamed EQEmu::Item_Struct to EQEmu::ItemBase (and appropriate files) to coincide with new inventory naming conventions Uleat: Renamed EQEmu::Item_Struct to EQEmu::ItemBase (and appropriate files) to coincide with new inventory naming conventions

View File

@ -3,7 +3,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
SET(common_sources SET(common_sources
base_packet.cpp base_packet.cpp
classes.cpp classes.cpp
client_version.cpp
condition.cpp condition.cpp
crash.cpp crash.cpp
crc16.cpp crc16.cpp
@ -19,6 +18,7 @@ SET(common_sources
emu_opcodes.cpp emu_opcodes.cpp
emu_tcp_connection.cpp emu_tcp_connection.cpp
emu_tcp_server.cpp emu_tcp_server.cpp
emu_versions.cpp
eqdb.cpp eqdb.cpp
eqdb_res.cpp eqdb_res.cpp
eqemu_exception.cpp eqemu_exception.cpp
@ -35,7 +35,6 @@ SET(common_sources
faction.cpp faction.cpp
guild_base.cpp guild_base.cpp
guilds.cpp guilds.cpp
inventory_version.cpp
ipc_mutex.cpp ipc_mutex.cpp
item.cpp item.cpp
item_base.cpp item_base.cpp
@ -112,7 +111,6 @@ SET(common_headers
base_data.h base_data.h
bodytypes.h bodytypes.h
classes.h classes.h
client_version.h
condition.h condition.h
crash.h crash.h
crc16.h crc16.h
@ -128,6 +126,7 @@ SET(common_headers
emu_oplist.h emu_oplist.h
emu_tcp_connection.h emu_tcp_connection.h
emu_tcp_server.h emu_tcp_server.h
emu_versions.h
eq_constants.h eq_constants.h
eq_packet_structs.h eq_packet_structs.h
eqdb.h eqdb.h
@ -155,7 +154,6 @@ SET(common_headers
global_define.h global_define.h
guild_base.h guild_base.h
guilds.h guilds.h
inventory_version.h
ipc_mutex.h ipc_mutex.h
item.h item.h
item_base.h item_base.h

View File

@ -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<unsigned int>(ClientVersion::Unknown) :
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::Client62) - 1)) :
return ClientVersion::Unknown;
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::Titanium) - 1)) :
return ClientVersion::Titanium;
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::SoF) - 1)) :
return ClientVersion::SoF;
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::SoD) - 1)) :
return ClientVersion::SoD;
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::UF) - 1)) :
return ClientVersion::UF;
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::RoF) - 1)) :
return ClientVersion::RoF;
case ((uint32)1 << (static_cast<unsigned int>(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;
}
}

View File

@ -22,9 +22,7 @@
#include "eq_limits.h" #include "eq_limits.h"
#include "emu_legacy.h" #include "emu_legacy.h"
#include "inventory_version.h" #include "emu_versions.h"
//#include "deity.h"
//#include "say_link.h"
#include <string> #include <string>

View File

@ -17,9 +17,116 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 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<unsigned int>(ClientVersion::Unknown) :
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::Client62) - 1)) :
return ClientVersion::Unknown;
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::Titanium) - 1)) :
return ClientVersion::Titanium;
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::SoF) - 1)) :
return ClientVersion::SoF;
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::SoD) - 1)) :
return ClientVersion::SoD;
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::UF) - 1)) :
return ClientVersion::UF;
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::RoF) - 1)) :
return ClientVersion::RoF;
case ((uint32)1 << (static_cast<unsigned int>(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) bool EQEmu::versions::IsValidInventoryVersion(InventoryVersion inventory_version)
{ {
if (inventory_version <= InventoryVersion::Unknown || inventory_version > LastInventoryVersion) if (inventory_version <= InventoryVersion::Unknown || inventory_version > LastInventoryVersion)

View File

@ -17,8 +17,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef COMMON_CLIENT_VERSION_H #ifndef COMMON_EMU_VERSIONS_H
#define COMMON_CLIENT_VERSION_H #define COMMON_EMU_VERSIONS_H
#include "types.h" #include "types.h"
@ -61,8 +61,8 @@ namespace EQEmu
bit_AllClients = 0xFFFFFFFF bit_AllClients = 0xFFFFFFFF
}; };
static const ClientVersion LastClientVersion = ClientVersion::RoF2; const ClientVersion LastClientVersion = ClientVersion::RoF2;
static const size_t ClientVersionCount = (static_cast<size_t>(LastClientVersion) + 1); const size_t ClientVersionCount = (static_cast<size_t>(LastClientVersion) + 1);
extern bool IsValidClientVersion(ClientVersion client_version); extern bool IsValidClientVersion(ClientVersion client_version);
extern ClientVersion ValidateClientVersion(ClientVersion client_version); extern ClientVersion ValidateClientVersion(ClientVersion client_version);
@ -73,6 +73,39 @@ namespace EQEmu
} /*versions*/ } /*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<size_t>(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*/ } /*EQEmu*/
#endif /*COMMON_CLIENT_VERSION_H*/ #endif /*COMMON_EMU_VERSIONS_H*/

View File

@ -22,7 +22,7 @@
#include "types.h" #include "types.h"
#include "eq_constants.h" #include "eq_constants.h"
#include "inventory_version.h" #include "emu_versions.h"
#include "../common/patches/titanium_limits.h" #include "../common/patches/titanium_limits.h"
#include "../common/patches/sof_limits.h" #include "../common/patches/sof_limits.h"
#include "../common/patches/sod_limits.h" #include "../common/patches/sod_limits.h"

View File

@ -4,7 +4,7 @@
//this is the only part of an EQStream that is seen by the application. //this is the only part of an EQStream that is seen by the application.
#include <string> #include <string>
#include "client_version.h" // inv2 watch #include "emu_versions.h"
typedef enum { typedef enum {
ESTABLISHED, ESTABLISHED,

View File

@ -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<size_t>(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*/

View File

@ -21,7 +21,7 @@
#define COMMON_ROF2_LIMITS_H #define COMMON_ROF2_LIMITS_H
#include "../types.h" #include "../types.h"
#include "../client_version.h" #include "../emu_versions.h"
#include "../skills.h" #include "../skills.h"

View File

@ -21,7 +21,7 @@
#define COMMON_ROF_LIMITS_H #define COMMON_ROF_LIMITS_H
#include "../types.h" #include "../types.h"
#include "../client_version.h" #include "../emu_versions.h"
#include "../skills.h" #include "../skills.h"

View File

@ -21,7 +21,7 @@
#define COMMON_SOD_LIMITS_H #define COMMON_SOD_LIMITS_H
#include "../types.h" #include "../types.h"
#include "../client_version.h" #include "../emu_versions.h"
#include "../skills.h" #include "../skills.h"

View File

@ -21,7 +21,7 @@
#define COMMON_SOF_LIMITS_H #define COMMON_SOF_LIMITS_H
#include "../types.h" #include "../types.h"
#include "../client_version.h" #include "../emu_versions.h"
#include "../skills.h" #include "../skills.h"

View File

@ -21,7 +21,7 @@
#define COMMON_TITANIUM_LIMITS_H #define COMMON_TITANIUM_LIMITS_H
#include "../types.h" #include "../types.h"
#include "../client_version.h" #include "../emu_versions.h"
#include "../skills.h" #include "../skills.h"

View File

@ -21,7 +21,7 @@
#define COMMON_UF_LIMITS_H #define COMMON_UF_LIMITS_H
#include "../types.h" #include "../types.h"
#include "../client_version.h" #include "../emu_versions.h"
#include "../skills.h" #include "../skills.h"

View File

@ -4,7 +4,7 @@
class EQApplicationPacket; class EQApplicationPacket;
class EQStream; class EQStream;
#include "emu_opcodes.h" #include "emu_opcodes.h"
#include "client_version.h" // inv2 watch #include "emu_versions.h"
#include <string> #include <string>
#include <memory> #include <memory>

View File

@ -32,7 +32,7 @@
#include "../common/skills.h" #include "../common/skills.h"
#include "../common/extprofile.h" #include "../common/extprofile.h"
#include "../common/string_util.h" #include "../common/string_util.h"
#include "../common/client_version.h" // inv2 watch #include "../common/emu_versions.h"
#include "../common/random.h" #include "../common/random.h"
#include "../common/shareddb.h" #include "../common/shareddb.h"

View File

@ -24,7 +24,7 @@
#include "../common/seperator.h" #include "../common/seperator.h"
#include "../common/spdat.h" #include "../common/spdat.h"
#include "../common/string_util.h" #include "../common/string_util.h"
#include "../common/client_version.h" // inv2 watch #include "../common/emu_versions.h"
#include "../common/features.h" #include "../common/features.h"
#include "../common/item.h" #include "../common/item.h"
#include "../common/item_base.h" #include "../common/item_base.h"