Fixed so the game does not crash if it cant find data in the config file
This commit is contained in:
@@ -19,11 +19,10 @@ private:
|
||||
ConfigFile(std::string path);
|
||||
|
||||
public:
|
||||
template <typename T>
|
||||
template <typename T, T defaultValue>
|
||||
T GetValue(std::string key)
|
||||
{
|
||||
std::cout << m_ptree.get<T>(key) << std::endl;
|
||||
return m_ptree.get<T>(key);
|
||||
return m_ptree.get<T>(key, defaultValue);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
m_FrameStack->Width = 675;
|
||||
m_FrameStack->Height = 1080;
|
||||
|
||||
if (ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<int>("Story.Skip") == 1) {
|
||||
if (ResourceManager::Load<ConfigFile>("Config.ini")->GetValue<int, 0>("Debug.SkipStory") == 1) {
|
||||
Events::GameStart e;
|
||||
m_EventBroker->Publish(e);
|
||||
auto hud = new GUI::HUD(m_FrameStack, "HUD");
|
||||
|
||||
Reference in New Issue
Block a user