From e4345c3d116016097a4b40f74623a27e32e5d03c Mon Sep 17 00:00:00 2001 From: Ted John Date: Mon, 12 Dec 2016 02:16:08 +0000 Subject: [PATCH] Refactor PlatformEnvironment --- src/PlatformEnvironment.cpp | 7 +++---- src/PlatformEnvironment.h | 6 ++++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/PlatformEnvironment.cpp b/src/PlatformEnvironment.cpp index ea585a7f3b..9f7dcfff31 100644 --- a/src/PlatformEnvironment.cpp +++ b/src/PlatformEnvironment.cpp @@ -22,17 +22,16 @@ extern "C" { - #include "OpenRCT2.h" #include "platform/platform.h" } class PlatformEnvironment : public IPlatformEnvironment { private: - std::string _basePath[4]; + std::string _basePath[DIRBASE_COUNT]; public: - PlatformEnvironment(const std::string basePaths[4]) + PlatformEnvironment(DIRBASE_VALUES basePaths) { for (int i = 0; i < 4; i++) { @@ -84,7 +83,7 @@ private: static const char * FileNames[]; }; -IPlatformEnvironment * CreatePlatformEnvironment(const std::string basePaths[4]) +IPlatformEnvironment * CreatePlatformEnvironment(DIRBASE_VALUES basePaths) { return new PlatformEnvironment(basePaths); } diff --git a/src/PlatformEnvironment.h b/src/PlatformEnvironment.h index 751f8ced85..8fa0cb11f9 100644 --- a/src/PlatformEnvironment.h +++ b/src/PlatformEnvironment.h @@ -19,13 +19,15 @@ #include #include "common.h" -enum class DIRBASE +enum class DIRBASE : int { RCT1, // Base directory for original RollerCoaster Tycoon 1 content. RCT2, // Base directory for original RollerCoaster Tycoon 2 content. OPENRCT2, // Base directory for OpenRCT2 installation. USER, // Base directory for OpenRCT2 user content. }; +constexpr int DIRBASE_COUNT = 4; +using DIRBASE_VALUES = std::string[DIRBASE_COUNT]; enum class DIRID { @@ -70,4 +72,4 @@ interface IPlatformEnvironment virtual std::string GetFilePath(PATHID pathid) const abstract; }; -IPlatformEnvironment * CreatePlatformEnvironment(const std::string basePaths[4]); +IPlatformEnvironment * CreatePlatformEnvironment(DIRBASE_VALUES basePaths);