Fix minor issues
parent
f57da76ae8
commit
2b96eda86d
|
@ -31,16 +31,16 @@
|
|||
|
||||
namespace pt = boost::property_tree;
|
||||
|
||||
boost::optional<pt::ptree> LoadManifest(const std::string& path, bool loaded = false);
|
||||
boost::optional<pt::ptree> LoadManifest(const std::string& path);
|
||||
std::string GetStringProperty(const pt::ptree& manifest, const std::string& key);
|
||||
std::unordered_map<Language, std::string> 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<pt::ptree> LoadManifest(const std::string& path, bool loaded)
|
||||
boost::optional<pt::ptree> LoadManifest(const std::string& path)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -82,7 +82,7 @@ boost::optional<pt::ptree> LoadManifest(const std::string& path, bool loaded)
|
|||
std::string GetStringProperty(const pt::ptree& manifest, const std::string& key)
|
||||
{
|
||||
auto prop = manifest.get_optional<std::string>(key);
|
||||
if (prop.has_value())
|
||||
if (prop)
|
||||
{
|
||||
return prop.get();
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ std::unordered_map<Language, std::string> GetLanguageStringProperty(const pt::pt
|
|||
{
|
||||
std::unordered_map<Language, std::string> ret;
|
||||
auto prop = manifest.get_child_optional(key);
|
||||
if (prop.has_value())
|
||||
if (prop)
|
||||
{
|
||||
for (const auto& child : prop.get())
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "app/moddata.h"
|
||||
|
||||
#include <unordered_map>
|
||||
#include <boost/optional.hpp>
|
||||
#include <vector>
|
||||
|
||||
class CApplication;
|
||||
class CPathManager;
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
#include "ui/controls/list.h"
|
||||
#include "ui/controls/window.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
||||
|
@ -557,7 +559,7 @@ void CScreenModList::UpdateUpDownButtons()
|
|||
}
|
||||
}
|
||||
|
||||
std::string CScreenModList::GetLanguageStringProperty(std::unordered_map<Language, std::string> property, const std::string& fallback)
|
||||
std::string CScreenModList::GetLanguageStringProperty(const std::unordered_map<Language, std::string>& property, const std::string& fallback)
|
||||
{
|
||||
std::string ret{};
|
||||
const auto language = m_app->GetLanguage();
|
||||
|
|
|
@ -79,7 +79,7 @@ protected:
|
|||
void UpdateApplyButton();
|
||||
void UpdateUpDownButtons();
|
||||
|
||||
std::string GetLanguageStringProperty(std::unordered_map<Language, std::string> property, const std::string& fallback);
|
||||
std::string GetLanguageStringProperty(const std::unordered_map<Language, std::string>& property, const std::string& fallback);
|
||||
|
||||
protected:
|
||||
Ui::CMainDialog* m_dialog;
|
||||
|
|
Loading…
Reference in New Issue