From 2b96eda86d40724886c66b81b38a920ff83b5372 Mon Sep 17 00:00:00 2001 From: MrSimbax Date: Wed, 22 Jul 2020 17:13:52 +0200 Subject: [PATCH] Fix minor issues --- src/app/moddata.cpp | 12 ++++++------ src/app/moddata.h | 2 +- src/app/modman.h | 2 +- src/ui/screen/screen_mod_list.cpp | 4 +++- src/ui/screen/screen_mod_list.h | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/app/moddata.cpp b/src/app/moddata.cpp index 3ff716d7..c2653023 100644 --- a/src/app/moddata.cpp +++ b/src/app/moddata.cpp @@ -31,16 +31,16 @@ namespace pt = boost::property_tree; -boost::optional LoadManifest(const std::string& path, bool loaded = false); +boost::optional LoadManifest(const std::string& path); std::string GetStringProperty(const pt::ptree& manifest, const std::string& key); std::unordered_map GetLanguageStringProperty(const pt::ptree& manifest, const std::string& key); -ModData LoadModData(const std::string& path, bool loaded) +ModData LoadModData(const std::string& path) { ModData modData{}; auto manifestOptional = LoadManifest(path); - if (!manifestOptional.has_value()) + if (!manifestOptional) { return modData; } @@ -55,7 +55,7 @@ ModData LoadModData(const std::string& path, bool loaded) return modData; } -boost::optional LoadManifest(const std::string& path, bool loaded) +boost::optional LoadManifest(const std::string& path) { try { @@ -82,7 +82,7 @@ boost::optional LoadManifest(const std::string& path, bool loaded) std::string GetStringProperty(const pt::ptree& manifest, const std::string& key) { auto prop = manifest.get_optional(key); - if (prop.has_value()) + if (prop) { return prop.get(); } @@ -93,7 +93,7 @@ std::unordered_map GetLanguageStringProperty(const pt::pt { std::unordered_map ret; auto prop = manifest.get_child_optional(key); - if (prop.has_value()) + if (prop) { for (const auto& child : prop.get()) { diff --git a/src/app/moddata.h b/src/app/moddata.h index 90f3887c..551b701a 100644 --- a/src/app/moddata.h +++ b/src/app/moddata.h @@ -33,4 +33,4 @@ struct ModData }; //! Loads the metadata for a mod in the given path. -ModData LoadModData(const std::string& path, bool loaded = false); +ModData LoadModData(const std::string& path); diff --git a/src/app/modman.h b/src/app/modman.h index a937ec20..bd66117e 100644 --- a/src/app/modman.h +++ b/src/app/modman.h @@ -22,7 +22,7 @@ #include "app/moddata.h" #include -#include +#include class CApplication; class CPathManager; diff --git a/src/ui/screen/screen_mod_list.cpp b/src/ui/screen/screen_mod_list.cpp index a216218b..8868e0a9 100644 --- a/src/ui/screen/screen_mod_list.cpp +++ b/src/ui/screen/screen_mod_list.cpp @@ -43,6 +43,8 @@ #include "ui/controls/list.h" #include "ui/controls/window.h" +#include + namespace Ui { @@ -557,7 +559,7 @@ void CScreenModList::UpdateUpDownButtons() } } -std::string CScreenModList::GetLanguageStringProperty(std::unordered_map property, const std::string& fallback) +std::string CScreenModList::GetLanguageStringProperty(const std::unordered_map& property, const std::string& fallback) { std::string ret{}; const auto language = m_app->GetLanguage(); diff --git a/src/ui/screen/screen_mod_list.h b/src/ui/screen/screen_mod_list.h index 655406ec..7be1a133 100644 --- a/src/ui/screen/screen_mod_list.h +++ b/src/ui/screen/screen_mod_list.h @@ -79,7 +79,7 @@ protected: void UpdateApplyButton(); void UpdateUpDownButtons(); - std::string GetLanguageStringProperty(std::unordered_map property, const std::string& fallback); + std::string GetLanguageStringProperty(const std::unordered_map& property, const std::string& fallback); protected: Ui::CMainDialog* m_dialog;