From f47d7f27a5b825f9442ca48bf593eb86d653ce4e Mon Sep 17 00:00:00 2001 From: Ted John Date: Sat, 3 Jun 2017 22:17:52 +0100 Subject: [PATCH] Suppress hotkey.cfg error if not found Running the game without hotkeys.cfg existing used to show a warning message. This is unnecessary as it will not exist on first install. --- src/openrct2/config/KeyboardShortcuts.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/openrct2/config/KeyboardShortcuts.cpp b/src/openrct2/config/KeyboardShortcuts.cpp index 797c2bc9c7..7ef482ef40 100644 --- a/src/openrct2/config/KeyboardShortcuts.cpp +++ b/src/openrct2/config/KeyboardShortcuts.cpp @@ -16,6 +16,7 @@ #include "../common.h" #include "../core/Console.hpp" +#include "../core/File.h" #include "../core/FileStream.hpp" #include "../core/Memory.hpp" #include "../core/Path.hpp" @@ -128,20 +129,18 @@ extern "C" try { std::string path = KeyboardShortcuts::GetPath(); - auto fs = FileStream(path, FILE_MODE_OPEN); - - uint16 version = fs.ReadValue(); - if (version == KeyboardShortcuts::CURRENT_FILE_VERSION) + if (File::Exists(path)) { - for (sint32 i = 0; i < SHORTCUT_COUNT; i++) + auto fs = FileStream(path, FILE_MODE_OPEN); + uint16 version = fs.ReadValue(); + if (version == KeyboardShortcuts::CURRENT_FILE_VERSION) { - gShortcutKeys[i] = fs.ReadValue(); + for (sint32 i = 0; i < SHORTCUT_COUNT; i++) + { + gShortcutKeys[i] = fs.ReadValue(); + } + result = true; } - result = true; - } - else - { - result = false; } } catch (const Exception &ex)