From 98d59ccaa341bbe4bb95900d51f4978042c9efa4 Mon Sep 17 00:00:00 2001 From: Ted John Date: Sat, 6 May 2017 22:48:55 +0100 Subject: [PATCH] Fix Linux build errors --- src/openrct2-ui/TextComposition.h | 2 +- src/openrct2-ui/Ui.cpp | 10 ++++++++-- src/openrct2-ui/UiContext.Linux.cpp | 8 ++++---- src/openrct2/OpenRCT2.cpp | 1 + src/openrct2/platform/posix.c | 17 ----------------- src/openrct2/ui/UiContext.h | 1 + 6 files changed, 15 insertions(+), 24 deletions(-) diff --git a/src/openrct2-ui/TextComposition.h b/src/openrct2-ui/TextComposition.h index af08a34dc3..e342723eca 100644 --- a/src/openrct2-ui/TextComposition.h +++ b/src/openrct2-ui/TextComposition.h @@ -39,7 +39,7 @@ namespace OpenRCT2 public: bool IsActive(); - TextInputSession * TextComposition::Start(utf8 * buffer, size_t bufferSize); + TextInputSession * Start(utf8 * buffer, size_t bufferSize); void Stop(); void HandleMessage(const SDL_Event * e); diff --git a/src/openrct2-ui/Ui.cpp b/src/openrct2-ui/Ui.cpp index 4475594fb4..f8939fe0ef 100644 --- a/src/openrct2-ui/Ui.cpp +++ b/src/openrct2-ui/Ui.cpp @@ -16,10 +16,14 @@ #ifndef _MSC_VER +#include #include +#include +#include "audio/AudioContext.h" #include "UiContext.h" using namespace OpenRCT2; +using namespace OpenRCT2::Audio; using namespace OpenRCT2::Ui; /** @@ -28,8 +32,10 @@ using namespace OpenRCT2::Ui; int main(int argc, char * * argv) { // Run OpenRCT2 with a UI context - IContext * context = CreateContext(); - IUiContext * uiContext = CreateContext(context); + + IAudioContext * audioContext = CreateAudioContext(); + IUiContext * uiContext = CreateUiContext(); + IContext * context = CreateContext(audioContext, uiContext); int exitCode = context->RunOpenRCT2(argc, argv); delete uiContext; delete context; diff --git a/src/openrct2-ui/UiContext.Linux.cpp b/src/openrct2-ui/UiContext.Linux.cpp index 43febb6b74..a854fae9a1 100644 --- a/src/openrct2-ui/UiContext.Linux.cpp +++ b/src/openrct2-ui/UiContext.Linux.cpp @@ -16,6 +16,7 @@ #ifdef __linux__ +#include #include #include #include @@ -154,13 +155,13 @@ namespace OpenRCT2 { namespace Ui log_verbose("filename = %s", result.c_str()); - if (desc.Type == FILE_DIALOG_TYPE::OPEN && access(result, F_OK) == -1) + if (desc.Type == FILE_DIALOG_TYPE::OPEN && access(result.c_str(), F_OK) == -1) { std::string msg = String::StdFormat("\"%s\" not found: %s, please choose another file\n", result.c_str(), strerror(errno)); ShowMessageBox(window, msg); return ShowFileDialog(window, desc); } - else if (desc.Type == FILE_DIALOG_TYPE::SAVE && access(result, F_OK) != -1 && dtype == DIALOG_TYPE::KDIALOG) + else if (desc.Type == FILE_DIALOG_TYPE::SAVE && access(result.c_str(), F_OK) != -1 && dtype == DIALOG_TYPE::KDIALOG) { std::string cmd = String::StdFormat("%s --yesno \"Overwrite %s?\"", executablePath, result.c_str()); if (Execute(cmd) != 0) @@ -274,7 +275,7 @@ namespace OpenRCT2 { namespace Ui { // KDialog wants filters space-delimited and we don't expect ';' anywhere else std::string pattern = filter.Pattern; - for (sint32 i = 0; i < pattern.size(); i++) + for (size_t i = 0; i < pattern.size(); i++) { if (pattern[i] == ';') { @@ -299,7 +300,6 @@ namespace OpenRCT2 { namespace Ui { // Zenity seems to be case sensitive, while KDialog isn't std::stringstream filtersb; - bool first = true; for (const auto &filter : filters) { filtersb << " --file-filter='" << filter.Name << " | "; diff --git a/src/openrct2/OpenRCT2.cpp b/src/openrct2/OpenRCT2.cpp index de4bcc0110..7edbdeb157 100644 --- a/src/openrct2/OpenRCT2.cpp +++ b/src/openrct2/OpenRCT2.cpp @@ -23,6 +23,7 @@ extern "C" { #include "audio/audio.h" #include "platform/platform.h" + #include "rct2.h" } extern "C" diff --git a/src/openrct2/platform/posix.c b/src/openrct2/platform/posix.c index 18bbc1d0bb..4b8e572c00 100644 --- a/src/openrct2/platform/posix.c +++ b/src/openrct2/platform/posix.c @@ -46,23 +46,6 @@ utf8 _userDataDirectoryPath[MAX_PATH] = { 0 }; utf8 _openrctDataDirectoryPath[MAX_PATH] = { 0 }; -/** - * The main entry point for non-Windows platforms. - */ -sint32 main(sint32 argc, const char **argv) -{ - core_init(); - - sint32 exitCode = cmdline_run(argv, argc); - if (exitCode == 1) - { - openrct2_launch(); - exitCode = gExitCode; - } - - return exitCode; -} - void platform_get_date_utc(rct2_date *out_date) { assert(out_date != NULL); diff --git a/src/openrct2/ui/UiContext.h b/src/openrct2/ui/UiContext.h index 48079a2f92..5a49cad541 100644 --- a/src/openrct2/ui/UiContext.h +++ b/src/openrct2/ui/UiContext.h @@ -16,6 +16,7 @@ #pragma once +#include #include #include "../common.h" #include "../Context.h"