From 7789ad382dabee56c155eadf26722fe1b3fa23b4 Mon Sep 17 00:00:00 2001 From: Maru Date: Sat, 18 Nov 2017 00:45:08 -0200 Subject: [PATCH] Include int type alias for uint8_t; --- src/servers/Server_Common/CommonGen.cpp | 2 + src/servers/Server_Common/CommonGen.h | 36 ++----------- src/tools/exd_common_gen/generated.h | 68 ++++++++++--------------- src/tools/exd_common_gen/main.cpp | 11 ++-- 4 files changed, 39 insertions(+), 78 deletions(-) diff --git a/src/servers/Server_Common/CommonGen.cpp b/src/servers/Server_Common/CommonGen.cpp index ecbfa96c..7ea09791 100644 --- a/src/servers/Server_Common/CommonGen.cpp +++ b/src/servers/Server_Common/CommonGen.cpp @@ -1,5 +1,7 @@ #include "CommonGen.h" +#include + namespace Core { namespace Common { diff --git a/src/servers/Server_Common/CommonGen.h b/src/servers/Server_Common/CommonGen.h index 45954f7b..4c1d3102 100644 --- a/src/servers/Server_Common/CommonGen.h +++ b/src/servers/Server_Common/CommonGen.h @@ -1,5 +1,8 @@ #ifndef _COMMON_GEN_H_ #define _COMMON_GEN_H_ + +#include + /* This file has been automatically generated. Changes will be lost upon regeneration. To change the content edit tools/exd_common_gen */ @@ -26,8 +29,6 @@ namespace Common { ItemManipulation = 14, AdrenalineRush = 15, - }; - /////////////////////////////////////////////////////////// //BeastReputationRank.exd enum class BeastReputationRank : uint8_t @@ -42,15 +43,11 @@ namespace Common { Sworn = 7, Allied = 8, - }; - /////////////////////////////////////////////////////////// //BeastTribe.exd enum class BeastTribe : uint8_t { - }; - /////////////////////////////////////////////////////////// //ClassJob.exd enum class ClassJob : uint8_t @@ -92,8 +89,6 @@ namespace Common { Samurai = 34, Redmage = 35, - }; - /////////////////////////////////////////////////////////// //ContentType.exd enum class ContentType : uint8_t @@ -121,8 +116,6 @@ namespace Common { WondrousTails = 24, CustomDeliveries = 25, - }; - /////////////////////////////////////////////////////////// //EmoteCategory.exd enum class EmoteCategory : uint8_t @@ -131,8 +124,6 @@ namespace Common { Persistent = 2, Expressions = 3, - }; - /////////////////////////////////////////////////////////// //ExVersion.exd enum class ExVersion : uint8_t @@ -141,8 +132,6 @@ namespace Common { Heavensward = 1, Stormblood = 2, - }; - /////////////////////////////////////////////////////////// //GrandCompany.exd enum class GrandCompany : uint8_t @@ -152,8 +141,6 @@ namespace Common { OrderoftheTwinAdder = 2, ImmortalFlames = 3, - }; - /////////////////////////////////////////////////////////// //GuardianDeity.exd enum class GuardianDeity : uint8_t @@ -171,8 +158,6 @@ namespace Common { NophicatheMatron = 11, AlthyktheKeeper = 12, - }; - /////////////////////////////////////////////////////////// //ItemUICategory.exd enum class ItemUICategory : uint8_t @@ -278,8 +263,6 @@ namespace Common { FishersSecondaryTool = 99, Currency = 100, - }; - /////////////////////////////////////////////////////////// //ItemSearchCategory.exd enum class ItemSearchCategory : uint8_t @@ -370,8 +353,6 @@ namespace Common { RedMagesArms = 84, ScholarsArms = 85, - }; - /////////////////////////////////////////////////////////// //OnlineStatus.exd enum class OnlineStatus : uint8_t @@ -424,8 +405,6 @@ namespace Common { GrandCompany = 46, Online = 47, - }; - /////////////////////////////////////////////////////////// //Race.exd enum class Race : uint8_t @@ -437,8 +416,6 @@ namespace Common { Roegadyn = 5, AuRa = 6, - }; - /////////////////////////////////////////////////////////// //Tribe.exd enum class Tribe : uint8_t @@ -456,8 +433,6 @@ namespace Common { Raen = 11, Xaela = 12, - }; - /////////////////////////////////////////////////////////// //Town.exd enum class Town : uint8_t @@ -469,8 +444,6 @@ namespace Common { Ishgard = 4, Kugane = 7, - }; - /////////////////////////////////////////////////////////// //Weather.exd enum class Weather : uint8_t @@ -565,9 +538,6 @@ namespace Common { Thunder3 = 88, DimensionalDisruption3 = 89, FairSkies9 = 90, - - }; - } } #endif diff --git a/src/tools/exd_common_gen/generated.h b/src/tools/exd_common_gen/generated.h index 28b10c3b..4c1d3102 100644 --- a/src/tools/exd_common_gen/generated.h +++ b/src/tools/exd_common_gen/generated.h @@ -1,5 +1,9 @@ -[14:21:11][info] Setting up EXD data -[14:21:12][info] /* This file has been automatically generated. +#ifndef _COMMON_GEN_H_ +#define _COMMON_GEN_H_ + +#include + +/* This file has been automatically generated. Changes will be lost upon regeneration. To change the content edit tools/exd_common_gen */ namespace Core { @@ -7,7 +11,7 @@ namespace Common { /////////////////////////////////////////////////////////// //ActionCategory.exd - enum ActionCategory : uint8_t + enum class ActionCategory : uint8_t { Autoattack = 1, Spell = 2, @@ -24,11 +28,10 @@ namespace Common { Glamour = 13, ItemManipulation = 14, AdrenalineRush = 15, - }; /////////////////////////////////////////////////////////// //BeastReputationRank.exd - enum BeastReputationRank : uint8_t + enum class BeastReputationRank : uint8_t { None = 0, Neutral = 1, @@ -39,25 +42,15 @@ namespace Common { Honored = 6, Sworn = 7, Allied = 8, - }; /////////////////////////////////////////////////////////// //BeastTribe.exd - enum BeastTribe : uint8_t + enum class BeastTribe : uint8_t { - Amaljaa = 1, - Sylphs = 2, - Kobolds = 3, - Sahagin = 4, - Ixal = 5, - VanuVanu = 6, - Vath = 7, - Moogles = 8, - }; /////////////////////////////////////////////////////////// //ClassJob.exd - enum ClassJob : uint8_t + enum class ClassJob : uint8_t { Adventurer = 0, Gladiator = 1, @@ -95,11 +88,10 @@ namespace Common { Astrologian = 33, Samurai = 34, Redmage = 35, - }; /////////////////////////////////////////////////////////// //ContentType.exd - enum ContentType : uint8_t + enum class ContentType : uint8_t { DutyRoulette = 1, Dungeons = 2, @@ -122,39 +114,36 @@ namespace Common { GoldSaucer = 19, DeepDungeons = 21, WondrousTails = 24, - }; + CustomDeliveries = 25, /////////////////////////////////////////////////////////// //EmoteCategory.exd - enum EmoteCategory : uint8_t + enum class EmoteCategory : uint8_t { General = 1, Persistent = 2, Expressions = 3, - }; /////////////////////////////////////////////////////////// //ExVersion.exd - enum ExVersion : uint8_t + enum class ExVersion : uint8_t { ARealmReborn = 0, Heavensward = 1, Stormblood = 2, - }; /////////////////////////////////////////////////////////// //GrandCompany.exd - enum GrandCompany : uint8_t + enum class GrandCompany : uint8_t { None = 0, Maelstrom = 1, OrderoftheTwinAdder = 2, ImmortalFlames = 3, - }; /////////////////////////////////////////////////////////// //GuardianDeity.exd - enum GuardianDeity : uint8_t + enum class GuardianDeity : uint8_t { HalonetheFury = 1, MenphinatheLover = 2, @@ -168,11 +157,10 @@ namespace Common { NaldthaltheTraders = 10, NophicatheMatron = 11, AlthyktheKeeper = 12, - }; /////////////////////////////////////////////////////////// //ItemUICategory.exd - enum ItemUICategory : uint8_t + enum class ItemUICategory : uint8_t { PugilistsArm = 1, GladiatorsArm = 2, @@ -273,11 +261,11 @@ namespace Common { RedMagesArm = 97, ScholarsArm = 98, FishersSecondaryTool = 99, - }; + Currency = 100, /////////////////////////////////////////////////////////// //ItemSearchCategory.exd - enum ItemSearchCategory : uint8_t + enum class ItemSearchCategory : uint8_t { PrimaryArms = 1, PrimaryTools = 2, @@ -364,11 +352,10 @@ namespace Common { SamuraisArms = 83, RedMagesArms = 84, ScholarsArms = 85, - }; /////////////////////////////////////////////////////////// //OnlineStatus.exd - enum OnlineStatus : uint8_t + enum class OnlineStatus : uint8_t { Producer = 1, GameMaster = 2, @@ -417,11 +404,10 @@ namespace Common { FreeCompany = 45, GrandCompany = 46, Online = 47, - }; /////////////////////////////////////////////////////////// //Race.exd - enum Race : uint8_t + enum class Race : uint8_t { Hyur = 1, Elezen = 2, @@ -429,11 +415,10 @@ namespace Common { Miqote = 4, Roegadyn = 5, AuRa = 6, - }; /////////////////////////////////////////////////////////// //Tribe.exd - enum Tribe : uint8_t + enum class Tribe : uint8_t { Midlander = 1, Highlander = 2, @@ -447,11 +432,10 @@ namespace Common { Hellsguard = 10, Raen = 11, Xaela = 12, - }; /////////////////////////////////////////////////////////// //Town.exd - enum Town : uint8_t + enum class Town : uint8_t { Nowheresville = 0, LimsaLominsa = 1, @@ -459,11 +443,10 @@ namespace Common { Uldah = 3, Ishgard = 4, Kugane = 7, - }; /////////////////////////////////////////////////////////// //Weather.exd - enum Weather : uint8_t + enum class Weather : uint8_t { ClearSkies = 1, FairSkies = 2, @@ -554,7 +537,8 @@ namespace Common { Quicklevin = 87, Thunder3 = 88, DimensionalDisruption3 = 89, - }; + FairSkies9 = 90, } } +#endif diff --git a/src/tools/exd_common_gen/main.cpp b/src/tools/exd_common_gen/main.cpp index 2e39d758..260618cf 100644 --- a/src/tools/exd_common_gen/main.cpp +++ b/src/tools/exd_common_gen/main.cpp @@ -21,7 +21,7 @@ Core::Data::ExdData g_exdData; //const std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" ); -const std::string datLocation( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack\\ffxiv" ); +const std::string datLocation( "C:\\Data\\Games\\Final Fantasy XIV\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack\\ffxiv" ); std::string generateEnum( const std::string& exd, int8_t nameIndex, const std::string& type, bool useLang = true ) { @@ -46,7 +46,7 @@ std::string generateEnum( const std::string& exd, int8_t nameIndex, const std::s auto test = boost::get< std::string >( &fields.at( nameIndex ) ); if( !test ) continue; - auto str = *test ; + auto str = *test; str.erase( boost::remove_if( str, boost::is_any_of(",_-':!(){} \x02\x1f\x01\x03") ), str.end() ); if( str.empty() ) continue; @@ -66,11 +66,14 @@ std::string generateEnum( const std::string& exd, int8_t nameIndex, const std::s result += " " + str + " = " + std::to_string( id ) + ",\n"; } + + /* result += " bool operator==( const " + exd + "& t, const " + type + "& g ) { return static_cast< " + type + " >( t ) == g; }\n" " bool operator==( const " + type + "& g, const " + exd + "& t ) { return static_cast< " + type + " >( t ) == g; }\n"; result += " };\n"; + */ return result; } @@ -85,11 +88,13 @@ int main() if( !g_exdData.init( datLocation ) ) { g_log.fatal( "Error setting up EXD data " ); - return 0; + return 1; } std::string result = "#ifndef _COMMON_GEN_H_\n#define _COMMON_GEN_H_\n"; + result += "\n#include \n\n"; + result += "/* This file has been automatically generated.\n Changes will be lost upon regeneration.\n To change the content edit tools/exd_common_gen */\n";