From 7aa84d5276278b076e42d39e83c26e55ab7f1eb3 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Mon, 29 Jun 2015 17:17:23 +0100 Subject: [PATCH] Define class static ints that are used in tests. GCC doesn't like static const ints that don't have a separate definition. --- src/backend/game/game_settings.cpp | 6 ++++++ src/backend/game/game_settings.h | 10 +++++----- src/backend/helpers/language.cpp | 13 +++++++++++++ src/backend/helpers/language.h | 24 ++++++++++++------------ src/backend/metadata/message.cpp | 4 ++++ src/backend/metadata/message.h | 6 +++--- 6 files changed, 43 insertions(+), 20 deletions(-) diff --git a/src/backend/game/game_settings.cpp b/src/backend/game/game_settings.cpp index 6fafd903..cf9a70b0 100644 --- a/src/backend/game/game_settings.cpp +++ b/src/backend/game/game_settings.cpp @@ -37,6 +37,12 @@ namespace fs = boost::filesystem; namespace lc = boost::locale; namespace loot { + const unsigned int GameSettings::autodetect = 0; + const unsigned int GameSettings::tes4 = 1; + const unsigned int GameSettings::tes5 = 2; + const unsigned int GameSettings::fo3 = 3; + const unsigned int GameSettings::fonv = 4; + GameSettings::GameSettings() : _id(GameSettings::autodetect) {} GameSettings::GameSettings(const unsigned int gameCode, const std::string& folder) : _id(gameCode) { diff --git a/src/backend/game/game_settings.h b/src/backend/game/game_settings.h index 06a13481..a6ae4359 100644 --- a/src/backend/game/game_settings.h +++ b/src/backend/game/game_settings.h @@ -61,11 +61,11 @@ namespace loot { boost::filesystem::path MasterlistPath() const; boost::filesystem::path UserlistPath() const; - static const unsigned int autodetect = 0; - static const unsigned int tes4 = 1; - static const unsigned int tes5 = 2; - static const unsigned int fo3 = 3; - static const unsigned int fonv = 4; + static const unsigned int autodetect; + static const unsigned int tes4; + static const unsigned int tes5; + static const unsigned int fo3; + static const unsigned int fonv; protected: //Creates directory in LOOT folder for LOOT's game-specific files. void CreateLOOTGameFolder(); diff --git a/src/backend/helpers/language.cpp b/src/backend/helpers/language.cpp index d0a61864..937e65e2 100644 --- a/src/backend/helpers/language.cpp +++ b/src/backend/helpers/language.cpp @@ -25,6 +25,19 @@ #include "language.h" namespace loot { + const unsigned int Language::any = 0; + const unsigned int Language::english = 1; + const unsigned int Language::spanish = 2; + const unsigned int Language::russian = 3; + const unsigned int Language::french = 4; + const unsigned int Language::chinese = 5; + const unsigned int Language::polish = 6; + const unsigned int Language::brazilian_portuguese = 7; + const unsigned int Language::finnish = 8; + const unsigned int Language::german = 9; + const unsigned int Language::danish = 10; + const unsigned int Language::korean = 11; + Language::Language(const unsigned int code) { Construct(code); } diff --git a/src/backend/helpers/language.h b/src/backend/helpers/language.h index 703be6c2..72fe8820 100644 --- a/src/backend/helpers/language.h +++ b/src/backend/helpers/language.h @@ -39,18 +39,18 @@ namespace loot { std::string Name() const; std::string Locale() const; - static const unsigned int any = 0; // This shouldn't be used as a selectable language, just for when picking any string in a message. - static const unsigned int english = 1; - static const unsigned int spanish = 2; - static const unsigned int russian = 3; - static const unsigned int french = 4; - static const unsigned int chinese = 5; - static const unsigned int polish = 6; - static const unsigned int brazilian_portuguese = 7; - static const unsigned int finnish = 8; - static const unsigned int german = 9; - static const unsigned int danish = 10; - static const unsigned int korean = 11; + static const unsigned int any; // This shouldn't be used as a selectable language, just for when picking any string in a message. + static const unsigned int english; + static const unsigned int spanish; + static const unsigned int russian; + static const unsigned int french; + static const unsigned int chinese; + static const unsigned int polish; + static const unsigned int brazilian_portuguese; + static const unsigned int finnish; + static const unsigned int german; + static const unsigned int danish; + static const unsigned int korean; static const std::vector Codes; private: diff --git a/src/backend/metadata/message.cpp b/src/backend/metadata/message.cpp index 071a7e65..bab52011 100644 --- a/src/backend/metadata/message.cpp +++ b/src/backend/metadata/message.cpp @@ -30,6 +30,10 @@ using namespace std; namespace loot { + const unsigned int Message::say = 0; + const unsigned int Message::warn = 1; + const unsigned int Message::error = 2; + Message::Message() : _type(Message::say) {} Message::Message(const unsigned int type, const std::string& content, diff --git a/src/backend/metadata/message.h b/src/backend/metadata/message.h index 18e1cd35..a080dc6f 100644 --- a/src/backend/metadata/message.h +++ b/src/backend/metadata/message.h @@ -56,9 +56,9 @@ namespace loot { std::vector Content() const; MessageContent ChooseContent(const unsigned int language) const; - static const unsigned int say = 0; - static const unsigned int warn = 1; - static const unsigned int error = 2; + static const unsigned int say; + static const unsigned int warn; + static const unsigned int error; private: unsigned int _type; std::vector _content;