From 3685d1a24b17c0453b2a33020db62edf768e4cb4 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Fri, 29 Nov 2024 12:04:56 +0900 Subject: [PATCH] clang-format: change IndentPPDirectives to BeforeHash (#23287) --- .clang-format | 2 +- src/openrct2-ui/TextComposition.cpp | 6 +- src/openrct2-ui/UiContext.Android.cpp | 20 +-- src/openrct2-ui/UiContext.Linux.cpp | 36 +++--- src/openrct2-ui/UiContext.Win32.cpp | 38 +++--- src/openrct2-ui/UiContext.cpp | 6 +- src/openrct2-ui/audio/FlacAudioSource.cpp | 8 +- src/openrct2-ui/audio/OggAudioSource.cpp | 8 +- src/openrct2-ui/audio/SDLAudioSource.h | 8 +- .../engines/opengl/ApplyPaletteShader.cpp | 2 +- .../opengl/ApplyTransparencyShader.cpp | 2 +- .../drawing/engines/opengl/DrawLineShader.cpp | 4 +- .../drawing/engines/opengl/DrawRectShader.cpp | 2 +- .../drawing/engines/opengl/OpenGLAPI.cpp | 26 ++-- .../drawing/engines/opengl/OpenGLAPI.h | 106 +++++++-------- .../drawing/engines/opengl/OpenGLAPIProc.h | 2 +- .../engines/opengl/OpenGLDrawingEngine.cpp | 62 ++++----- .../engines/opengl/OpenGLFramebuffer.cpp | 10 +- .../engines/opengl/OpenGLShaderProgram.cpp | 14 +- .../engines/opengl/SwapFramebuffer.cpp | 4 +- .../drawing/engines/opengl/TextureCache.cpp | 22 ++-- .../engines/opengl/TransparencyDepth.cpp | 10 +- src/openrct2-ui/scripting/CustomImages.cpp | 14 +- src/openrct2-ui/scripting/CustomImages.h | 12 +- src/openrct2-ui/scripting/CustomListView.cpp | 18 +-- src/openrct2-ui/scripting/CustomListView.h | 16 +-- src/openrct2-ui/scripting/CustomMenu.cpp | 12 +- src/openrct2-ui/scripting/CustomMenu.h | 14 +- src/openrct2-ui/scripting/CustomWindow.cpp | 42 +++--- src/openrct2-ui/scripting/CustomWindow.h | 8 +- .../scripting/ScGraphicsContext.hpp | 6 +- src/openrct2-ui/scripting/ScImageManager.hpp | 10 +- src/openrct2-ui/scripting/ScTileSelection.hpp | 4 +- src/openrct2-ui/scripting/ScTitleSequence.hpp | 34 ++--- src/openrct2-ui/scripting/ScUi.hpp | 26 ++-- src/openrct2-ui/scripting/ScViewport.hpp | 14 +- src/openrct2-ui/scripting/ScWidget.hpp | 20 +-- src/openrct2-ui/scripting/ScWindow.hpp | 10 +- src/openrct2-ui/scripting/UiExtensions.cpp | 22 ++-- src/openrct2-ui/windows/ServerList.cpp | 50 +++---- src/openrct2-ui/windows/ServerStart.cpp | 20 +-- src/openrct2/Context.cpp | 4 +- src/openrct2/Diagnostic.cpp | 2 +- src/openrct2/Diagnostic.h | 46 +++---- src/openrct2/Version.cpp | 14 +- src/openrct2/Version.h | 46 +++---- src/openrct2/actions/CustomAction.cpp | 6 +- src/openrct2/actions/CustomAction.h | 2 +- src/openrct2/actions/GameAction.h | 8 +- src/openrct2/command_line/RootCommands.cpp | 4 +- src/openrct2/config/Config.h | 2 +- src/openrct2/core/CallingConventions.h | 36 +++--- src/openrct2/core/ChecksumStream.cpp | 4 +- src/openrct2/core/Crypt.CNG.cpp | 22 ++-- src/openrct2/core/Crypt.OpenSSL.cpp | 18 +-- src/openrct2/core/DateTime.h | 2 +- src/openrct2/core/Diagnostics.cpp | 6 +- src/openrct2/core/File.cpp | 4 +- src/openrct2/core/FileScanner.cpp | 14 +- src/openrct2/core/FileStream.cpp | 8 +- src/openrct2/core/FileSystem.hpp | 56 ++++---- src/openrct2/core/FileWatcher.cpp | 12 +- src/openrct2/core/FileWatcher.h | 4 +- src/openrct2/core/Guard.cpp | 10 +- src/openrct2/core/Http.Android.cpp | 14 +- src/openrct2/core/Http.WinHttp.cpp | 20 +-- src/openrct2/core/Http.cURL.cpp | 26 ++-- src/openrct2/core/Http.h | 8 +- src/openrct2/core/IStream.hpp | 8 +- src/openrct2/core/Json.hpp | 2 +- src/openrct2/core/Numerics.hpp | 6 +- src/openrct2/core/RTL.FriBidi.cpp | 20 +-- src/openrct2/core/RTL.ICU.cpp | 18 +-- src/openrct2/core/String.cpp | 50 +++---- src/openrct2/core/Zip.cpp | 2 +- src/openrct2/core/ZipAndroid.cpp | 18 +-- src/openrct2/drawing/AVX2Drawing.cpp | 8 +- src/openrct2/drawing/Drawing.String.cpp | 14 +- src/openrct2/drawing/Image.cpp | 12 +- src/openrct2/drawing/SSE41Drawing.cpp | 8 +- src/openrct2/drawing/TTF.cpp | 34 ++--- src/openrct2/drawing/X8DrawingEngine.cpp | 6 +- src/openrct2/drawing/X8DrawingEngine.h | 14 +- src/openrct2/interface/FontFamilies.h | 6 +- src/openrct2/interface/InteractiveConsole.cpp | 2 +- src/openrct2/interface/StdInOutConsole.cpp | 2 +- src/openrct2/interface/Window_internal.h | 8 +- src/openrct2/network/DiscordService.cpp | 26 ++-- src/openrct2/network/DiscordService.h | 4 +- src/openrct2/network/NetworkAction.cpp | 8 +- src/openrct2/network/NetworkBase.cpp | 118 ++++++++--------- src/openrct2/network/NetworkConnection.cpp | 20 +-- src/openrct2/network/NetworkConnection.h | 16 +-- src/openrct2/network/NetworkGroup.cpp | 8 +- src/openrct2/network/NetworkKey.cpp | 14 +- src/openrct2/network/NetworkKey.h | 6 +- src/openrct2/network/NetworkPacket.cpp | 6 +- src/openrct2/network/NetworkPlayer.cpp | 8 +- .../network/NetworkServerAdvertiser.cpp | 64 ++++----- src/openrct2/network/NetworkUser.cpp | 20 +-- src/openrct2/network/ServerList.cpp | 44 +++---- src/openrct2/network/Socket.cpp | 56 ++++---- src/openrct2/object/Object.cpp | 6 +- src/openrct2/object/Object.h | 8 +- src/openrct2/platform/Crash.cpp | 74 +++++------ src/openrct2/platform/Platform.Android.cpp | 18 +-- src/openrct2/platform/Platform.Common.cpp | 32 ++--- src/openrct2/platform/Platform.Linux.cpp | 80 ++++++------ src/openrct2/platform/Platform.Posix.cpp | 58 ++++----- src/openrct2/platform/Platform.Win32.cpp | 74 +++++------ src/openrct2/platform/Platform.h | 12 +- src/openrct2/profiling/ProfilingMacros.hpp | 10 +- src/openrct2/rct12/ScenarioPatcher.cpp | 4 +- src/openrct2/scripting/Duktape.hpp | 18 +-- src/openrct2/scripting/HookEngine.cpp | 8 +- src/openrct2/scripting/HookEngine.h | 12 +- src/openrct2/scripting/Plugin.cpp | 32 ++--- src/openrct2/scripting/Plugin.h | 10 +- src/openrct2/scripting/ScriptEngine.cpp | 122 +++++++++--------- src/openrct2/scripting/ScriptEngine.h | 42 +++--- .../scripting/bindings/entity/ScEntity.hpp | 18 +-- .../scripting/bindings/entity/ScGuest.cpp | 12 +- .../scripting/bindings/entity/ScGuest.hpp | 6 +- .../scripting/bindings/entity/ScLitter.cpp | 4 +- .../scripting/bindings/entity/ScLitter.hpp | 2 +- .../scripting/bindings/entity/ScParticle.hpp | 8 +- .../scripting/bindings/entity/ScPeep.hpp | 2 +- .../scripting/bindings/entity/ScStaff.cpp | 8 +- .../scripting/bindings/entity/ScStaff.hpp | 4 +- .../scripting/bindings/entity/ScVehicle.hpp | 6 +- .../scripting/bindings/game/ScCheats.hpp | 8 +- .../bindings/game/ScConfiguration.hpp | 10 +- .../scripting/bindings/game/ScConsole.hpp | 6 +- .../scripting/bindings/game/ScContext.hpp | 36 +++--- .../scripting/bindings/game/ScDisposable.hpp | 4 +- .../scripting/bindings/game/ScPlugin.hpp | 6 +- .../scripting/bindings/game/ScProfiler.hpp | 4 +- .../scripting/bindings/network/ScNetwork.cpp | 92 ++++++------- .../scripting/bindings/network/ScNetwork.hpp | 26 ++-- .../scripting/bindings/network/ScPlayer.cpp | 44 +++---- .../scripting/bindings/network/ScPlayer.hpp | 4 +- .../bindings/network/ScPlayerGroup.cpp | 40 +++--- .../bindings/network/ScPlayerGroup.hpp | 6 +- .../scripting/bindings/network/ScSocket.hpp | 18 +-- .../bindings/object/ScInstalledObject.hpp | 10 +- .../scripting/bindings/object/ScObject.hpp | 22 ++-- .../bindings/object/ScObjectManager.cpp | 10 +- .../bindings/object/ScObjectManager.h | 10 +- .../scripting/bindings/ride/ScRide.cpp | 16 +-- .../scripting/bindings/ride/ScRide.hpp | 12 +- .../scripting/bindings/ride/ScRideStation.cpp | 12 +- .../scripting/bindings/ride/ScRideStation.hpp | 6 +- .../bindings/ride/ScTrackIterator.cpp | 14 +- .../scripting/bindings/ride/ScTrackIterator.h | 8 +- .../bindings/ride/ScTrackSegment.cpp | 10 +- .../scripting/bindings/ride/ScTrackSegment.h | 6 +- .../scripting/bindings/world/ScClimate.hpp | 12 +- .../scripting/bindings/world/ScDate.hpp | 14 +- .../scripting/bindings/world/ScMap.cpp | 48 +++---- .../scripting/bindings/world/ScMap.hpp | 8 +- .../scripting/bindings/world/ScPark.cpp | 28 ++-- .../scripting/bindings/world/ScPark.hpp | 10 +- .../bindings/world/ScParkMessage.cpp | 22 ++-- .../bindings/world/ScParkMessage.hpp | 10 +- .../scripting/bindings/world/ScResearch.cpp | 18 +-- .../scripting/bindings/world/ScResearch.hpp | 2 +- .../scripting/bindings/world/ScScenario.hpp | 14 +- .../scripting/bindings/world/ScTile.cpp | 30 ++--- .../scripting/bindings/world/ScTile.hpp | 14 +- .../bindings/world/ScTileElement.cpp | 48 +++---- .../bindings/world/ScTileElement.hpp | 22 ++-- src/openrct2/util/Prefetch.h | 34 ++--- test/tests/tests.cpp | 4 +- 173 files changed, 1636 insertions(+), 1636 deletions(-) diff --git a/.clang-format b/.clang-format index 6ca231784a..1f105b47b9 100644 --- a/.clang-format +++ b/.clang-format @@ -62,7 +62,7 @@ IncludeCategories: - Regex: '^<' Priority: 2 IndentCaseLabels: true -IndentPPDirectives: AfterHash +IndentPPDirectives: BeforeHash IndentWidth: 4 IndentWrappedFunctionNames: true KeepEmptyLinesAtTheStartOfBlocks: false diff --git a/src/openrct2-ui/TextComposition.cpp b/src/openrct2-ui/TextComposition.cpp index da08505389..282b4c5f8f 100644 --- a/src/openrct2-ui/TextComposition.cpp +++ b/src/openrct2-ui/TextComposition.cpp @@ -20,10 +20,10 @@ #include #ifdef __MACOSX__ -// macOS uses COMMAND rather than CTRL for many keyboard shortcuts -# define KEYBOARD_PRIMARY_MODIFIER KMOD_GUI + // macOS uses COMMAND rather than CTRL for many keyboard shortcuts + #define KEYBOARD_PRIMARY_MODIFIER KMOD_GUI #else -# define KEYBOARD_PRIMARY_MODIFIER KMOD_CTRL + #define KEYBOARD_PRIMARY_MODIFIER KMOD_CTRL #endif using namespace OpenRCT2; diff --git a/src/openrct2-ui/UiContext.Android.cpp b/src/openrct2-ui/UiContext.Android.cpp index 0293c151a0..7ba0237ace 100644 --- a/src/openrct2-ui/UiContext.Android.cpp +++ b/src/openrct2-ui/UiContext.Android.cpp @@ -9,17 +9,17 @@ #ifdef __ANDROID__ -# include "UiContext.h" + #include "UiContext.h" -# include -# include -# include -# include -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include + #include + #include + #include + #include namespace OpenRCT2::Ui { diff --git a/src/openrct2-ui/UiContext.Linux.cpp b/src/openrct2-ui/UiContext.Linux.cpp index bf5f0158e3..9f943e7412 100644 --- a/src/openrct2-ui/UiContext.Linux.cpp +++ b/src/openrct2-ui/UiContext.Linux.cpp @@ -9,23 +9,23 @@ #if (defined(__unix__) || defined(__EMSCRIPTEN__)) && !defined(__ANDROID__) && !defined(__APPLE__) -# include "UiContext.h" + #include "UiContext.h" -# include "UiStringIds.h" + #include "UiStringIds.h" -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include namespace OpenRCT2::Ui { @@ -52,7 +52,7 @@ namespace OpenRCT2::Ui bool IsSteamOverlayAttached() override { -# ifdef __linux__ + #ifdef __linux__ // See http://syprog.blogspot.ru/2011/12/listing-loaded-shared-objects-in-linux.html struct lmap { @@ -87,9 +87,9 @@ namespace OpenRCT2::Ui dlclose(processHandle); } return result; -# else + #else return false; // Needed for OpenBSD, likely all other Unixes. -# endif + #endif } void ShowMessageBox(SDL_Window* window, const std::string& message) override diff --git a/src/openrct2-ui/UiContext.Win32.cpp b/src/openrct2-ui/UiContext.Win32.cpp index 317c96a200..db7379e452 100644 --- a/src/openrct2-ui/UiContext.Win32.cpp +++ b/src/openrct2-ui/UiContext.Win32.cpp @@ -9,30 +9,30 @@ #ifdef _WIN32 -// Windows.h needs to be included first // clang-format off -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# include -# include -# include + // windows.h needs to be included first + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif + #include + #include + #undef CreateWindow // clang-format on -# undef CreateWindow -// Then the rest -# include "UiContext.h" + // Then the rest + #include "UiContext.h" -# include -# include -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include + #include + #include + #include -// Native resource IDs -# include "../../resources/resource.h" + // Native resource IDs + #include "../../resources/resource.h" using namespace Microsoft::WRL; diff --git a/src/openrct2-ui/UiContext.cpp b/src/openrct2-ui/UiContext.cpp index 885463cc1f..cb8d98b072 100644 --- a/src/openrct2-ui/UiContext.cpp +++ b/src/openrct2-ui/UiContext.cpp @@ -55,10 +55,10 @@ using namespace OpenRCT2::Scripting; using namespace OpenRCT2::Ui; #ifdef __MACOSX__ -// macOS uses COMMAND rather than CTRL for many keyboard shortcuts -# define KEYBOARD_PRIMARY_MODIFIER KMOD_GUI + // macOS uses COMMAND rather than CTRL for many keyboard shortcuts + #define KEYBOARD_PRIMARY_MODIFIER KMOD_GUI #else -# define KEYBOARD_PRIMARY_MODIFIER KMOD_CTRL + #define KEYBOARD_PRIMARY_MODIFIER KMOD_CTRL #endif class UiContext final : public IUiContext diff --git a/src/openrct2-ui/audio/FlacAudioSource.cpp b/src/openrct2-ui/audio/FlacAudioSource.cpp index 7b76758fcb..757e9487ad 100644 --- a/src/openrct2-ui/audio/FlacAudioSource.cpp +++ b/src/openrct2-ui/audio/FlacAudioSource.cpp @@ -13,10 +13,10 @@ #include #ifndef DISABLE_FLAC -# include -# include -# include -# include + #include + #include + #include + #include #endif namespace OpenRCT2::Audio diff --git a/src/openrct2-ui/audio/OggAudioSource.cpp b/src/openrct2-ui/audio/OggAudioSource.cpp index 214767dd04..803253fc2c 100644 --- a/src/openrct2-ui/audio/OggAudioSource.cpp +++ b/src/openrct2-ui/audio/OggAudioSource.cpp @@ -14,10 +14,10 @@ #include #ifndef DISABLE_VORBIS -# include -# include -# include -# include + #include + #include + #include + #include #endif namespace OpenRCT2::Audio diff --git a/src/openrct2-ui/audio/SDLAudioSource.h b/src/openrct2-ui/audio/SDLAudioSource.h index 5a5533cef8..37afb7d377 100644 --- a/src/openrct2-ui/audio/SDLAudioSource.h +++ b/src/openrct2-ui/audio/SDLAudioSource.h @@ -22,9 +22,9 @@ namespace OpenRCT2::Audio struct IAudioMixer; #ifdef __WARN_SUGGEST_FINAL_METHODS__ -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wsuggest-final-methods" -# pragma GCC diagnostic ignored "-Wsuggest-final-types" + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wsuggest-final-methods" + #pragma GCC diagnostic ignored "-Wsuggest-final-types" #endif class SDLAudioSource : public IAudioSource { @@ -46,7 +46,7 @@ namespace OpenRCT2::Audio IAudioMixer* GetMixer(); }; #ifdef __WARN_SUGGEST_FINAL_METHODS__ -# pragma GCC diagnostic pop + #pragma GCC diagnostic pop #endif std::unique_ptr CreateAudioSource(SDL_RWops* rw); diff --git a/src/openrct2-ui/drawing/engines/opengl/ApplyPaletteShader.cpp b/src/openrct2-ui/drawing/engines/opengl/ApplyPaletteShader.cpp index bcd74090c7..5fa541f612 100644 --- a/src/openrct2-ui/drawing/engines/opengl/ApplyPaletteShader.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/ApplyPaletteShader.cpp @@ -9,7 +9,7 @@ #ifndef DISABLE_OPENGL -# include "ApplyPaletteShader.h" + #include "ApplyPaletteShader.h" using namespace OpenRCT2::Ui; diff --git a/src/openrct2-ui/drawing/engines/opengl/ApplyTransparencyShader.cpp b/src/openrct2-ui/drawing/engines/opengl/ApplyTransparencyShader.cpp index 7bbb1f2f4b..0f35d335a8 100644 --- a/src/openrct2-ui/drawing/engines/opengl/ApplyTransparencyShader.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/ApplyTransparencyShader.cpp @@ -9,7 +9,7 @@ #ifndef DISABLE_OPENGL -# include "ApplyTransparencyShader.h" + #include "ApplyTransparencyShader.h" using namespace OpenRCT2::Ui; diff --git a/src/openrct2-ui/drawing/engines/opengl/DrawLineShader.cpp b/src/openrct2-ui/drawing/engines/opengl/DrawLineShader.cpp index 5b0ed0df48..06ebe29e16 100644 --- a/src/openrct2-ui/drawing/engines/opengl/DrawLineShader.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/DrawLineShader.cpp @@ -9,9 +9,9 @@ #ifndef DISABLE_OPENGL -# include "DrawLineShader.h" + #include "DrawLineShader.h" -# include "OpenGLFramebuffer.h" + #include "OpenGLFramebuffer.h" using namespace OpenRCT2::Ui; diff --git a/src/openrct2-ui/drawing/engines/opengl/DrawRectShader.cpp b/src/openrct2-ui/drawing/engines/opengl/DrawRectShader.cpp index ed43dddb34..f473806d53 100644 --- a/src/openrct2-ui/drawing/engines/opengl/DrawRectShader.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/DrawRectShader.cpp @@ -9,7 +9,7 @@ #ifndef DISABLE_OPENGL -# include "DrawRectShader.h" + #include "DrawRectShader.h" using namespace OpenRCT2::Ui; diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.cpp index d54f1c70cc..31347ad169 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.cpp @@ -9,20 +9,20 @@ #ifndef DISABLE_OPENGL -# include "OpenGLAPI.h" + #include "OpenGLAPI.h" -# if OPENGL_NO_LINK + #if OPENGL_NO_LINK -# define OPENGL_PROC(TYPE, PROC) TYPE PROC = nullptr; -# include "OpenGLAPIProc.h" -# undef OPENGL_PROC + #define OPENGL_PROC(TYPE, PROC) TYPE PROC = nullptr; + #include "OpenGLAPIProc.h" + #undef OPENGL_PROC -# include -# include + #include + #include static const char* TryLoadAllProcAddresses() { -# define OPENGL_PROC(TYPE, PROC) \ + #define OPENGL_PROC(TYPE, PROC) \ { \ PROC = reinterpret_cast(SDL_GL_GetProcAddress(#PROC)); \ if (PROC == nullptr) \ @@ -30,13 +30,13 @@ static const char* TryLoadAllProcAddresses() return #PROC; \ } \ } -# include "OpenGLAPIProc.h" -# undef OPENGL_PROC + #include "OpenGLAPIProc.h" + #undef OPENGL_PROC return nullptr; } -# endif /* #if OPENGL_NO_LINK */ + #endif /* #if OPENGL_NO_LINK */ using namespace OpenRCT2::Ui; @@ -65,14 +65,14 @@ bool OpenGLAPI::Initialise() { OpenGLState::Reset(); -# ifdef OPENGL_NO_LINK + #ifdef OPENGL_NO_LINK const char* failedProcName = TryLoadAllProcAddresses(); if (failedProcName != nullptr) { Console::Error::WriteLine("Failed to load %s.", failedProcName); return false; } -# endif + #endif return true; } diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.h b/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.h index 185a81463d..4c0302d555 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.h +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.h @@ -13,31 +13,31 @@ #ifdef OPENGL_NO_LINK -// BEGIN [Do not define 1.1 function signatures] -# define glActiveTexture __static__glActiveTexture -# define glBegin __static__glBegin -# define glBindTexture __static__glBindTexture -# define glBlendFunc __static__glBlendFunc -# define glClear __static__glClear -# define glClearColor __static__glClearColor -# define glCullFace __static__glCullFace -# define glDeleteTextures __static__glDeleteTextures -# define glDepthFunc __static__glDepthFunc -# define glDisable __static__glDisable -# define glDrawArrays __static__glDrawArrays -# define glEnable __static__glEnable -# define glEnd __static__glEnd -# define glGenTextures __static__glGenTextures -# define glGetError __static__glGetError -# define glPixelStorei __static__glPixelStorei -# define glReadPixels __static__glReadPixels -# define glTexImage2D __static__glTexImage2D -# define glTexParameteri __static__glTexParameteri -# define glViewport __static__glViewport -# define glTexSubImage3D __static__glTexSubImage3D -# define glTexImage3D __static__glTexImage3D -# define glGetIntegerv __static__glGetIntegerv -# define glGetTexImage __static__glGetTexImage + // BEGIN [Do not define 1.1 function signatures] + #define glActiveTexture __static__glActiveTexture + #define glBegin __static__glBegin + #define glBindTexture __static__glBindTexture + #define glBlendFunc __static__glBlendFunc + #define glClear __static__glClear + #define glClearColor __static__glClearColor + #define glCullFace __static__glCullFace + #define glDeleteTextures __static__glDeleteTextures + #define glDepthFunc __static__glDepthFunc + #define glDisable __static__glDisable + #define glDrawArrays __static__glDrawArrays + #define glEnable __static__glEnable + #define glEnd __static__glEnd + #define glGenTextures __static__glGenTextures + #define glGetError __static__glGetError + #define glPixelStorei __static__glPixelStorei + #define glReadPixels __static__glReadPixels + #define glTexImage2D __static__glTexImage2D + #define glTexParameteri __static__glTexParameteri + #define glViewport __static__glViewport + #define glTexSubImage3D __static__glTexSubImage3D + #define glTexImage3D __static__glTexImage3D + #define glGetIntegerv __static__glGetIntegerv + #define glGetTexImage __static__glGetTexImage #endif @@ -49,31 +49,31 @@ #ifdef OPENGL_NO_LINK -// END [Do not define 1.1 function signatures] -# undef glActiveTexture -# undef glBegin -# undef glBindTexture -# undef glBlendFunc -# undef glClear -# undef glClearColor -# undef glCullFace -# undef glDeleteTextures -# undef glDepthFunc -# undef glDisable -# undef glDrawArrays -# undef glEnable -# undef glEnd -# undef glGenTextures -# undef glGetError -# undef glPixelStorei -# undef glReadPixels -# undef glTexImage2D -# undef glTexParameteri -# undef glViewport -# undef glTexSubImage3D -# undef glTexImage3D -# undef glGetIntegerv -# undef glGetTexImage + // END [Do not define 1.1 function signatures] + #undef glActiveTexture + #undef glBegin + #undef glBindTexture + #undef glBlendFunc + #undef glClear + #undef glClearColor + #undef glCullFace + #undef glDeleteTextures + #undef glDepthFunc + #undef glDisable + #undef glDrawArrays + #undef glEnable + #undef glEnd + #undef glGenTextures + #undef glGetError + #undef glPixelStorei + #undef glReadPixels + #undef glTexImage2D + #undef glTexParameteri + #undef glViewport + #undef glTexSubImage3D + #undef glTexImage3D + #undef glGetIntegerv + #undef glGetTexImage // 1.1 function signatures using PFNGLBEGINPROC = void(APIENTRYP)(GLenum mode); @@ -107,9 +107,9 @@ using PFNGLTEXIMAGE3DPROC = void(APIENTRYP)( using PFNGLGETINTERGERVPROC = void(APIENTRYP)(GLenum pname, GLint* data); using PFNGLGETTEXIMAGEPROC = void(APIENTRYP)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid* img); -# define OPENGL_PROC(TYPE, PROC) extern TYPE PROC; -# include "OpenGLAPIProc.h" -# undef OPENGL_PROC + #define OPENGL_PROC(TYPE, PROC) extern TYPE PROC; + #include "OpenGLAPIProc.h" + #undef OPENGL_PROC #endif /* OPENGL_NO_LINK */ diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLAPIProc.h b/src/openrct2-ui/drawing/engines/opengl/OpenGLAPIProc.h index 1597d1c7c3..0245978654 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLAPIProc.h +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLAPIProc.h @@ -8,7 +8,7 @@ *****************************************************************************/ #ifndef OPENGL_PROC -# error "Do not include OpenGLAPIProc.h directly. Include OpenGLAPI.h instead." + #error "Do not include OpenGLAPIProc.h directly. Include OpenGLAPI.h instead." #endif // 1.1 function pointers diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp index 00f987d5c8..c7790b0bc8 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp @@ -9,34 +9,34 @@ #ifndef DISABLE_OPENGL -# include "../DrawingEngineFactory.hpp" -# include "ApplyPaletteShader.h" -# include "DrawCommands.h" -# include "DrawLineShader.h" -# include "DrawRectShader.h" -# include "GLSLTypes.h" -# include "OpenGLAPI.h" -# include "OpenGLFramebuffer.h" -# include "SwapFramebuffer.h" -# include "TextureCache.h" -# include "TransparencyDepth.h" + #include "../DrawingEngineFactory.hpp" + #include "ApplyPaletteShader.h" + #include "DrawCommands.h" + #include "DrawLineShader.h" + #include "DrawRectShader.h" + #include "GLSLTypes.h" + #include "OpenGLAPI.h" + #include "OpenGLFramebuffer.h" + #include "SwapFramebuffer.h" + #include "TextureCache.h" + #include "TransparencyDepth.h" -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include using namespace OpenRCT2; using namespace OpenRCT2::Drawing; @@ -977,7 +977,7 @@ void OpenGLDrawingContext::DrawGlyph(DrawPixelInfo& dpi, const ImageId image, in void OpenGLDrawingContext::DrawTTFBitmap( DrawPixelInfo& dpi, TextDrawInfo* info, TTFSurface* surface, int32_t x, int32_t y, uint8_t hintingThreshold) { -# ifndef NO_TTF + #ifndef NO_TTF auto baseId = static_cast(0x7FFFF) - 1024; auto imageId = baseId + _ttfGlId; _engine.InvalidateImage(imageId); @@ -1062,7 +1062,7 @@ void OpenGLDrawingContext::DrawTTFBitmap( command.colour = info->palette[1]; command.bounds = { left, top, right, bottom }; command.depth = _drawCount++; -# endif // NO_TTF + #endif // NO_TTF } void OpenGLDrawingContext::FlushCommandBuffers() @@ -1149,10 +1149,10 @@ ScreenRect OpenGLDrawingContext::CalculateClipping(const DrawPixelInfo& dpi) con const DrawPixelInfo* screenDPI = _engine.GetDPI(); const int32_t bytesPerRow = screenDPI->LineStride(); const int32_t bitsOffset = static_cast(dpi.bits - screenDPI->bits); -# ifndef NDEBUG + #ifndef NDEBUG const ptrdiff_t bitsSize = static_cast(screenDPI->height) * static_cast(bytesPerRow); assert(static_cast(bitsOffset) < bitsSize && static_cast(bitsOffset) >= 0); -# endif + #endif const int32_t left = bitsOffset % bytesPerRow; const int32_t top = bitsOffset / bytesPerRow; diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.cpp index f636647799..0a4c6751ee 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.cpp @@ -9,12 +9,12 @@ #ifndef DISABLE_OPENGL -# include "OpenGLFramebuffer.h" + #include "OpenGLFramebuffer.h" -# include -# include -# include -# include + #include + #include + #include + #include using namespace OpenRCT2::Ui; diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.cpp index 7e9278087d..f30420086f 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLShaderProgram.cpp @@ -9,14 +9,14 @@ #ifndef DISABLE_OPENGL -# include "OpenGLShaderProgram.h" + #include "OpenGLShaderProgram.h" -# include -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include + #include using namespace OpenRCT2::Ui; diff --git a/src/openrct2-ui/drawing/engines/opengl/SwapFramebuffer.cpp b/src/openrct2-ui/drawing/engines/opengl/SwapFramebuffer.cpp index cf44c003b5..e143365714 100644 --- a/src/openrct2-ui/drawing/engines/opengl/SwapFramebuffer.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/SwapFramebuffer.cpp @@ -9,9 +9,9 @@ #ifndef DISABLE_OPENGL -# include "SwapFramebuffer.h" + #include "SwapFramebuffer.h" -# include "OpenGLFramebuffer.h" + #include "OpenGLFramebuffer.h" using namespace OpenRCT2::Ui; diff --git a/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp b/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp index 414e39b3b3..57c220001b 100644 --- a/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/TextureCache.cpp @@ -9,16 +9,16 @@ #ifndef DISABLE_OPENGL -# include "TextureCache.h" + #include "TextureCache.h" -# include -# include -# include -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include + #include + #include + #include using namespace OpenRCT2::Ui; @@ -352,9 +352,9 @@ AtlasTextureInfo TextureCache::AllocateImage(int32_t imageWidth, int32_t imageHe auto atlasIndex = static_cast(_atlases.size()); int32_t atlasSize = powf(2, static_cast(Atlas::CalculateImageSizeOrder(imageWidth, imageHeight))); -# ifdef DEBUG + #ifdef DEBUG LOG_VERBOSE("new texture atlas #%d (size %d) allocated", atlasIndex, atlasSize); -# endif + #endif _atlases.emplace_back(atlasIndex, atlasSize); _atlases.back().Initialise(_atlasesTextureDimensions, _atlasesTextureDimensions); diff --git a/src/openrct2-ui/drawing/engines/opengl/TransparencyDepth.cpp b/src/openrct2-ui/drawing/engines/opengl/TransparencyDepth.cpp index 04b40f59d3..a703f57961 100644 --- a/src/openrct2-ui/drawing/engines/opengl/TransparencyDepth.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/TransparencyDepth.cpp @@ -9,12 +9,12 @@ #ifndef DISABLE_OPENGL -# include "TransparencyDepth.h" + #include "TransparencyDepth.h" -# include -# include -# include -# include + #include + #include + #include + #include namespace OpenRCT2::Ui { diff --git a/src/openrct2-ui/scripting/CustomImages.cpp b/src/openrct2-ui/scripting/CustomImages.cpp index 76b5ac3acd..3e06b01f1c 100644 --- a/src/openrct2-ui/scripting/CustomImages.cpp +++ b/src/openrct2-ui/scripting/CustomImages.cpp @@ -9,15 +9,15 @@ #ifdef ENABLE_SCRIPTING -# include "CustomImages.h" + #include "CustomImages.h" -# include "ScGraphicsContext.hpp" + #include "ScGraphicsContext.hpp" -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include using namespace OpenRCT2::Drawing; diff --git a/src/openrct2-ui/scripting/CustomImages.h b/src/openrct2-ui/scripting/CustomImages.h index e78e8256af..1e9ed79cc6 100644 --- a/src/openrct2-ui/scripting/CustomImages.h +++ b/src/openrct2-ui/scripting/CustomImages.h @@ -11,12 +11,12 @@ #ifdef ENABLE_SCRIPTING -# include -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2-ui/scripting/CustomListView.cpp b/src/openrct2-ui/scripting/CustomListView.cpp index 8550a34709..332d028b39 100644 --- a/src/openrct2-ui/scripting/CustomListView.cpp +++ b/src/openrct2-ui/scripting/CustomListView.cpp @@ -9,17 +9,17 @@ #ifdef ENABLE_SCRIPTING -# include "CustomListView.h" + #include "CustomListView.h" -# include "../interface/Viewport.h" -# include "../interface/Widget.h" -# include "../interface/Window.h" + #include "../interface/Viewport.h" + #include "../interface/Widget.h" + #include "../interface/Window.h" -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include using namespace OpenRCT2::Scripting; using namespace OpenRCT2::Ui::Windows; diff --git a/src/openrct2-ui/scripting/CustomListView.h b/src/openrct2-ui/scripting/CustomListView.h index 3a473e723f..8eca117a46 100644 --- a/src/openrct2-ui/scripting/CustomListView.h +++ b/src/openrct2-ui/scripting/CustomListView.h @@ -11,15 +11,15 @@ #ifdef ENABLE_SCRIPTING -# include "../interface/Window.h" + #include "../interface/Window.h" -# include -# include -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include + #include + #include namespace OpenRCT2::Ui::Windows { diff --git a/src/openrct2-ui/scripting/CustomMenu.cpp b/src/openrct2-ui/scripting/CustomMenu.cpp index 898d600e9e..ad73c492d5 100644 --- a/src/openrct2-ui/scripting/CustomMenu.cpp +++ b/src/openrct2-ui/scripting/CustomMenu.cpp @@ -9,14 +9,14 @@ #ifdef ENABLE_SCRIPTING -# include "CustomMenu.h" + #include "CustomMenu.h" -# include "../interface/Viewport.h" + #include "../interface/Viewport.h" -# include -# include -# include -# include + #include + #include + #include + #include using namespace OpenRCT2; using namespace OpenRCT2::Ui; diff --git a/src/openrct2-ui/scripting/CustomMenu.h b/src/openrct2-ui/scripting/CustomMenu.h index 7a30868b4b..6ac95b55f2 100644 --- a/src/openrct2-ui/scripting/CustomMenu.h +++ b/src/openrct2-ui/scripting/CustomMenu.h @@ -11,13 +11,13 @@ #ifdef ENABLE_SCRIPTING -# include -# include -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include + #include + #include enum class CursorID : uint8_t; diff --git a/src/openrct2-ui/scripting/CustomWindow.cpp b/src/openrct2-ui/scripting/CustomWindow.cpp index 4924c089c3..0059c3d2bf 100644 --- a/src/openrct2-ui/scripting/CustomWindow.cpp +++ b/src/openrct2-ui/scripting/CustomWindow.cpp @@ -9,28 +9,28 @@ #ifdef ENABLE_SCRIPTING -# include "../UiContext.h" -# include "../UiStringIds.h" -# include "../interface/Dropdown.h" -# include "../interface/Widget.h" -# include "../scripting/ScGraphicsContext.hpp" -# include "../scripting/ScWidget.hpp" -# include "../windows/Window.h" -# include "CustomListView.h" -# include "ScUi.hpp" -# include "ScWindow.hpp" + #include "../UiContext.h" + #include "../UiStringIds.h" + #include "../interface/Dropdown.h" + #include "../interface/Widget.h" + #include "../scripting/ScGraphicsContext.hpp" + #include "../scripting/ScWidget.hpp" + #include "../windows/Window.h" + #include "CustomListView.h" + #include "ScUi.hpp" + #include "ScWindow.hpp" -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include using namespace OpenRCT2; using namespace OpenRCT2::Scripting; diff --git a/src/openrct2-ui/scripting/CustomWindow.h b/src/openrct2-ui/scripting/CustomWindow.h index 13f8a81410..17fe8de3f7 100644 --- a/src/openrct2-ui/scripting/CustomWindow.h +++ b/src/openrct2-ui/scripting/CustomWindow.h @@ -11,11 +11,11 @@ #ifdef ENABLE_SCRIPTING -# include "../interface/Window.h" + #include "../interface/Window.h" -# include -# include -# include + #include + #include + #include namespace OpenRCT2::Ui::Windows { diff --git a/src/openrct2-ui/scripting/ScGraphicsContext.hpp b/src/openrct2-ui/scripting/ScGraphicsContext.hpp index ad1ec00091..98ba930e22 100644 --- a/src/openrct2-ui/scripting/ScGraphicsContext.hpp +++ b/src/openrct2-ui/scripting/ScGraphicsContext.hpp @@ -11,10 +11,10 @@ #ifdef ENABLE_SCRIPTING -# include "CustomImages.h" + #include "CustomImages.h" -# include -# include + #include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2-ui/scripting/ScImageManager.hpp b/src/openrct2-ui/scripting/ScImageManager.hpp index 296c47dc6c..c6cdf9e75f 100644 --- a/src/openrct2-ui/scripting/ScImageManager.hpp +++ b/src/openrct2-ui/scripting/ScImageManager.hpp @@ -11,12 +11,12 @@ #ifdef ENABLE_SCRIPTING -# include "CustomImages.h" + #include "CustomImages.h" -# include -# include -# include -# include + #include + #include + #include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2-ui/scripting/ScTileSelection.hpp b/src/openrct2-ui/scripting/ScTileSelection.hpp index 9be4723d6e..e19920979f 100644 --- a/src/openrct2-ui/scripting/ScTileSelection.hpp +++ b/src/openrct2-ui/scripting/ScTileSelection.hpp @@ -11,8 +11,8 @@ #ifdef ENABLE_SCRIPTING -# include -# include + #include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2-ui/scripting/ScTitleSequence.hpp b/src/openrct2-ui/scripting/ScTitleSequence.hpp index 5d179018ef..434fef4664 100644 --- a/src/openrct2-ui/scripting/ScTitleSequence.hpp +++ b/src/openrct2-ui/scripting/ScTitleSequence.hpp @@ -11,23 +11,23 @@ #ifdef ENABLE_SCRIPTING -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2-ui/scripting/ScUi.hpp b/src/openrct2-ui/scripting/ScUi.hpp index c1b8a3d4ae..140a5ca658 100644 --- a/src/openrct2-ui/scripting/ScUi.hpp +++ b/src/openrct2-ui/scripting/ScUi.hpp @@ -11,20 +11,20 @@ #ifdef ENABLE_SCRIPTING -# include "../windows/Window.h" -# include "CustomMenu.h" -# include "ScImageManager.hpp" -# include "ScTileSelection.hpp" -# include "ScViewport.hpp" -# include "ScWindow.hpp" + #include "../windows/Window.h" + #include "CustomMenu.h" + #include "ScImageManager.hpp" + #include "ScTileSelection.hpp" + #include "ScViewport.hpp" + #include "ScWindow.hpp" -# include -# include -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include + #include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2-ui/scripting/ScViewport.hpp b/src/openrct2-ui/scripting/ScViewport.hpp index 5315050b53..49410bcc9d 100644 --- a/src/openrct2-ui/scripting/ScViewport.hpp +++ b/src/openrct2-ui/scripting/ScViewport.hpp @@ -11,14 +11,14 @@ #ifdef ENABLE_SCRIPTING -# include "../interface/Window.h" + #include "../interface/Window.h" -# include -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2-ui/scripting/ScWidget.hpp b/src/openrct2-ui/scripting/ScWidget.hpp index 5bb00ccd7f..7324a435b1 100644 --- a/src/openrct2-ui/scripting/ScWidget.hpp +++ b/src/openrct2-ui/scripting/ScWidget.hpp @@ -11,17 +11,17 @@ #ifdef ENABLE_SCRIPTING -# include "../interface/Widget.h" -# include "../interface/Window.h" -# include "CustomListView.h" -# include "CustomWindow.h" -# include "ScViewport.hpp" + #include "../interface/Widget.h" + #include "../interface/Window.h" + #include "CustomListView.h" + #include "CustomWindow.h" + #include "ScViewport.hpp" -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2-ui/scripting/ScWindow.hpp b/src/openrct2-ui/scripting/ScWindow.hpp index 6289386ad9..b07da7d872 100644 --- a/src/openrct2-ui/scripting/ScWindow.hpp +++ b/src/openrct2-ui/scripting/ScWindow.hpp @@ -11,12 +11,12 @@ #ifdef ENABLE_SCRIPTING -# include "ScWidget.hpp" + #include "ScWidget.hpp" -# include -# include -# include -# include + #include + #include + #include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2-ui/scripting/UiExtensions.cpp b/src/openrct2-ui/scripting/UiExtensions.cpp index 05a27456f8..eb8a963f6c 100644 --- a/src/openrct2-ui/scripting/UiExtensions.cpp +++ b/src/openrct2-ui/scripting/UiExtensions.cpp @@ -9,19 +9,19 @@ #ifdef ENABLE_SCRIPTING -# include "UiExtensions.h" + #include "UiExtensions.h" -# include "CustomImages.h" -# include "CustomMenu.h" -# include "ScGraphicsContext.hpp" -# include "ScImageManager.hpp" -# include "ScTileSelection.hpp" -# include "ScTitleSequence.hpp" -# include "ScUi.hpp" -# include "ScWidget.hpp" -# include "ScWindow.hpp" + #include "CustomImages.h" + #include "CustomMenu.h" + #include "ScGraphicsContext.hpp" + #include "ScImageManager.hpp" + #include "ScTileSelection.hpp" + #include "ScTitleSequence.hpp" + #include "ScUi.hpp" + #include "ScWidget.hpp" + #include "ScWindow.hpp" -# include + #include using namespace OpenRCT2::Scripting; diff --git a/src/openrct2-ui/windows/ServerList.cpp b/src/openrct2-ui/windows/ServerList.cpp index 3b7e3e9c4d..196d48728d 100644 --- a/src/openrct2-ui/windows/ServerList.cpp +++ b/src/openrct2-ui/windows/ServerList.cpp @@ -9,32 +9,32 @@ #ifndef DISABLE_NETWORK -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include namespace OpenRCT2::Ui::Windows { -# define WWIDTH_MIN 500 -# define WHEIGHT_MIN 300 -# define WWIDTH_MAX 1200 -# define WHEIGHT_MAX 800 -# define ITEM_HEIGHT (3 + 9 + 3) + #define WWIDTH_MIN 500 + #define WHEIGHT_MIN 300 + #define WWIDTH_MAX 1200 + #define WHEIGHT_MAX 800 + #define ITEM_HEIGHT (3 + 9 + 3) constexpr size_t MaxPlayerNameLength = 32; @@ -91,7 +91,7 @@ namespace OpenRCT2::Ui::Windows std::string _version; public: -# pragma region Window Override Events + #pragma region Window Override Events void OnOpen() override { @@ -433,7 +433,7 @@ namespace OpenRCT2::Ui::Windows } } -# pragma endregion + #pragma endregion private: void ServerListFetchServersBegin() diff --git a/src/openrct2-ui/windows/ServerStart.cpp b/src/openrct2-ui/windows/ServerStart.cpp index f24b12d24d..93988b3710 100644 --- a/src/openrct2-ui/windows/ServerStart.cpp +++ b/src/openrct2-ui/windows/ServerStart.cpp @@ -9,17 +9,17 @@ #ifndef DISABLE_NETWORK -# include "../interface/Theme.h" + #include "../interface/Theme.h" -# include -# include -# include -# include -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include + #include + #include + #include + #include namespace OpenRCT2::Ui::Windows { diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index 4f2684257b..7ba3a94b47 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -8,8 +8,8 @@ *****************************************************************************/ #ifdef __EMSCRIPTEN__ -# include -# include + #include + #include #endif // __EMSCRIPTEN__ #include "AssetPackManager.h" diff --git a/src/openrct2/Diagnostic.cpp b/src/openrct2/Diagnostic.cpp index 93f757e018..33666bf974 100644 --- a/src/openrct2/Diagnostic.cpp +++ b/src/openrct2/Diagnostic.cpp @@ -17,7 +17,7 @@ #include #ifdef __ANDROID__ -# include + #include #endif using namespace OpenRCT2; diff --git a/src/openrct2/Diagnostic.h b/src/openrct2/Diagnostic.h index 1181d00b06..734085874f 100644 --- a/src/openrct2/Diagnostic.h +++ b/src/openrct2/Diagnostic.h @@ -44,28 +44,28 @@ enum class DiagnosticLevel */ #if defined(DEBUG) -# if DEBUG > 0 -# define DEBUG_LEVEL_1 1 -# if DEBUG > 1 -# define DEBUG_LEVEL_2 1 -# if DEBUG > 2 -# define DEBUG_LEVEL_3 1 -# else -# define DEBUG_LEVEL_3 0 -# endif // DEBUG > 2 -# else -# define DEBUG_LEVEL_3 0 -# define DEBUG_LEVEL_2 0 -# endif // DEBUG > 1 -# else -# define DEBUG_LEVEL_1 0 -# define DEBUG_LEVEL_2 0 -# define DEBUG_LEVEL_3 0 -# endif // DEBUG > 0 + #if DEBUG > 0 + #define DEBUG_LEVEL_1 1 + #if DEBUG > 1 + #define DEBUG_LEVEL_2 1 + #if DEBUG > 2 + #define DEBUG_LEVEL_3 1 + #else + #define DEBUG_LEVEL_3 0 + #endif // DEBUG > 2 + #else + #define DEBUG_LEVEL_3 0 + #define DEBUG_LEVEL_2 0 + #endif // DEBUG > 1 + #else + #define DEBUG_LEVEL_1 0 + #define DEBUG_LEVEL_2 0 + #define DEBUG_LEVEL_3 0 + #endif // DEBUG > 0 #else -# define DEBUG_LEVEL_3 0 -# define DEBUG_LEVEL_2 0 -# define DEBUG_LEVEL_1 0 + #define DEBUG_LEVEL_3 0 + #define DEBUG_LEVEL_2 0 + #define DEBUG_LEVEL_1 0 #endif // defined(DEBUG) extern bool _log_levels[static_cast(DiagnosticLevel::Count)]; @@ -75,10 +75,10 @@ void DiagnosticLogWithLocation( DiagnosticLevel diagnosticLevel, const char* file, const char* function, int32_t line, const char* format, ...); #ifdef _MSC_VER -# define DIAGNOSTIC_LOG_MACRO(level, format, ...) \ + #define DIAGNOSTIC_LOG_MACRO(level, format, ...) \ DiagnosticLogWithLocation(level, __FILE__, __FUNCTION__, __LINE__, format, ##__VA_ARGS__) #else -# define DIAGNOSTIC_LOG_MACRO(level, format, ...) \ + #define DIAGNOSTIC_LOG_MACRO(level, format, ...) \ DiagnosticLogWithLocation(level, __FILE__, __func__, __LINE__, format, ##__VA_ARGS__) #endif // _MSC_VER diff --git a/src/openrct2/Version.cpp b/src/openrct2/Version.cpp index 0b1863e608..ee76fdd1ea 100644 --- a/src/openrct2/Version.cpp +++ b/src/openrct2/Version.cpp @@ -19,7 +19,7 @@ using namespace OpenRCT2; #ifdef OPENRCT2_BUILD_INFO_HEADER -# include OPENRCT2_BUILD_INFO_HEADER + #include OPENRCT2_BUILD_INFO_HEADER #endif const char gVersionInfoTag[] = @@ -38,16 +38,16 @@ const char gVersionInfoFull[] = OPENRCT2_NAME ", " #endif #if defined(OPENRCT2_BRANCH) || defined(OPENRCT2_COMMIT_SHA1_SHORT) || !defined(NDEBUG) " (" -# if defined(OPENRCT2_BRANCH) && defined(OPENRCT2_COMMIT_SHA1_SHORT) + #if defined(OPENRCT2_BRANCH) && defined(OPENRCT2_COMMIT_SHA1_SHORT) OPENRCT2_COMMIT_SHA1_SHORT " on " OPENRCT2_BRANCH -# elif defined(OPENRCT2_COMMIT_SHA1_SHORT) + #elif defined(OPENRCT2_COMMIT_SHA1_SHORT) OPENRCT2_COMMIT_SHA1_SHORT -# elif defined(OPENRCT2_BRANCH) + #elif defined(OPENRCT2_BRANCH) OPENRCT2_BRANCH -# endif -# ifndef NDEBUG + #endif + #ifndef NDEBUG ", DEBUG" -# endif + #endif ")" #endif #ifdef OPENRCT2_BUILD_SERVER diff --git a/src/openrct2/Version.h b/src/openrct2/Version.h index f9da61cfb7..a44b865e70 100644 --- a/src/openrct2/Version.h +++ b/src/openrct2/Version.h @@ -15,61 +15,61 @@ #define OPENRCT2_VERSION "0.4.16" #if defined(__amd64__) || defined(_M_AMD64) -# define OPENRCT2_ARCHITECTURE "x86-64" + #define OPENRCT2_ARCHITECTURE "x86-64" #elif defined(__i386__) || defined(_M_IX86) -# define OPENRCT2_ARCHITECTURE "x86" + #define OPENRCT2_ARCHITECTURE "x86" #elif defined(__aarch64__) || defined(_M_ARM64) -# define OPENRCT2_ARCHITECTURE "AArch64" + #define OPENRCT2_ARCHITECTURE "AArch64" #elif defined(__arm__) || defined(_M_ARM) -# if defined(__ARM_ARCH_7A__) -# define OPENRCT2_ARCHITECTURE "arm-v7a" -# else -# define OPENRCT2_ARCHITECTURE "arm" -# endif + #if defined(__ARM_ARCH_7A__) + #define OPENRCT2_ARCHITECTURE "arm-v7a" + #else + #define OPENRCT2_ARCHITECTURE "arm" + #endif #elif defined(__powerpc__) || defined(_M_PPC) -# define OPENRCT2_ARCHITECTURE "PowerPC" + #define OPENRCT2_ARCHITECTURE "PowerPC" #elif defined(__mips64) -# define OPENRCT2_ARCHITECTURE "mips64" + #define OPENRCT2_ARCHITECTURE "mips64" #elif defined(__mips__) -# define OPENRCT2_ARCHITECTURE "mips" + #define OPENRCT2_ARCHITECTURE "mips" #elif defined(__riscv) -# define OPENRCT2_ARCHITECTURE "RISC-V" + #define OPENRCT2_ARCHITECTURE "RISC-V" #endif #ifdef __EMSCRIPTEN__ -# define OPENRCT2_ARCHITECTURE "Emscripten" + #define OPENRCT2_ARCHITECTURE "Emscripten" #endif #ifndef OPENRCT2_ARCHITECTURE -# error "OPENRCT2_ARCHITECTURE is undefined. Please add identification." + #error "OPENRCT2_ARCHITECTURE is undefined. Please add identification." #endif // Platform #ifdef _WIN32 -# define OPENRCT2_PLATFORM "Windows" + #define OPENRCT2_PLATFORM "Windows" #endif #if defined(__linux__) && !defined(__ANDROID__) -# define OPENRCT2_PLATFORM "Linux" + #define OPENRCT2_PLATFORM "Linux" #endif #if (defined(__APPLE__) && defined(__MACH__)) -# define OPENRCT2_PLATFORM "macOS" + #define OPENRCT2_PLATFORM "macOS" #endif #ifdef __FreeBSD__ -# define OPENRCT2_PLATFORM "FreeBSD" + #define OPENRCT2_PLATFORM "FreeBSD" #endif #ifdef __NetBSD__ -# define OPENRCT2_PLATFORM "NetBSD" + #define OPENRCT2_PLATFORM "NetBSD" #endif #ifdef __ANDROID__ -# define OPENRCT2_PLATFORM "Android" + #define OPENRCT2_PLATFORM "Android" #endif #ifdef __OpenBSD__ -# define OPENRCT2_PLATFORM "OpenBSD" + #define OPENRCT2_PLATFORM "OpenBSD" #endif #ifdef __EMSCRIPTEN__ -# define OPENRCT2_PLATFORM "Emscripten" + #define OPENRCT2_PLATFORM "Emscripten" #endif #ifndef OPENRCT2_PLATFORM -# error Unknown platform! + #error Unknown platform! #endif extern const char gVersionInfoFull[]; diff --git a/src/openrct2/actions/CustomAction.cpp b/src/openrct2/actions/CustomAction.cpp index 922bf8ab67..d6eaaea72b 100644 --- a/src/openrct2/actions/CustomAction.cpp +++ b/src/openrct2/actions/CustomAction.cpp @@ -8,10 +8,10 @@ *****************************************************************************/ #ifdef ENABLE_SCRIPTING -# include "CustomAction.h" + #include "CustomAction.h" -# include "../Context.h" -# include "../scripting/ScriptEngine.h" + #include "../Context.h" + #include "../scripting/ScriptEngine.h" using namespace OpenRCT2; diff --git a/src/openrct2/actions/CustomAction.h b/src/openrct2/actions/CustomAction.h index eb44d92d5e..8011b1d333 100644 --- a/src/openrct2/actions/CustomAction.h +++ b/src/openrct2/actions/CustomAction.h @@ -11,7 +11,7 @@ #ifdef ENABLE_SCRIPTING -# include "GameAction.h" + #include "GameAction.h" class CustomAction final : public GameActionBase { diff --git a/src/openrct2/actions/GameAction.h b/src/openrct2/actions/GameAction.h index 753f0e9220..4e827c2e42 100644 --- a/src/openrct2/actions/GameAction.h +++ b/src/openrct2/actions/GameAction.h @@ -33,9 +33,9 @@ namespace OpenRCT2::GameActions } // namespace OpenRCT2::GameActions #ifdef __WARN_SUGGEST_FINAL_METHODS__ -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wsuggest-final-methods" -# pragma GCC diagnostic ignored "-Wsuggest-final-types" + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wsuggest-final-methods" + #pragma GCC diagnostic ignored "-Wsuggest-final-types" #endif /** @@ -247,7 +247,7 @@ public: }; #ifdef __WARN_SUGGEST_FINAL_METHODS__ -# pragma GCC diagnostic pop + #pragma GCC diagnostic pop #endif template diff --git a/src/openrct2/command_line/RootCommands.cpp b/src/openrct2/command_line/RootCommands.cpp index 3fe044d43d..4902c2bae6 100644 --- a/src/openrct2/command_line/RootCommands.cpp +++ b/src/openrct2/command_line/RootCommands.cpp @@ -34,9 +34,9 @@ using namespace OpenRCT2; #ifdef USE_BREAKPAD -# define IMPLIES_SILENT_BREAKPAD ", implies --silent-breakpad" + #define IMPLIES_SILENT_BREAKPAD ", implies --silent-breakpad" #else -# define IMPLIES_SILENT_BREAKPAD + #define IMPLIES_SILENT_BREAKPAD #endif // USE_BREAKPAD #ifndef DISABLE_NETWORK diff --git a/src/openrct2/config/Config.h b/src/openrct2/config/Config.h index 679dc1d179..cd73947db1 100644 --- a/src/openrct2/config/Config.h +++ b/src/openrct2/config/Config.h @@ -17,7 +17,7 @@ // windows.h defines an interface keyword #ifdef interface -# undef interface + #undef interface #endif namespace OpenRCT2::Config diff --git a/src/openrct2/core/CallingConventions.h b/src/openrct2/core/CallingConventions.h index 5d0646b087..65247d5f7e 100644 --- a/src/openrct2/core/CallingConventions.h +++ b/src/openrct2/core/CallingConventions.h @@ -10,19 +10,19 @@ #pragma once #if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) -# define OPENRCT2_X86 + #define OPENRCT2_X86 #elif defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_X64) || defined(_M_IX86)) // VS2008 -# define OPENRCT2_X86 + #define OPENRCT2_X86 #endif #if defined(__i386__) || defined(_M_IX86) -# define PLATFORM_X86 + #define PLATFORM_X86 #endif #if defined(__LP64__) || defined(_WIN64) -# define PLATFORM_64BIT + #define PLATFORM_64BIT #else -# define PLATFORM_32BIT + #define PLATFORM_32BIT #endif // C99's restrict keywords guarantees the pointer in question, for the whole of its lifetime, @@ -30,22 +30,22 @@ // aliasing the same memory area. Using it lets compiler generate better code. If your compiler // does not support it, feel free to drop it, at some performance hit. #ifdef _MSC_VER -# define RESTRICT __restrict + #define RESTRICT __restrict #else -# define RESTRICT __restrict__ + #define RESTRICT __restrict__ #endif #ifdef PLATFORM_X86 -# ifndef FASTCALL -# ifdef __GNUC__ -# define FASTCALL __attribute__((fastcall)) -# elif defined(_MSC_VER) -# define FASTCALL __fastcall -# else -# pragma message "Not using fastcall calling convention, please check your compiler support" -# define FASTCALL -# endif -# endif // FASTCALL + #ifndef FASTCALL + #ifdef __GNUC__ + #define FASTCALL __attribute__((fastcall)) + #elif defined(_MSC_VER) + #define FASTCALL __fastcall + #else + #pragma message "Not using fastcall calling convention, please check your compiler support" + #define FASTCALL + #endif + #endif // FASTCALL #else // PLATFORM_X86 -# define FASTCALL + #define FASTCALL #endif // PLATFORM_X86 diff --git a/src/openrct2/core/ChecksumStream.cpp b/src/openrct2/core/ChecksumStream.cpp index 2017b11e89..5944b6b019 100644 --- a/src/openrct2/core/ChecksumStream.cpp +++ b/src/openrct2/core/ChecksumStream.cpp @@ -34,9 +34,9 @@ namespace OpenRCT2 std::memcpy(&temp, reinterpret_cast(buffer) + i, maxLen); // Always use value as little endian, most common systems are little. -# if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) + #if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) temp = ByteSwapBE(temp); -# endif + #endif *hash ^= temp; *hash *= Prime; diff --git a/src/openrct2/core/Crypt.CNG.cpp b/src/openrct2/core/Crypt.CNG.cpp index 7622668364..e874476889 100644 --- a/src/openrct2/core/Crypt.CNG.cpp +++ b/src/openrct2/core/Crypt.CNG.cpp @@ -9,19 +9,19 @@ #if !defined(DISABLE_NETWORK) && defined(_WIN32) -# include "Crypt.h" + #include "Crypt.h" -# include "../platform/Platform.h" -# include "IStream.hpp" + #include "../platform/Platform.h" + #include "IStream.hpp" -# include -# include -# include -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include + #include + #include + #include // clang-format off // CNG: Cryptography API: Next Generation (CNG) diff --git a/src/openrct2/core/Crypt.OpenSSL.cpp b/src/openrct2/core/Crypt.OpenSSL.cpp index 08821c9137..12834a889e 100644 --- a/src/openrct2/core/Crypt.OpenSSL.cpp +++ b/src/openrct2/core/Crypt.OpenSSL.cpp @@ -9,16 +9,16 @@ #if !defined(DISABLE_NETWORK) && !defined(_WIN32) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdeprecated-declarations" -# include "Crypt.h" + #include "Crypt.h" -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include using namespace OpenRCT2::Crypt; @@ -354,6 +354,6 @@ namespace OpenRCT2::Crypt } } // namespace OpenRCT2::Crypt -# pragma GCC diagnostic pop + #pragma GCC diagnostic pop #endif // DISABLE_NETWORK diff --git a/src/openrct2/core/DateTime.h b/src/openrct2/core/DateTime.h index 287c1c4a91..a5ff640a79 100644 --- a/src/openrct2/core/DateTime.h +++ b/src/openrct2/core/DateTime.h @@ -10,7 +10,7 @@ #pragma once #ifdef _MSC_VER -# include + #include #endif #include diff --git a/src/openrct2/core/Diagnostics.cpp b/src/openrct2/core/Diagnostics.cpp index 91a8e1f1af..74691744b7 100644 --- a/src/openrct2/core/Diagnostics.cpp +++ b/src/openrct2/core/Diagnostics.cpp @@ -8,7 +8,7 @@ *****************************************************************************/ #if defined(DEBUG) && defined(_WIN32) -# include + #include #endif #include "Diagnostics.hpp" @@ -18,12 +18,12 @@ namespace OpenRCT2::Debug void Break() { #if defined(DEBUG) -# if defined(_WIN32) + #if defined(_WIN32) if (IsDebuggerPresent()) { DebugBreak(); } -# endif + #endif #endif } } // namespace OpenRCT2::Debug diff --git a/src/openrct2/core/File.cpp b/src/openrct2/core/File.cpp index 11c9705284..dcd5fb4a30 100644 --- a/src/openrct2/core/File.cpp +++ b/src/openrct2/core/File.cpp @@ -8,9 +8,9 @@ *****************************************************************************/ #ifdef _WIN32 -# include + #include #else -# include + #include #endif #include "../Diagnostic.h" diff --git a/src/openrct2/core/FileScanner.cpp b/src/openrct2/core/FileScanner.cpp index 84c83253a7..321babd957 100644 --- a/src/openrct2/core/FileScanner.cpp +++ b/src/openrct2/core/FileScanner.cpp @@ -8,17 +8,17 @@ *****************************************************************************/ #ifdef _WIN32 -# include + #include #endif #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) -# include -# include -# include -# include + #include + #include + #include + #include #elif defined(_WIN32) -// Windows needs this for widechar <-> utf8 conversion utils -# include "../localisation/Language.h" + // Windows needs this for widechar <-> utf8 conversion utils + #include "../localisation/Language.h" #endif #include "FileScanner.h" diff --git a/src/openrct2/core/FileStream.cpp b/src/openrct2/core/FileStream.cpp index ea82218932..25eb5a5793 100644 --- a/src/openrct2/core/FileStream.cpp +++ b/src/openrct2/core/FileStream.cpp @@ -15,14 +15,14 @@ #include #ifndef _WIN32 -# include + #include #else -# include + #include #endif #ifdef _MSC_VER -# define ftello _ftelli64 -# define fseeko _fseeki64 + #define ftello _ftelli64 + #define fseeko _fseeki64 #endif namespace OpenRCT2 diff --git a/src/openrct2/core/FileSystem.hpp b/src/openrct2/core/FileSystem.hpp index 5c750ab6be..2e1bd7571f 100644 --- a/src/openrct2/core/FileSystem.hpp +++ b/src/openrct2/core/FileSystem.hpp @@ -16,43 +16,43 @@ // Find out if std::filesystem is available: #if defined(_MSC_VER) // Visual Studio supports -# define HAVE_STD_FILESYSTEM 1 + #define HAVE_STD_FILESYSTEM 1 #elif defined(__APPLE__) // XCode has the header, but reports error when included. -# define HAVE_STD_FILESYSTEM 0 + #define HAVE_STD_FILESYSTEM 0 #elif defined(__ANDROID__) -# define HAVE_STD_FILESYSTEM 1 + #define HAVE_STD_FILESYSTEM 1 #elif defined(__has_include) // For GCC/Clang check if the header exists. -# if __has_include() -# define HAVE_STD_FILESYSTEM 1 -# else -# define HAVE_STD_FILESYSTEM 0 -# endif + #if __has_include() + #define HAVE_STD_FILESYSTEM 1 + #else + #define HAVE_STD_FILESYSTEM 0 + #endif #else // By default assume not supported. -# define HAVE_STD_FILESYSTEM 0 + #define HAVE_STD_FILESYSTEM 0 #endif #if HAVE_STD_FILESYSTEM -# include + #include namespace fs = std::filesystem; #else -# ifdef _WIN32 -# ifndef NOMINMAX -# define NOMINMAX -# endif -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# define BITMAP WIN32_BITMAP -# define PATTERN WIN32_PATTERN -# endif -# include -# ifdef _WIN32 -# undef CreateDirectory -# undef CreateWindow -# undef GetMessage -# undef BITMAP -# undef PATTERN -# endif + #ifdef _WIN32 + #ifndef NOMINMAX + #define NOMINMAX + #endif + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif + #define BITMAP WIN32_BITMAP + #define PATTERN WIN32_PATTERN + #endif + #include + #ifdef _WIN32 + #undef CreateDirectory + #undef CreateWindow + #undef GetMessage + #undef BITMAP + #undef PATTERN + #endif namespace fs = ghc::filesystem; #endif diff --git a/src/openrct2/core/FileWatcher.cpp b/src/openrct2/core/FileWatcher.cpp index 42b5c7e47e..f1de739d8c 100644 --- a/src/openrct2/core/FileWatcher.cpp +++ b/src/openrct2/core/FileWatcher.cpp @@ -15,14 +15,14 @@ #include #ifdef _WIN32 -# include + #include #elif defined(__linux__) -# include -# include -# include -# include + #include + #include + #include + #include #elif defined(__APPLE__) -# include + #include #endif #include "../core/Guard.hpp" diff --git a/src/openrct2/core/FileWatcher.h b/src/openrct2/core/FileWatcher.h index a5539d3fcf..9c5848211e 100644 --- a/src/openrct2/core/FileWatcher.h +++ b/src/openrct2/core/FileWatcher.h @@ -17,11 +17,11 @@ #include #ifdef _WIN32 -# include "FileSystem.hpp" + #include "FileSystem.hpp" typedef void* HANDLE; #elif defined(__APPLE__) -# include + #include #endif /** diff --git a/src/openrct2/core/Guard.cpp b/src/openrct2/core/Guard.cpp index f17037c4e8..d50358c20b 100644 --- a/src/openrct2/core/Guard.cpp +++ b/src/openrct2/core/Guard.cpp @@ -8,8 +8,8 @@ *****************************************************************************/ #ifdef _WIN32 -# include -# include + #include + #include #endif #include "../Version.h" @@ -144,12 +144,12 @@ namespace OpenRCT2::Guard static void ForceCrash() { -# ifdef USE_BREAKPAD + #ifdef USE_BREAKPAD // Force a crash that breakpad will handle allowing us to get a dump *((void**)0) = 0; -# else + #else assert(false); -# endif + #endif } #endif } // namespace OpenRCT2::Guard diff --git a/src/openrct2/core/Http.Android.cpp b/src/openrct2/core/Http.Android.cpp index 3f4a478819..73277f64f7 100644 --- a/src/openrct2/core/Http.Android.cpp +++ b/src/openrct2/core/Http.Android.cpp @@ -9,16 +9,16 @@ #if !defined(DISABLE_HTTP) && defined(__ANDROID__) -# include "Http.h" + #include "Http.h" -# include "../Version.h" -# include "../platform/Platform.h" + #include "../Version.h" + #include "../platform/Platform.h" -# include -# include -# include + #include + #include + #include -# define OPENRCT2_USER_AGENT "OpenRCT2/" OPENRCT2_VERSION + #define OPENRCT2_USER_AGENT "OpenRCT2/" OPENRCT2_VERSION namespace OpenRCT2::Http { diff --git a/src/openrct2/core/Http.WinHttp.cpp b/src/openrct2/core/Http.WinHttp.cpp index b75c3ce2cd..b2a7c37d35 100644 --- a/src/openrct2/core/Http.WinHttp.cpp +++ b/src/openrct2/core/Http.WinHttp.cpp @@ -9,16 +9,16 @@ #if !defined(DISABLE_HTTP) && defined(_WIN32) -# include "Http.h" + #include "Http.h" -# include "../Version.h" -# include "../core/Console.hpp" -# include "String.hpp" + #include "../Version.h" + #include "../core/Console.hpp" + #include "String.hpp" -# include -# include -# include -# include + #include + #include + #include + #include namespace OpenRCT2::Http { @@ -226,9 +226,9 @@ namespace OpenRCT2::Http } catch ([[maybe_unused]] const std::exception& e) { -# ifdef DEBUG + #ifdef DEBUG Console::Error::WriteLine("HTTP request failed: %s", e.what()); -# endif + #endif WinHttpCloseHandle(hSession); WinHttpCloseHandle(hConnect); WinHttpCloseHandle(hRequest); diff --git a/src/openrct2/core/Http.cURL.cpp b/src/openrct2/core/Http.cURL.cpp index 11cf9e5f8b..207edefce0 100644 --- a/src/openrct2/core/Http.cURL.cpp +++ b/src/openrct2/core/Http.cURL.cpp @@ -9,23 +9,23 @@ #if !defined(DISABLE_HTTP) && !defined(_WIN32) && !defined(__ANDROID__) -# include "Http.h" + #include "Http.h" -# include "../Version.h" -# include "../core/Console.hpp" + #include "../Version.h" + #include "../core/Console.hpp" -# include -# include -# include -# include + #include + #include + #include + #include -# if defined(_WIN32) && !defined(WIN32_LEAN_AND_MEAN) -// cURL includes windows.h, but we don't need all of it. -# define WIN32_LEAN_AND_MEAN -# endif -# include + #if defined(_WIN32) && !defined(WIN32_LEAN_AND_MEAN) + // cURL includes windows.h, but we don't need all of it. + #define WIN32_LEAN_AND_MEAN + #endif + #include -# define OPENRCT2_USER_AGENT "OpenRCT2/" OPENRCT2_VERSION + #define OPENRCT2_USER_AGENT "OpenRCT2/" OPENRCT2_VERSION namespace OpenRCT2::Http { diff --git a/src/openrct2/core/Http.h b/src/openrct2/core/Http.h index 7c03f88bdf..c53987897e 100644 --- a/src/openrct2/core/Http.h +++ b/src/openrct2/core/Http.h @@ -11,10 +11,10 @@ #ifndef DISABLE_HTTP -# include -# include -# include -# include + #include + #include + #include + #include namespace OpenRCT2::Http { diff --git a/src/openrct2/core/IStream.hpp b/src/openrct2/core/IStream.hpp index 9d08e2afe8..263676f8ba 100644 --- a/src/openrct2/core/IStream.hpp +++ b/src/openrct2/core/IStream.hpp @@ -19,9 +19,9 @@ #include #ifdef __WARN_SUGGEST_FINAL_METHODS__ -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wsuggest-final-methods" -# pragma GCC diagnostic ignored "-Wsuggest-final-types" + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wsuggest-final-methods" + #pragma GCC diagnostic ignored "-Wsuggest-final-types" #endif namespace OpenRCT2 @@ -218,7 +218,7 @@ namespace OpenRCT2 } // namespace OpenRCT2 #ifdef __WARN_SUGGEST_FINAL_METHODS__ -# pragma GCC diagnostic pop + #pragma GCC diagnostic pop #endif class IOException : public std::runtime_error diff --git a/src/openrct2/core/Json.hpp b/src/openrct2/core/Json.hpp index 43490d1c1c..5d205ba980 100644 --- a/src/openrct2/core/Json.hpp +++ b/src/openrct2/core/Json.hpp @@ -16,7 +16,7 @@ #include #if NLOHMANN_JSON_VERSION_MAJOR < 3 || (NLOHMANN_JSON_VERSION_MAJOR == 3 && NLOHMANN_JSON_VERSION_MINOR < 9) -# error "Unsupported version of nlohmann json library, must be >= 3.9" + #error "Unsupported version of nlohmann json library, must be >= 3.9" #endif // NLOHMANN_JSON_VERSION_MAJOR < 3 || (NLOHMANN_JSON_VERSION_MAJOR == 3 && NLOHMANN_JSON_VERSION_MINOR < 9) using json_t = nlohmann::json; diff --git a/src/openrct2/core/Numerics.hpp b/src/openrct2/core/Numerics.hpp index 23ac49ef68..6eac9b37b6 100644 --- a/src/openrct2/core/Numerics.hpp +++ b/src/openrct2/core/Numerics.hpp @@ -15,7 +15,7 @@ #include #ifdef _MSC_VER -# include + #include #endif namespace OpenRCT2::Numerics @@ -30,7 +30,7 @@ namespace OpenRCT2::Numerics int32_t success = __builtin_ffs(source); return success - 1; #else -# pragma message("Falling back to iterative bitscan32 forward, consider using intrinsics") + #pragma message("Falling back to iterative bitscan32 forward, consider using intrinsics") // This is a low-hanging optimisation boost, check if your compiler offers // any intrinsic. // cf. https://github.com/OpenRCT2/OpenRCT2/pull/2093 @@ -52,7 +52,7 @@ namespace OpenRCT2::Numerics int32_t success = __builtin_ffsll(source); return success - 1; #else -# pragma message("Falling back to iterative bitscan64 forward, consider using intrinsics") + #pragma message("Falling back to iterative bitscan64 forward, consider using intrinsics") // This is a low-hanging optimisation boost, check if your compiler offers // any intrinsic. // cf. https://github.com/OpenRCT2/OpenRCT2/pull/2093 diff --git a/src/openrct2/core/RTL.FriBidi.cpp b/src/openrct2/core/RTL.FriBidi.cpp index 44b83b5b8a..614af97595 100644 --- a/src/openrct2/core/RTL.FriBidi.cpp +++ b/src/openrct2/core/RTL.FriBidi.cpp @@ -8,17 +8,17 @@ *****************************************************************************/ #if defined(_WIN32) && defined(USE_FRIBIDI) -# include "RTL.h" + #include "RTL.h" -# include "../Diagnostic.h" + #include "../Diagnostic.h" -# include + #include extern "C" { -# include -# include -# include -# include + #include + #include + #include + #include } static constexpr uint16_t BufferLength = 1024; @@ -50,10 +50,10 @@ std::string FixRTL(std::string& input) return std::string(outputString); } #elif defined(_WIN32) -# include "../Diagnostic.h" -# include "RTL.h" + #include "../Diagnostic.h" + #include "RTL.h" -# include + #include static bool hasWarned = false; diff --git a/src/openrct2/core/RTL.ICU.cpp b/src/openrct2/core/RTL.ICU.cpp index 1c817d0216..03e69519cf 100644 --- a/src/openrct2/core/RTL.ICU.cpp +++ b/src/openrct2/core/RTL.ICU.cpp @@ -8,16 +8,16 @@ *****************************************************************************/ #ifndef _WIN32 -# include "RTL.h" + #include "RTL.h" -# include -# include -# include -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include + #include + #include + #include std::string FixRTL(std::string& input) { diff --git a/src/openrct2/core/String.cpp b/src/openrct2/core/String.cpp index b0b09dca5b..d0a57c094f 100644 --- a/src/openrct2/core/String.cpp +++ b/src/openrct2/core/String.cpp @@ -17,14 +17,14 @@ #include #ifndef _WIN32 -# if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) -# include -# endif -# include -# include -# include + #if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) + #include + #endif + #include + #include + #include #else -# include + #include #endif #include "../util/Util.h" @@ -34,8 +34,8 @@ #include "UTF8.h" #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) -# include -# define _stricmp(x, y) strcasecmp((x), (y)) + #include + #define _stricmp(x, y) strcasecmp((x), (y)) #endif namespace OpenRCT2::String @@ -57,17 +57,17 @@ namespace OpenRCT2::String WideCharToMultiByte(OpenRCT2::CodePage::UTF8, 0, src.data(), srcLen, result.data(), sizeReq, nullptr, nullptr); return result; #else -// Which constructor to use depends on the size of wchar_t... -// UTF-32 is the default on most POSIX systems; Windows uses UTF-16. -// Unfortunately, we'll have to help the compiler here. -# if U_SIZEOF_WCHAR_T == 4 + // Which constructor to use depends on the size of wchar_t... + // UTF-32 is the default on most POSIX systems; Windows uses UTF-16. + // Unfortunately, we'll have to help the compiler here. + #if U_SIZEOF_WCHAR_T == 4 icu::UnicodeString str = icu::UnicodeString::fromUTF32(reinterpret_cast(src.data()), src.length()); -# elif U_SIZEOF_WCHAR_T == 2 + #elif U_SIZEOF_WCHAR_T == 2 std::wstring wstr = std::wstring(src); icu::UnicodeString str = icu::UnicodeString(static_cast(wstr.c_str())); -# else -# error Unsupported U_SIZEOF_WCHAR_T size -# endif + #else + #error Unsupported U_SIZEOF_WCHAR_T size + #endif std::string result; str.toUTF8String(result); @@ -87,23 +87,23 @@ namespace OpenRCT2::String #else icu::UnicodeString str = icu::UnicodeString::fromUTF8(std::string(src)); -// Which constructor to use depends on the size of wchar_t... -// UTF-32 is the default on most POSIX systems; Windows uses UTF-16. -// Unfortunately, we'll have to help the compiler here. -# if U_SIZEOF_WCHAR_T == 4 + // Which constructor to use depends on the size of wchar_t... + // UTF-32 is the default on most POSIX systems; Windows uses UTF-16. + // Unfortunately, we'll have to help the compiler here. + #if U_SIZEOF_WCHAR_T == 4 size_t length = static_cast(str.length()); std::wstring result(length, '\0'); UErrorCode status = U_ZERO_ERROR; str.toUTF32(reinterpret_cast(&result[0]), str.length(), status); -# elif U_SIZEOF_WCHAR_T == 2 + #elif U_SIZEOF_WCHAR_T == 2 const char16_t* buffer = str.getBuffer(); std::wstring result = static_cast(buffer); -# else -# error Unsupported U_SIZEOF_WCHAR_T size -# endif + #else + #error Unsupported U_SIZEOF_WCHAR_T size + #endif return result; #endif diff --git a/src/openrct2/core/Zip.cpp b/src/openrct2/core/Zip.cpp index c2b930b2ae..3e00d342fc 100644 --- a/src/openrct2/core/Zip.cpp +++ b/src/openrct2/core/Zip.cpp @@ -12,7 +12,7 @@ #include "IStream.hpp" #ifndef __ANDROID__ -# include + #include #endif using namespace OpenRCT2; diff --git a/src/openrct2/core/ZipAndroid.cpp b/src/openrct2/core/ZipAndroid.cpp index a57d34293d..5d669f7dbf 100644 --- a/src/openrct2/core/ZipAndroid.cpp +++ b/src/openrct2/core/ZipAndroid.cpp @@ -9,16 +9,16 @@ #ifdef __ANDROID__ -# include "../Diagnostic.h" -# include "../platform/Platform.h" -# include "IStream.hpp" -# include "Memory.hpp" -# include "MemoryStream.h" -# include "Zip.h" + #include "../Diagnostic.h" + #include "../platform/Platform.h" + #include "IStream.hpp" + #include "Memory.hpp" + #include "MemoryStream.h" + #include "Zip.h" -# include -# include -# include + #include + #include + #include using namespace OpenRCT2; diff --git a/src/openrct2/drawing/AVX2Drawing.cpp b/src/openrct2/drawing/AVX2Drawing.cpp index aea86a804b..70f7a6dd6f 100644 --- a/src/openrct2/drawing/AVX2Drawing.cpp +++ b/src/openrct2/drawing/AVX2Drawing.cpp @@ -12,7 +12,7 @@ #ifdef __AVX2__ -# include + #include void MaskAvx2( int32_t width, int32_t height, const uint8_t* RESTRICT maskSrc, const uint8_t* RESTRICT colourSrc, uint8_t* RESTRICT dst, @@ -43,9 +43,9 @@ void MaskAvx2( #else -# ifdef OPENRCT2_X86 -# error You have to compile this file with AVX2 enabled, when targeting x86! -# endif + #ifdef OPENRCT2_X86 + #error You have to compile this file with AVX2 enabled, when targeting x86! + #endif void MaskAvx2( int32_t width, int32_t height, const uint8_t* RESTRICT maskSrc, const uint8_t* RESTRICT colourSrc, uint8_t* RESTRICT dst, diff --git a/src/openrct2/drawing/Drawing.String.cpp b/src/openrct2/drawing/Drawing.String.cpp index 74db073471..d8a5616aad 100644 --- a/src/openrct2/drawing/Drawing.String.cpp +++ b/src/openrct2/drawing/Drawing.String.cpp @@ -674,15 +674,15 @@ static void TTFProcessStringLiteral(DrawPixelInfo& dpi, std::string_view text, T // This error suppression abomination is here to suppress https://github.com/OpenRCT2/OpenRCT2/issues/17371. // Additionally, we have to suppress the error for the error suppression... :'-( // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105937 is fixed in GCC13 -# if defined(__GNUC__) && !defined(__clang__) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -# endif + #if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" + #endif auto len = it.GetIndex() - ttfRunIndex.value(); TTFDrawStringRawTTF(dpi, text.substr(ttfRunIndex.value(), len), info); -# if defined(__GNUC__) && !defined(__clang__) -# pragma GCC diagnostic pop -# endif + #if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic pop + #endif ttfRunIndex = std::nullopt; } diff --git a/src/openrct2/drawing/Image.cpp b/src/openrct2/drawing/Image.cpp index dab2c01e27..0044c0357f 100644 --- a/src/openrct2/drawing/Image.cpp +++ b/src/openrct2/drawing/Image.cpp @@ -31,11 +31,11 @@ static uint32_t _allocatedImageCount; #ifdef DEBUG_LEVEL_1 static std::list _allocatedLists; -// MSVC's compiler doesn't support the [[maybe_unused]] attribute for unused static functions. Until this has been resolved, we -// need to explicitly tell the compiler to temporarily disable the warning. -// See discussion at https://github.com/OpenRCT2/OpenRCT2/pull/7617 -# pragma warning(push) -# pragma warning(disable : 4505) // unreferenced local function has been removed + // MSVC's compiler doesn't support the [[maybe_unused]] attribute for unused static functions. Until this has been resolved, + // we need to explicitly tell the compiler to temporarily disable the warning. See discussion at + // https://github.com/OpenRCT2/OpenRCT2/pull/7617 + #pragma warning(push) + #pragma warning(disable : 4505) // unreferenced local function has been removed [[maybe_unused]] static bool AllocatedListContains(uint32_t baseImageId, uint32_t count) { @@ -46,7 +46,7 @@ static std::list _allocatedLists; return contains; } -# pragma warning(pop) + #pragma warning(pop) static bool AllocatedListRemove(uint32_t baseImageId, uint32_t count) { diff --git a/src/openrct2/drawing/SSE41Drawing.cpp b/src/openrct2/drawing/SSE41Drawing.cpp index 3177f81919..732506eb61 100644 --- a/src/openrct2/drawing/SSE41Drawing.cpp +++ b/src/openrct2/drawing/SSE41Drawing.cpp @@ -12,7 +12,7 @@ #ifdef __SSE4_1__ -# include + #include void MaskSse4_1( int32_t width, int32_t height, const uint8_t* RESTRICT maskSrc, const uint8_t* RESTRICT colourSrc, uint8_t* RESTRICT dst, @@ -57,9 +57,9 @@ void MaskSse4_1( #else -# ifdef OPENRCT2_X86 -# error You have to compile this file with SSE4.1 enabled, when targeting x86! -# endif + #ifdef OPENRCT2_X86 + #error You have to compile this file with SSE4.1 enabled, when targeting x86! + #endif void MaskSse4_1( int32_t width, int32_t height, const uint8_t* RESTRICT maskSrc, const uint8_t* RESTRICT colourSrc, uint8_t* RESTRICT dst, diff --git a/src/openrct2/drawing/TTF.cpp b/src/openrct2/drawing/TTF.cpp index 6b35dcd8e4..9e81a40d0f 100644 --- a/src/openrct2/drawing/TTF.cpp +++ b/src/openrct2/drawing/TTF.cpp @@ -9,24 +9,24 @@ #ifndef NO_TTF -# include "../Diagnostic.h" + #include "../Diagnostic.h" -# include -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wdocumentation" -# include -# include FT_FREETYPE_H -# pragma clang diagnostic pop + #include + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdocumentation" + #include + #include FT_FREETYPE_H + #pragma clang diagnostic pop -# include "../OpenRCT2.h" -# include "../core/Numerics.hpp" -# include "../core/String.hpp" -# include "../drawing/Font.h" -# include "../localisation/LocalisationService.h" -# include "../platform/Platform.h" -# include "../util/Util.h" -# include "DrawingLock.hpp" -# include "TTF.h" + #include "../OpenRCT2.h" + #include "../core/Numerics.hpp" + #include "../core/String.hpp" + #include "../drawing/Font.h" + #include "../localisation/LocalisationService.h" + #include "../platform/Platform.h" + #include "../util/Util.h" + #include "DrawingLock.hpp" + #include "TTF.h" using namespace OpenRCT2; @@ -360,7 +360,7 @@ void TTFFreeSurface(TTFSurface* surface) #else -# include "TTF.h" + #include "TTF.h" bool TTFInitialise() { diff --git a/src/openrct2/drawing/X8DrawingEngine.cpp b/src/openrct2/drawing/X8DrawingEngine.cpp index 57d7e6fc26..0e27671018 100644 --- a/src/openrct2/drawing/X8DrawingEngine.cpp +++ b/src/openrct2/drawing/X8DrawingEngine.cpp @@ -112,8 +112,8 @@ void X8WeatherDrawer::Restore(DrawPixelInfo& dpi) } #ifdef __WARN_SUGGEST_FINAL_METHODS__ -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wsuggest-final-methods" + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wsuggest-final-methods" #endif X8DrawingEngine::X8DrawingEngine([[maybe_unused]] const std::shared_ptr& uiContext) @@ -453,7 +453,7 @@ void X8DrawingEngine::DrawDirtyBlocks(uint32_t x, uint32_t y, uint32_t columns, } #ifdef __WARN_SUGGEST_FINAL_METHODS__ -# pragma GCC diagnostic pop + #pragma GCC diagnostic pop #endif X8DrawingContext::X8DrawingContext(X8DrawingEngine* engine) diff --git a/src/openrct2/drawing/X8DrawingEngine.h b/src/openrct2/drawing/X8DrawingEngine.h index 4a3ea69ee3..f8fb04d495 100644 --- a/src/openrct2/drawing/X8DrawingEngine.h +++ b/src/openrct2/drawing/X8DrawingEngine.h @@ -61,8 +61,8 @@ namespace OpenRCT2 }; #ifdef __WARN_SUGGEST_FINAL_TYPES__ -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wsuggest-final-types" + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wsuggest-final-types" #endif class X8DrawingEngine : public IDrawingEngine { @@ -86,13 +86,13 @@ namespace OpenRCT2 explicit X8DrawingEngine(const std::shared_ptr& uiContext); #ifdef __WARN_SUGGEST_FINAL_METHODS__ -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wsuggest-final-methods" -# pragma GCC diagnostic ignored "-Wsuggest-final-types" + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wsuggest-final-methods" + #pragma GCC diagnostic ignored "-Wsuggest-final-types" #endif ~X8DrawingEngine() override; #ifdef __WARN_SUGGEST_FINAL_METHODS__ -# pragma GCC diagnostic pop + #pragma GCC diagnostic pop #endif void Initialise() override; @@ -124,7 +124,7 @@ namespace OpenRCT2 void DrawDirtyBlocks(uint32_t x, uint32_t y, uint32_t columns, uint32_t rows); }; #ifdef __WARN_SUGGEST_FINAL_TYPES__ -# pragma GCC diagnostic pop + #pragma GCC diagnostic pop #endif class X8DrawingContext final : public IDrawingContext diff --git a/src/openrct2/interface/FontFamilies.h b/src/openrct2/interface/FontFamilies.h index cf22871f51..3932f9999f 100644 --- a/src/openrct2/interface/FontFamilies.h +++ b/src/openrct2/interface/FontFamilies.h @@ -15,7 +15,7 @@ constexpr std::nullptr_t kFamilyOpenRCT2Sprite = nullptr; #ifndef NO_TTF -# include + #include struct TTFFontSetDescriptor; @@ -27,10 +27,10 @@ extern TTFontFamily const TTFFamilyJapanese; extern TTFontFamily const TTFFamilyKorean; extern TTFontFamily const TTFFamilySansSerif; -# define FAMILY(x) x + #define FAMILY(x) x #else // NO_TTF -# define FAMILY(x) kFamilyOpenRCT2Sprite + #define FAMILY(x) kFamilyOpenRCT2Sprite #endif // NO_TTF diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index 67b5ed1930..1b4d2a787a 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -74,7 +74,7 @@ #include #ifndef NO_TTF -# include "../drawing/TTF.h" + #include "../drawing/TTF.h" #endif using namespace OpenRCT2; diff --git a/src/openrct2/interface/StdInOutConsole.cpp b/src/openrct2/interface/StdInOutConsole.cpp index 2909940bad..5db10847d3 100644 --- a/src/openrct2/interface/StdInOutConsole.cpp +++ b/src/openrct2/interface/StdInOutConsole.cpp @@ -19,7 +19,7 @@ // Ignore isatty warning on WIN32 #ifdef _MSC_VER -# pragma warning(disable : 4996) + #pragma warning(disable : 4996) #endif void StdInOutConsole::Start() diff --git a/src/openrct2/interface/Window_internal.h b/src/openrct2/interface/Window_internal.h index 7c204501ad..85db10a6bf 100644 --- a/src/openrct2/interface/Window_internal.h +++ b/src/openrct2/interface/Window_internal.h @@ -22,9 +22,9 @@ struct ResearchItem; struct RCTObjectEntry; #ifdef __WARN_SUGGEST_FINAL_METHODS__ -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wsuggest-final-methods" -# pragma GCC diagnostic ignored "-Wsuggest-final-types" + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wsuggest-final-methods" + #pragma GCC diagnostic ignored "-Wsuggest-final-types" #endif /** @@ -169,7 +169,7 @@ struct WindowBase }; #ifdef __WARN_SUGGEST_FINAL_METHODS__ -# pragma GCC diagnostic pop + #pragma GCC diagnostic pop #endif // rct2: 0x01420078 diff --git a/src/openrct2/network/DiscordService.cpp b/src/openrct2/network/DiscordService.cpp index 9599712e50..9699710362 100644 --- a/src/openrct2/network/DiscordService.cpp +++ b/src/openrct2/network/DiscordService.cpp @@ -8,21 +8,21 @@ *****************************************************************************/ #ifdef __ENABLE_DISCORD__ -# include "DiscordService.h" + #include "DiscordService.h" -# include "../Context.h" -# include "../Diagnostic.h" -# include "../GameState.h" -# include "../OpenRCT2.h" -# include "../core/Console.hpp" -# include "../core/String.hpp" -# include "../core/UTF8.h" -# include "../localisation/Formatting.h" -# include "../world/Park.h" -# include "network.h" + #include "../Context.h" + #include "../Diagnostic.h" + #include "../GameState.h" + #include "../OpenRCT2.h" + #include "../core/Console.hpp" + #include "../core/String.hpp" + #include "../core/UTF8.h" + #include "../localisation/Formatting.h" + #include "../world/Park.h" + #include "network.h" -# include -# include + #include + #include using namespace OpenRCT2; diff --git a/src/openrct2/network/DiscordService.h b/src/openrct2/network/DiscordService.h index ab496b4055..7ba3ab9e0d 100644 --- a/src/openrct2/network/DiscordService.h +++ b/src/openrct2/network/DiscordService.h @@ -11,9 +11,9 @@ #ifdef __ENABLE_DISCORD__ -# include "../core/Timer.hpp" + #include "../core/Timer.hpp" -# include + #include class DiscordService final { diff --git a/src/openrct2/network/NetworkAction.cpp b/src/openrct2/network/NetworkAction.cpp index 10142a6cad..5d9c8f2093 100644 --- a/src/openrct2/network/NetworkAction.cpp +++ b/src/openrct2/network/NetworkAction.cpp @@ -9,12 +9,12 @@ #ifndef DISABLE_NETWORK -# include "NetworkAction.h" + #include "NetworkAction.h" -# include "../Game.h" -# include "../localisation/StringIds.h" + #include "../Game.h" + #include "../localisation/StringIds.h" -# include + #include NetworkPermission NetworkActions::FindCommand(GameCommand command) { diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index 1ec9033c2f..48ac7304ca 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -66,45 +66,45 @@ static constexpr uint32_t kChunkSize = 1024 * 63; // This limit is per connection, the current value was determined by tests with fuzzing. static constexpr uint32_t kMaxPacketsPerUpdate = 100; -# include "../Cheats.h" -# include "../ParkImporter.h" -# include "../Version.h" -# include "../actions/GameAction.h" -# include "../config/Config.h" -# include "../core/Console.hpp" -# include "../core/FileStream.h" -# include "../core/MemoryStream.h" -# include "../core/Path.hpp" -# include "../core/String.hpp" -# include "../interface/Chat.h" -# include "../interface/Window.h" -# include "../localisation/Localisation.Date.h" -# include "../object/ObjectManager.h" -# include "../object/ObjectRepository.h" -# include "../scenario/Scenario.h" -# include "../util/Util.h" -# include "../world/Park.h" -# include "NetworkAction.h" -# include "NetworkConnection.h" -# include "NetworkGroup.h" -# include "NetworkKey.h" -# include "NetworkPacket.h" -# include "NetworkPlayer.h" -# include "NetworkServerAdvertiser.h" -# include "NetworkUser.h" -# include "Socket.h" + #include "../Cheats.h" + #include "../ParkImporter.h" + #include "../Version.h" + #include "../actions/GameAction.h" + #include "../config/Config.h" + #include "../core/Console.hpp" + #include "../core/FileStream.h" + #include "../core/MemoryStream.h" + #include "../core/Path.hpp" + #include "../core/String.hpp" + #include "../interface/Chat.h" + #include "../interface/Window.h" + #include "../localisation/Localisation.Date.h" + #include "../object/ObjectManager.h" + #include "../object/ObjectRepository.h" + #include "../scenario/Scenario.h" + #include "../util/Util.h" + #include "../world/Park.h" + #include "NetworkAction.h" + #include "NetworkConnection.h" + #include "NetworkGroup.h" + #include "NetworkKey.h" + #include "NetworkPacket.h" + #include "NetworkPlayer.h" + #include "NetworkServerAdvertiser.h" + #include "NetworkUser.h" + #include "Socket.h" -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include using namespace OpenRCT2; @@ -209,10 +209,10 @@ void NetworkBase::Close() _pendingPlayerLists.clear(); _pendingPlayerInfo.clear(); -# ifdef ENABLE_SCRIPTING + #ifdef ENABLE_SCRIPTING auto& scriptEngine = GetContext().GetScriptEngine(); scriptEngine.RemoveNetworkPlugins(); -# endif + #endif GfxInvalidateScreen(); @@ -1350,7 +1350,7 @@ void NetworkBase::ServerSendObjectsList( void NetworkBase::ServerSendScripts(NetworkConnection& connection) { -# ifdef ENABLE_SCRIPTING + #ifdef ENABLE_SCRIPTING using namespace OpenRCT2::Scripting; auto& scriptEngine = GetContext().GetScriptEngine(); @@ -1393,11 +1393,11 @@ void NetworkBase::ServerSendScripts(NetworkConnection& connection) } Guard::Assert(dataOffset == pluginData.GetLength()); -# else + #else NetworkPacket packetScriptHeader(NetworkCommand::ScriptsHeader); packetScriptHeader << static_cast(0u); packetScriptHeader << static_cast(0u); -# endif + #endif } void NetworkBase::Client_Send_HEARTBEAT(NetworkConnection& connection) const @@ -1676,7 +1676,7 @@ json_t NetworkBase::GetServerInfoAsJson() const void NetworkBase::ServerSendGameInfo(NetworkConnection& connection) { NetworkPacket packet(NetworkCommand::GameInfo); -# ifndef DISABLE_HTTP + #ifndef DISABLE_HTTP json_t jsonObj = GetServerInfoAsJson(); // Provider details @@ -1692,7 +1692,7 @@ void NetworkBase::ServerSendGameInfo(NetworkConnection& connection) packet << _serverState.gamestateSnapshotsEnabled; packet << IsServerPlayerInvisible; -# endif + #endif connection.QueuePacket(std::move(packet)); } @@ -1819,7 +1819,7 @@ void NetworkBase::ProcessPending() static bool ProcessPlayerAuthenticatePluginHooks( const NetworkConnection& connection, std::string_view name, std::string_view publicKeyHash) { -# ifdef ENABLE_SCRIPTING + #ifdef ENABLE_SCRIPTING using namespace OpenRCT2::Scripting; auto& hookEngine = GetContext()->GetScriptEngine().GetHookEngine(); @@ -1844,13 +1844,13 @@ static bool ProcessPlayerAuthenticatePluginHooks( return false; } } -# endif + #endif return true; } static void ProcessPlayerJoinedPluginHooks(uint8_t playerId) { -# ifdef ENABLE_SCRIPTING + #ifdef ENABLE_SCRIPTING using namespace OpenRCT2::Scripting; auto& hookEngine = GetContext()->GetScriptEngine().GetHookEngine(); @@ -1866,12 +1866,12 @@ static void ProcessPlayerJoinedPluginHooks(uint8_t playerId) // Call the subscriptions hookEngine.Call(OpenRCT2::Scripting::HOOK_TYPE::NETWORK_JOIN, e, false); } -# endif + #endif } static void ProcessPlayerLeftPluginHooks(uint8_t playerId) { -# ifdef ENABLE_SCRIPTING + #ifdef ENABLE_SCRIPTING using namespace OpenRCT2::Scripting; auto& hookEngine = GetContext()->GetScriptEngine().GetHookEngine(); @@ -1887,7 +1887,7 @@ static void ProcessPlayerLeftPluginHooks(uint8_t playerId) // Call the subscriptions hookEngine.Call(OpenRCT2::Scripting::HOOK_TYPE::NETWORK_LEAVE, e, false); } -# endif + #endif } void NetworkBase::ProcessPlayerList() @@ -2467,22 +2467,22 @@ void NetworkBase::Client_Handle_SCRIPTS_HEADER(NetworkConnection& connection, Ne uint32_t dataSize{}; packet >> numScripts >> dataSize; -# ifdef ENABLE_SCRIPTING + #ifdef ENABLE_SCRIPTING _serverScriptsData.data.Clear(); _serverScriptsData.pluginCount = numScripts; _serverScriptsData.dataSize = dataSize; -# else + #else if (numScripts > 0) { connection.SetLastDisconnectReason("The client requires plugin support."); Close(); } -# endif + #endif } void NetworkBase::Client_Handle_SCRIPTS_DATA(NetworkConnection& connection, NetworkPacket& packet) { -# ifdef ENABLE_SCRIPTING + #ifdef ENABLE_SCRIPTING uint32_t dataSize{}; packet >> dataSize; Guard::Assert(dataSize > 0); @@ -2511,10 +2511,10 @@ void NetworkBase::Client_Handle_SCRIPTS_DATA(NetworkConnection& connection, Netw // Empty the current buffer. _serverScriptsData = {}; } -# else + #else connection.SetLastDisconnectReason("The client requires plugin support."); Close(); -# endif + #endif } void NetworkBase::Client_Handle_GAMESTATE(NetworkConnection& connection, NetworkPacket& packet) @@ -2896,7 +2896,7 @@ void NetworkBase::Client_Handle_CHAT([[maybe_unused]] NetworkConnection& connect static bool ProcessChatMessagePluginHooks(uint8_t playerId, std::string& text) { -# ifdef ENABLE_SCRIPTING + #ifdef ENABLE_SCRIPTING auto& hookEngine = GetContext()->GetScriptEngine().GetHookEngine(); if (hookEngine.HasSubscriptions(OpenRCT2::Scripting::HOOK_TYPE::NETWORK_CHAT)) { @@ -2926,7 +2926,7 @@ static bool ProcessChatMessagePluginHooks(uint8_t playerId, std::string& text) return false; } } -# endif + #endif return true; } diff --git a/src/openrct2/network/NetworkConnection.cpp b/src/openrct2/network/NetworkConnection.cpp index d1cbd98f6f..a2fc31fed8 100644 --- a/src/openrct2/network/NetworkConnection.cpp +++ b/src/openrct2/network/NetworkConnection.cpp @@ -9,21 +9,21 @@ #ifndef DISABLE_NETWORK -# include "NetworkConnection.h" + #include "NetworkConnection.h" -# include "../core/String.hpp" -# include "../localisation/Formatting.h" -# include "../platform/Platform.h" -# include "Socket.h" -# include "network.h" + #include "../core/String.hpp" + #include "../localisation/Formatting.h" + #include "../platform/Platform.h" + #include "Socket.h" + #include "network.h" using namespace OpenRCT2; static constexpr size_t kNetworkDisconnectReasonBufSize = 256; static constexpr size_t kNetworkBufferSize = 1024 * 64; // 64 KiB, maximum packet size. -# ifndef DEBUG + #ifndef DEBUG static constexpr size_t kNetworkNoDataTimeout = 20; // Seconds. -# endif + #endif NetworkConnection::NetworkConnection() noexcept { @@ -181,13 +181,13 @@ void NetworkConnection::ResetLastPacketTime() noexcept bool NetworkConnection::ReceivedPacketRecently() const noexcept { -# ifndef DEBUG + #ifndef DEBUG constexpr auto kTimeoutMs = kNetworkNoDataTimeout * 1000; if (Platform::GetTicks() > _lastPacketTime + kTimeoutMs) { return false; } -# endif + #endif return true; } diff --git a/src/openrct2/network/NetworkConnection.h b/src/openrct2/network/NetworkConnection.h index ad65de39af..c5fb549b53 100644 --- a/src/openrct2/network/NetworkConnection.h +++ b/src/openrct2/network/NetworkConnection.h @@ -11,15 +11,15 @@ #ifndef DISABLE_NETWORK -# include "NetworkKey.h" -# include "NetworkPacket.h" -# include "NetworkTypes.h" -# include "Socket.h" + #include "NetworkKey.h" + #include "NetworkPacket.h" + #include "NetworkTypes.h" + #include "Socket.h" -# include -# include -# include -# include + #include + #include + #include + #include class NetworkPlayer; struct ObjectRepositoryItem; diff --git a/src/openrct2/network/NetworkGroup.cpp b/src/openrct2/network/NetworkGroup.cpp index ed6ec8fde9..3d579431f1 100644 --- a/src/openrct2/network/NetworkGroup.cpp +++ b/src/openrct2/network/NetworkGroup.cpp @@ -9,11 +9,11 @@ #ifndef DISABLE_NETWORK -# include "NetworkGroup.h" + #include "NetworkGroup.h" -# include "../openrct2/core/Json.hpp" -# include "NetworkAction.h" -# include "NetworkTypes.h" + #include "../openrct2/core/Json.hpp" + #include "NetworkAction.h" + #include "NetworkTypes.h" using namespace OpenRCT2; diff --git a/src/openrct2/network/NetworkKey.cpp b/src/openrct2/network/NetworkKey.cpp index 2ead9e479d..ce83211dcc 100644 --- a/src/openrct2/network/NetworkKey.cpp +++ b/src/openrct2/network/NetworkKey.cpp @@ -9,15 +9,15 @@ #ifndef DISABLE_NETWORK -# include "NetworkKey.h" + #include "NetworkKey.h" -# include "../Diagnostic.h" -# include "../core/Crypt.h" -# include "../core/Guard.hpp" -# include "../core/IStream.hpp" -# include "../core/String.hpp" + #include "../Diagnostic.h" + #include "../core/Crypt.h" + #include "../core/Guard.hpp" + #include "../core/IStream.hpp" + #include "../core/String.hpp" -# include + #include using namespace OpenRCT2; diff --git a/src/openrct2/network/NetworkKey.h b/src/openrct2/network/NetworkKey.h index 36e8507ec8..f59d01fc52 100644 --- a/src/openrct2/network/NetworkKey.h +++ b/src/openrct2/network/NetworkKey.h @@ -11,9 +11,9 @@ #ifndef DISABLE_NETWORK -# include -# include -# include + #include + #include + #include namespace OpenRCT2 { diff --git a/src/openrct2/network/NetworkPacket.cpp b/src/openrct2/network/NetworkPacket.cpp index 580f8c328c..45c901ffc0 100644 --- a/src/openrct2/network/NetworkPacket.cpp +++ b/src/openrct2/network/NetworkPacket.cpp @@ -9,11 +9,11 @@ #ifndef DISABLE_NETWORK -# include "NetworkPacket.h" + #include "NetworkPacket.h" -# include "NetworkTypes.h" + #include "NetworkTypes.h" -# include + #include NetworkPacket::NetworkPacket(NetworkCommand id) noexcept : Header{ 0, id } diff --git a/src/openrct2/network/NetworkPlayer.cpp b/src/openrct2/network/NetworkPlayer.cpp index 9bc4915d75..61ebe7e876 100644 --- a/src/openrct2/network/NetworkPlayer.cpp +++ b/src/openrct2/network/NetworkPlayer.cpp @@ -9,11 +9,11 @@ #ifndef DISABLE_NETWORK -# include "NetworkPlayer.h" + #include "NetworkPlayer.h" -# include "../core/Money.hpp" -# include "../interface/Window.h" -# include "NetworkPacket.h" + #include "../core/Money.hpp" + #include "../interface/Window.h" + #include "NetworkPacket.h" void NetworkPlayer::SetName(std::string_view name) { diff --git a/src/openrct2/network/NetworkServerAdvertiser.cpp b/src/openrct2/network/NetworkServerAdvertiser.cpp index e45bfa333f..d04ade1c52 100644 --- a/src/openrct2/network/NetworkServerAdvertiser.cpp +++ b/src/openrct2/network/NetworkServerAdvertiser.cpp @@ -9,30 +9,30 @@ #ifndef DISABLE_NETWORK -# include "NetworkServerAdvertiser.h" + #include "NetworkServerAdvertiser.h" -# include "../Diagnostic.h" -# include "../GameState.h" -# include "../config/Config.h" -# include "../core/Console.hpp" -# include "../core/Guard.hpp" -# include "../core/Http.h" -# include "../core/Json.hpp" -# include "../core/String.hpp" -# include "../entity/Guest.h" -# include "../localisation/Localisation.Date.h" -# include "../management/Finance.h" -# include "../platform/Platform.h" -# include "../world/Map.h" -# include "../world/Park.h" -# include "Socket.h" -# include "network.h" + #include "../Diagnostic.h" + #include "../GameState.h" + #include "../config/Config.h" + #include "../core/Console.hpp" + #include "../core/Guard.hpp" + #include "../core/Http.h" + #include "../core/Json.hpp" + #include "../core/String.hpp" + #include "../entity/Guest.h" + #include "../localisation/Localisation.Date.h" + #include "../management/Finance.h" + #include "../platform/Platform.h" + #include "../world/Map.h" + #include "../world/Park.h" + #include "Socket.h" + #include "network.h" -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include using namespace OpenRCT2; @@ -44,10 +44,10 @@ enum class MasterServerStatus InternalError = 500 }; -# ifndef DISABLE_HTTP + #ifndef DISABLE_HTTP constexpr int32_t kMasterServerRegisterTime = 120 * 1000; // 2 minutes constexpr int32_t kMasterServerHeartbeatTime = 60 * 1000; // 1 minute -# endif + #endif class NetworkServerAdvertiser final : public INetworkServerAdvertiser { @@ -59,7 +59,7 @@ private: ADVERTISE_STATUS _status = ADVERTISE_STATUS::UNREGISTERED; -# ifndef DISABLE_HTTP + #ifndef DISABLE_HTTP uint32_t _lastAdvertiseTime = 0; uint32_t _lastHeartbeatTime = 0; @@ -71,16 +71,16 @@ private: // See https://github.com/OpenRCT2/OpenRCT2/issues/6277 and 4953 bool _forceIPv4 = false; -# endif + #endif public: explicit NetworkServerAdvertiser(uint16_t port) { _port = port; _lanListener = CreateUdpSocket(); -# ifndef DISABLE_HTTP + #ifndef DISABLE_HTTP _key = GenerateAdvertiseKey(); -# endif + #endif } ADVERTISE_STATUS GetStatus() const override @@ -91,12 +91,12 @@ public: void Update() override { UpdateLAN(); -# ifndef DISABLE_HTTP + #ifndef DISABLE_HTTP if (Config::Get().network.Advertise) { UpdateWAN(); } -# endif + #endif } private: @@ -140,7 +140,7 @@ private: return root; } -# ifndef DISABLE_HTTP + #ifndef DISABLE_HTTP void UpdateWAN() { switch (_status) @@ -351,7 +351,7 @@ private: } return result; } -# endif + #endif }; std::unique_ptr CreateServerAdvertiser(uint16_t port) diff --git a/src/openrct2/network/NetworkUser.cpp b/src/openrct2/network/NetworkUser.cpp index e769f94f52..a2ad556f39 100644 --- a/src/openrct2/network/NetworkUser.cpp +++ b/src/openrct2/network/NetworkUser.cpp @@ -9,18 +9,18 @@ #ifndef DISABLE_NETWORK -# include "NetworkUser.h" + #include "NetworkUser.h" -# include "../Context.h" -# include "../PlatformEnvironment.h" -# include "../core/Console.hpp" -# include "../core/File.h" -# include "../core/Guard.hpp" -# include "../core/Json.hpp" -# include "../core/Path.hpp" -# include "../core/String.hpp" + #include "../Context.h" + #include "../PlatformEnvironment.h" + #include "../core/Console.hpp" + #include "../core/File.h" + #include "../core/Guard.hpp" + #include "../core/Json.hpp" + #include "../core/Path.hpp" + #include "../core/String.hpp" -# include + #include using namespace OpenRCT2; diff --git a/src/openrct2/network/ServerList.cpp b/src/openrct2/network/ServerList.cpp index 5ee748bad0..5d35cfba2a 100644 --- a/src/openrct2/network/ServerList.cpp +++ b/src/openrct2/network/ServerList.cpp @@ -9,27 +9,27 @@ #ifndef DISABLE_NETWORK -# include "ServerList.h" + #include "ServerList.h" -# include "../Context.h" -# include "../Diagnostic.h" -# include "../PlatformEnvironment.h" -# include "../config/Config.h" -# include "../core/File.h" -# include "../core/FileStream.h" -# include "../core/Guard.hpp" -# include "../core/Http.h" -# include "../core/Json.hpp" -# include "../core/Memory.hpp" -# include "../core/Path.hpp" -# include "../core/String.hpp" -# include "../localisation/Language.h" -# include "../platform/Platform.h" -# include "Socket.h" -# include "network.h" + #include "../Context.h" + #include "../Diagnostic.h" + #include "../PlatformEnvironment.h" + #include "../config/Config.h" + #include "../core/File.h" + #include "../core/FileStream.h" + #include "../core/Guard.hpp" + #include "../core/Http.h" + #include "../core/Json.hpp" + #include "../core/Memory.hpp" + #include "../core/Path.hpp" + #include "../core/String.hpp" + #include "../localisation/Language.h" + #include "../platform/Platform.h" + #include "Socket.h" + #include "network.h" -# include -# include + #include + #include using namespace OpenRCT2; @@ -354,9 +354,9 @@ std::future> ServerList::FetchLocalServerListAsync( std::future> ServerList::FetchOnlineServerListAsync() const { -# ifdef DISABLE_HTTP + #ifdef DISABLE_HTTP return {}; -# else + #else auto p = std::make_shared>>(); auto f = p->get_future(); @@ -423,7 +423,7 @@ std::future> ServerList::FetchOnlineServerListAsync } }); return f; -# endif + #endif } uint32_t ServerList::GetTotalPlayerCount() const diff --git a/src/openrct2/network/Socket.cpp b/src/openrct2/network/Socket.cpp index 56a1f7db1b..68567f6c71 100644 --- a/src/openrct2/network/Socket.cpp +++ b/src/openrct2/network/Socket.cpp @@ -9,15 +9,15 @@ #ifndef DISABLE_NETWORK -# include "../Diagnostic.h" + #include "../Diagnostic.h" -# include -# include -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include + #include + #include // clang-format off // MSVC: include here otherwise PI gets defined twice @@ -71,12 +71,12 @@ #endif // _WIN32 // clang-format on -# include "Socket.h" + #include "Socket.h" constexpr auto kConnectTimeout = std::chrono::milliseconds(3000); -// RAII WSA initialisation needed for Windows -# ifdef _WIN32 + // RAII WSA initialisation needed for Windows + #ifdef _WIN32 class WSA { private: @@ -120,12 +120,12 @@ static bool InitialiseWSA() static WSA wsa; return wsa.Initialise(); } -# else + #else static bool InitialiseWSA() { return true; } -# endif + #endif class SocketException : public std::runtime_error { @@ -198,13 +198,13 @@ protected: static bool SetNonBlocking(SOCKET socket, bool on) { -# ifdef _WIN32 + #ifdef _WIN32 u_long nonBlocking = on; return ioctlsocket(socket, FIONBIO, &nonBlocking) == 0; -# else + #else int32_t flags = fcntl(socket, F_GETFL, 0); return fcntl(socket, F_SETFL, on ? (flags | O_NONBLOCK) : (flags & ~O_NONBLOCK)) == 0; -# endif + #endif } static bool SetOption(SOCKET socket, int32_t a, int32_t b, bool value) @@ -471,10 +471,10 @@ public: fd_set writeFD; FD_ZERO(&writeFD); -# pragma warning(push) -# pragma warning(disable : 4548) // expression before comma has no effect; expected expression with side-effect + #pragma warning(push) + #pragma warning(disable : 4548) // expression before comma has no effect; expected expression with side-effect FD_SET(_socket, &writeFD); -# pragma warning(pop) + #pragma warning(pop) timeval timeout{}; timeout.tv_sec = 0; timeout.tv_usec = 0; @@ -591,7 +591,7 @@ public: if (readBytes == SOCKET_ERROR) { *sizeReceived = 0; -# ifndef _WIN32 + #ifndef _WIN32 // Removing the check for EAGAIN and instead relying on the values being the same allows turning on of // -Wlogical-op warning. // This is not true on Windows, see: @@ -602,7 +602,7 @@ public: EWOULDBLOCK == EAGAIN, "Portability note: your system has different values for EWOULDBLOCK " "and EAGAIN, please extend the condition below"); -# endif // _WIN32 + #endif // _WIN32 if (LAST_SOCKET_ERROR() != EWOULDBLOCK) { return NetworkReadPacket::Disconnected; @@ -876,7 +876,7 @@ std::unique_ptr CreateUdpSocket() return std::make_unique(); } -# ifdef _WIN32 + #ifdef _WIN32 static std::vector GetNetworkInterfaces() { InitialiseWSA(); @@ -913,12 +913,12 @@ static std::vector GetNetworkInterfaces() interfaces.shrink_to_fit(); return interfaces; } -# endif + #endif std::vector> GetBroadcastAddresses() { std::vector> baddresses; -# ifdef _WIN32 + #ifdef _WIN32 auto interfaces = GetNetworkInterfaces(); for (const auto& ifo : interfaces) { @@ -935,7 +935,7 @@ std::vector> GetBroadcastAddresses() baddresses.push_back(std::make_unique( reinterpret_cast(&address), static_cast(sizeof(sockaddr)))); } -# else + #else int sock = socket(AF_INET, SOCK_DGRAM, 0); if (sock == -1) { @@ -966,12 +966,12 @@ std::vector> GetBroadcastAddresses() } } p += sizeof(ifreq); -# if defined(AF_LINK) && !defined(SUNOS) + #if defined(AF_LINK) && !defined(SUNOS) p += req->ifr_addr.sa_len - sizeof(struct sockaddr); -# endif + #endif } close(sock); -# endif + #endif return baddresses; } diff --git a/src/openrct2/object/Object.cpp b/src/openrct2/object/Object.cpp index d3b0be75d9..f453a144af 100644 --- a/src/openrct2/object/Object.cpp +++ b/src/openrct2/object/Object.cpp @@ -193,8 +193,8 @@ void Object::SetSourceGames(const std::vector& sourceGames) } #ifdef __WARN_SUGGEST_FINAL_METHODS__ -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wsuggest-final-methods" + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wsuggest-final-methods" #endif std::string Object::GetName() const @@ -426,5 +426,5 @@ ObjectVersion VersionTuple(std::string_view version) } #ifdef __WARN_SUGGEST_FINAL_METHODS__ -# pragma GCC diagnostic pop + #pragma GCC diagnostic pop #endif diff --git a/src/openrct2/object/Object.h b/src/openrct2/object/Object.h index ed2005bac9..9049357407 100644 --- a/src/openrct2/object/Object.h +++ b/src/openrct2/object/Object.h @@ -179,9 +179,9 @@ struct IReadObjectContext }; #ifdef __WARN_SUGGEST_FINAL_TYPES__ -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wsuggest-final-types" -# pragma GCC diagnostic ignored "-Wsuggest-final-methods" + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wsuggest-final-types" + #pragma GCC diagnostic ignored "-Wsuggest-final-methods" #endif class Object { @@ -336,7 +336,7 @@ public: void UnloadImages(); }; #ifdef __WARN_SUGGEST_FINAL_TYPES__ -# pragma GCC diagnostic pop + #pragma GCC diagnostic pop #endif int32_t ObjectCalculateChecksum(const RCTObjectEntry* entry, const void* data, size_t dataLength); diff --git a/src/openrct2/platform/Crash.cpp b/src/openrct2/platform/Crash.cpp index 5e64f16e56..de7a7adf5e 100644 --- a/src/openrct2/platform/Crash.cpp +++ b/src/openrct2/platform/Crash.cpp @@ -10,54 +10,54 @@ #include "Crash.h" #ifdef USE_BREAKPAD -# include -# include -# include -# include + #include + #include + #include + #include -# if defined(_WIN32) -# include -# include -# include -# include -# else -# error Breakpad support not implemented yet for this platform -# endif + #if defined(_WIN32) + #include + #include + #include + #include + #else + #error Breakpad support not implemented yet for this platform + #endif -# include "../Context.h" -# include "../Game.h" -# include "../GameState.h" -# include "../OpenRCT2.h" -# include "../PlatformEnvironment.h" -# include "../Version.h" -# include "../config/Config.h" -# include "../core/Compression.h" -# include "../core/Console.hpp" -# include "../core/Guard.hpp" -# include "../core/Path.hpp" -# include "../core/SawyerCoding.h" -# include "../core/String.hpp" -# include "../drawing/IDrawingEngine.h" -# include "../interface/Screenshot.h" -# include "../localisation/Language.h" -# include "../object/ObjectManager.h" -# include "../park/ParkFile.h" -# include "../scenario/Scenario.h" -# include "Platform.h" + #include "../Context.h" + #include "../Game.h" + #include "../GameState.h" + #include "../OpenRCT2.h" + #include "../PlatformEnvironment.h" + #include "../Version.h" + #include "../config/Config.h" + #include "../core/Compression.h" + #include "../core/Console.hpp" + #include "../core/Guard.hpp" + #include "../core/Path.hpp" + #include "../core/SawyerCoding.h" + #include "../core/String.hpp" + #include "../drawing/IDrawingEngine.h" + #include "../interface/Screenshot.h" + #include "../localisation/Language.h" + #include "../object/ObjectManager.h" + #include "../park/ParkFile.h" + #include "../scenario/Scenario.h" + #include "Platform.h" -# define WSZ(x) L"" x + #define WSZ(x) L"" x -# ifdef OPENRCT2_COMMIT_SHA1_SHORT + #ifdef OPENRCT2_COMMIT_SHA1_SHORT static const wchar_t* _wszCommitSha1Short = WSZ(OPENRCT2_COMMIT_SHA1_SHORT); -# else + #else static const wchar_t* _wszCommitSha1Short = WSZ(""); -# endif + #endif // OPENRCT2_ARCHITECTURE is required to be defined in version.h static const wchar_t* _wszArchitecture = WSZ(OPENRCT2_ARCHITECTURE); static std::map _uploadFiles; -# define BACKTRACE_TOKEN "1a9becc5de031b0a24ecad5222d2b42820c3710863a0f1dba6ab378b02ca659a" + #define BACKTRACE_TOKEN "1a9becc5de031b0a24ecad5222d2b42820c3710863a0f1dba6ab378b02ca659a" using namespace OpenRCT2; diff --git a/src/openrct2/platform/Platform.Android.cpp b/src/openrct2/platform/Platform.Android.cpp index b011e4db98..9a48128ff1 100644 --- a/src/openrct2/platform/Platform.Android.cpp +++ b/src/openrct2/platform/Platform.Android.cpp @@ -9,15 +9,15 @@ #ifdef __ANDROID__ -# include "Platform.h" + #include "Platform.h" -# include "../Diagnostic.h" -# include "../core/Guard.hpp" -# include "../localisation/Language.h" + #include "../Diagnostic.h" + #include "../core/Guard.hpp" + #include "../localisation/Language.h" -# include -# include -# include + #include + #include + #include AndroidClassLoader::~AndroidClassLoader() { @@ -162,13 +162,13 @@ namespace OpenRCT2::Platform return {}; } -# ifndef NO_TTF + #ifndef NO_TTF std::string GetFontPath(const TTFFontDescriptor& font) { STUB(); return {}; } -# endif + #endif float GetDefaultScale() { diff --git a/src/openrct2/platform/Platform.Common.cpp b/src/openrct2/platform/Platform.Common.cpp index 02e7f389da..42d00311fc 100644 --- a/src/openrct2/platform/Platform.Common.cpp +++ b/src/openrct2/platform/Platform.Common.cpp @@ -10,19 +10,19 @@ #include "../Date.h" #ifdef _WIN32 -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# include + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif + #include #endif #if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) -# include -# define OpenRCT2_CPUID_GNUC_X86 + #include + #define OpenRCT2_CPUID_GNUC_X86 #elif defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_X64) || defined(_M_IX86)) // VS2008 -# include -# include -# define OpenRCT2_CPUID_MSVC_X86 + #include + #include + #define OpenRCT2_CPUID_MSVC_X86 #endif #include "../Context.h" @@ -149,15 +149,15 @@ namespace OpenRCT2::Platform #ifdef OPENRCT2_X86 static bool CPUIDX86(uint32_t* cpuid_outdata, int32_t eax) { -# if defined(OpenRCT2_CPUID_GNUC_X86) + #if defined(OpenRCT2_CPUID_GNUC_X86) int ret = __get_cpuid(eax, &cpuid_outdata[0], &cpuid_outdata[1], &cpuid_outdata[2], &cpuid_outdata[3]); return ret == 1; -# elif defined(OpenRCT2_CPUID_MSVC_X86) + #elif defined(OpenRCT2_CPUID_MSVC_X86) __cpuid(reinterpret_cast(cpuid_outdata), static_cast(eax)); return true; -# else + #else return false; -# endif + #endif } #endif // OPENRCT2_X86 @@ -181,9 +181,9 @@ namespace OpenRCT2::Platform // https://github.com/gcc-mirror/gcc/commit/132fa33ce998df69a9f793d63785785f4b93e6f1 // which causes it to ignore subleafs, but the new function is unavailable on // Ubuntu 18.04's toolchains. -# if defined(OpenRCT2_CPUID_GNUC_X86) && (!defined(__FreeBSD__) || (__FreeBSD__ > 10)) + #if defined(OpenRCT2_CPUID_GNUC_X86) && (!defined(__FreeBSD__) || (__FreeBSD__ > 10)) return __builtin_cpu_supports("avx2"); -# else + #else // AVX2 support is declared as the 5th bit of EBX with CPUID(EAX = 7, ECX = 0). uint32_t regs[4] = { 0 }; if (CPUIDX86(regs, 7)) @@ -198,7 +198,7 @@ namespace OpenRCT2::Platform } return avxCPUSupport; } -# endif + #endif #endif return false; } diff --git a/src/openrct2/platform/Platform.Linux.cpp b/src/openrct2/platform/Platform.Linux.cpp index 1cfcaf45d6..f58fa97a46 100644 --- a/src/openrct2/platform/Platform.Linux.cpp +++ b/src/openrct2/platform/Platform.Linux.cpp @@ -9,33 +9,33 @@ #if defined(__unix__) && !defined(__ANDROID__) && !defined(__APPLE__) -# include "../Diagnostic.h" + #include "../Diagnostic.h" -# include -# include -# include -# include -# include -# include -# include -# if defined(__FreeBSD__) || defined(__NetBSD__) -# include -# include -# include -# endif // __FreeBSD__ || __NetBSD__ -# if defined(__linux__) -// for PATH_MAX -# include -# endif // __linux__ -# ifndef NO_TTF -# include -# endif // NO_TTF + #include + #include + #include + #include + #include + #include + #include + #if defined(__FreeBSD__) || defined(__NetBSD__) + #include + #include + #include + #endif // __FreeBSD__ || __NetBSD__ + #if defined(__linux__) + // for PATH_MAX + #include + #endif // __linux__ + #ifndef NO_TTF + #include + #endif // NO_TTF -# include "../Date.h" -# include "../OpenRCT2.h" -# include "../core/Path.hpp" -# include "../localisation/Language.h" -# include "Platform.h" + #include "../Date.h" + #include "../OpenRCT2.h" + #include "../core/Path.hpp" + #include "../localisation/Language.h" + #include "Platform.h" namespace OpenRCT2::Platform { @@ -131,40 +131,40 @@ namespace OpenRCT2::Platform std::string GetCurrentExecutablePath() { char exePath[PATH_MAX] = { 0 }; -# ifdef __linux__ + #ifdef __linux__ auto bytesRead = readlink("/proc/self/exe", exePath, sizeof(exePath)); if (bytesRead == -1) { LOG_FATAL("failed to read /proc/self/exe"); } -# elif defined(__FreeBSD__) || defined(__NetBSD__) -# if defined(__FreeBSD__) + #elif defined(__FreeBSD__) || defined(__NetBSD__) + #if defined(__FreeBSD__) const int32_t mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1, }; -# else + #else const int32_t mib[] = { CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME, }; -# endif + #endif auto exeLen = sizeof(exePath); if (sysctl(mib, 4, exePath, &exeLen, nullptr, 0) == -1) { LOG_FATAL("failed to get process path"); } -# elif defined(__OpenBSD__) + #elif defined(__OpenBSD__) // There is no way to get the path name of a running executable. // If you are not using the port or package, you may have to change this line! strlcpy(exePath, "/usr/local/bin/", sizeof(exePath)); -# else -# error "Platform does not support full path exe retrieval" -# endif + #else + #error "Platform does not support full path exe retrieval" + #endif return exePath; } @@ -259,12 +259,12 @@ namespace OpenRCT2::Platform MeasurementFormat GetLocaleMeasurementFormat() { -// LC_MEASUREMENT is GNU specific. -# ifdef LC_MEASUREMENT + // LC_MEASUREMENT is GNU specific. + #ifdef LC_MEASUREMENT const char* langstring = setlocale(LC_MEASUREMENT, ""); -# else + #else const char* langstring = setlocale(LC_ALL, ""); -# endif + #endif if (langstring != nullptr) { @@ -349,7 +349,7 @@ namespace OpenRCT2::Platform }; } -# ifndef NO_TTF + #ifndef NO_TTF std::string GetFontPath(const TTFFontDescriptor& font) { LOG_VERBOSE("Looking for font %s with FontConfig.", font.font_name); @@ -406,7 +406,7 @@ namespace OpenRCT2::Platform FcFini(); return path; } -# endif // NO_TTF + #endif // NO_TTF } // namespace OpenRCT2::Platform #endif diff --git a/src/openrct2/platform/Platform.Posix.cpp b/src/openrct2/platform/Platform.Posix.cpp index f56fc144bd..55a91fd8af 100644 --- a/src/openrct2/platform/Platform.Posix.cpp +++ b/src/openrct2/platform/Platform.Posix.cpp @@ -9,27 +9,27 @@ #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD__) -# include "Platform.h" + #include "Platform.h" -# include "../Date.h" -# include "../Diagnostic.h" -# include "../core/Memory.hpp" -# include "../core/Path.hpp" -# include "../core/String.hpp" + #include "../Date.h" + #include "../Diagnostic.h" + #include "../core/Memory.hpp" + #include "../core/Path.hpp" + #include "../core/String.hpp" -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include // The name of the mutex used to prevent multiple instances of the game from running static constexpr const utf8* SINGLE_INSTANCE_MUTEX_NAME = u8"openrct2.lock"; @@ -118,7 +118,7 @@ namespace OpenRCT2::Platform int32_t Execute(std::string_view command, std::string* output) { -# ifndef __EMSCRIPTEN__ + #ifndef __EMSCRIPTEN__ LOG_VERBOSE("executing \"%s\"...", std::string(command).c_str()); FILE* fpipe = popen(std::string(command).c_str(), "r"); if (fpipe == nullptr) @@ -160,10 +160,10 @@ namespace OpenRCT2::Platform // Return exit code return pclose(fpipe); -# else + #else LOG_WARNING("Emscripten cannot execute processes. The commandline was '%s'.", command.c_str()); return -1; -# endif // __EMSCRIPTEN__ + #endif // __EMSCRIPTEN__ } uint64_t GetLastModified(std::string_view path) @@ -279,12 +279,12 @@ namespace OpenRCT2::Platform TemperatureUnit GetLocaleTemperatureFormat() { -// LC_MEASUREMENT is GNU specific. -# ifdef LC_MEASUREMENT + // LC_MEASUREMENT is GNU specific. + #ifdef LC_MEASUREMENT const char* langstring = setlocale(LC_MEASUREMENT, ""); -# else + #else const char* langstring = setlocale(LC_ALL, ""); -# endif + #endif if (langstring != nullptr) { @@ -299,11 +299,11 @@ namespace OpenRCT2::Platform bool ProcessIsElevated() { -# ifndef __EMSCRIPTEN__ + #ifndef __EMSCRIPTEN__ return (geteuid() == 0); -# else + #else return false; -# endif // __EMSCRIPTEN__ + #endif // __EMSCRIPTEN__ } bool LockSingleInstance() diff --git a/src/openrct2/platform/Platform.Win32.cpp b/src/openrct2/platform/Platform.Win32.cpp index 905d21cf7a..859ebfc669 100644 --- a/src/openrct2/platform/Platform.Win32.cpp +++ b/src/openrct2/platform/Platform.Win32.cpp @@ -9,48 +9,48 @@ #ifdef _WIN32 -// Windows.h needs to be included first -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# include "../Diagnostic.h" + // Windows.h needs to be included first + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif + #include "../Diagnostic.h" -# include -# include + #include + #include -// Then the rest -# include "../Version.h" + // Then the rest + #include "../Version.h" -# include -# include -# include -# include -# undef GetEnvironmentVariable + #include + #include + #include + #include + #undef GetEnvironmentVariable -# include "../Date.h" -# include "../OpenRCT2.h" -# include "../core/Path.hpp" -# include "../core/String.hpp" -# include "../localisation/Language.h" -# include "../localisation/Localisation.Date.h" -# include "Platform.h" + #include "../Date.h" + #include "../OpenRCT2.h" + #include "../core/Path.hpp" + #include "../core/String.hpp" + #include "../localisation/Language.h" + #include "../localisation/Localisation.Date.h" + #include "Platform.h" -# include -# include -# include + #include + #include + #include -// Native resource IDs -# include "../../../resources/resource.h" + // Native resource IDs + #include "../../../resources/resource.h" -// Enable visual styles -# pragma comment( \ + // Enable visual styles + #pragma comment( \ linker, \ "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") // The name of the mutex used to prevent multiple instances of the game from running static constexpr wchar_t SINGLE_INSTANCE_MUTEX_NAME[] = L"RollerCoaster Tycoon 2_GSKMUTEX"; -# define SOFTWARE_CLASSES L"Software\\Classes" -# define MUI_CACHE L"Local Settings\\Software\\Microsoft\\Windows\\Shell\\MuiCache" + #define SOFTWARE_CLASSES L"Software\\Classes" + #define MUI_CACHE L"Local Settings\\Software\\Microsoft\\Windows\\Shell\\MuiCache" namespace OpenRCT2::Platform { @@ -215,14 +215,14 @@ namespace OpenRCT2::Platform if (hModule != nullptr) { using RtlGetVersionPtr = long(WINAPI*)(PRTL_OSVERSIONINFOW); -# if defined(__GNUC__) && __GNUC__ >= 8 -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wcast-function-type" -# endif + #if defined(__GNUC__) && __GNUC__ >= 8 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-function-type" + #endif auto fn = reinterpret_cast(GetProcAddress(hModule, "RtlGetVersion")); -# if defined(__GNUC__) && __GNUC__ >= 8 -# pragma GCC diagnostic pop -# endif + #if defined(__GNUC__) && __GNUC__ >= 8 + #pragma GCC diagnostic pop + #endif if (fn != nullptr) { RTL_OSVERSIONINFOW rovi{}; diff --git a/src/openrct2/platform/Platform.h b/src/openrct2/platform/Platform.h index 5530eda866..dde5053f9b 100644 --- a/src/openrct2/platform/Platform.h +++ b/src/openrct2/platform/Platform.h @@ -17,18 +17,18 @@ #include #ifdef _WIN32 -# define PATH_SEPARATOR u8"\\" -# define PLATFORM_NEWLINE u8"\r\n" + #define PATH_SEPARATOR u8"\\" + #define PLATFORM_NEWLINE u8"\r\n" #else -# define PATH_SEPARATOR u8"/" -# define PLATFORM_NEWLINE u8"\n" + #define PATH_SEPARATOR u8"/" + #define PLATFORM_NEWLINE u8"\n" #endif #ifdef __ANDROID__ -# include + #include #endif // __ANDROID__ #ifndef MAX_PATH -# define MAX_PATH 260 + #define MAX_PATH 260 #endif enum class SPECIAL_FOLDER diff --git a/src/openrct2/profiling/ProfilingMacros.hpp b/src/openrct2/profiling/ProfilingMacros.hpp index de06c28045..3712be0e46 100644 --- a/src/openrct2/profiling/ProfilingMacros.hpp +++ b/src/openrct2/profiling/ProfilingMacros.hpp @@ -11,11 +11,11 @@ namespace OpenRCT2::Profiling { #if defined(__clang__) || defined(__GNUC__) -# define PROFILING_FUNC_NAME __PRETTY_FUNCTION__ + #define PROFILING_FUNC_NAME __PRETTY_FUNCTION__ #elif defined(_MSC_VER) -# define PROFILING_FUNC_NAME __FUNCSIG__ + #define PROFILING_FUNC_NAME __FUNCSIG__ #else -# error "Unsupported compiler" + #error "Unsupported compiler" #endif #define PROFILED_FUNCTION_NAME(func) \ @@ -30,10 +30,10 @@ namespace OpenRCT2::Profiling #if defined(__clang_major__) && __clang_major__ <= 5 // Clang 5 crashes using the profiler, we need to disable it. -# define PROFILED_FUNCTION() + #define PROFILED_FUNCTION() #else -# define PROFILED_FUNCTION() \ + #define PROFILED_FUNCTION() \ PROFILED_FUNCTION_NAME(PROFILING_FUNC_NAME) \ static auto& _profiling_func = ::OpenRCT2::Profiling::Detail::Storage::Data; \ ::OpenRCT2::Profiling::ScopedProfiling _profiling_scope(_profiling_func); diff --git a/src/openrct2/rct12/ScenarioPatcher.cpp b/src/openrct2/rct12/ScenarioPatcher.cpp index 0f05fdcc6c..359d6eba8b 100644 --- a/src/openrct2/rct12/ScenarioPatcher.cpp +++ b/src/openrct2/rct12/ScenarioPatcher.cpp @@ -33,9 +33,9 @@ #include "../world/tile_element/TrackElement.h" #ifdef DISABLE_NETWORK -# include + #include #else -# include "../core/Crypt.h" + #include "../core/Crypt.h" #endif #include diff --git a/src/openrct2/scripting/Duktape.hpp b/src/openrct2/scripting/Duktape.hpp index 8619683f80..dfcccfd85f 100644 --- a/src/openrct2/scripting/Duktape.hpp +++ b/src/openrct2/scripting/Duktape.hpp @@ -11,16 +11,16 @@ #ifdef ENABLE_SCRIPTING -# include "../core/Console.hpp" -# include "../core/EnumMap.hpp" -# include "../ride/Vehicle.h" -# include "../world/Map.h" + #include "../core/Console.hpp" + #include "../core/EnumMap.hpp" + #include "../ride/Vehicle.h" + #include "../world/Map.h" -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/HookEngine.cpp b/src/openrct2/scripting/HookEngine.cpp index 77ead25f9b..0b6d74f3fd 100644 --- a/src/openrct2/scripting/HookEngine.cpp +++ b/src/openrct2/scripting/HookEngine.cpp @@ -9,12 +9,12 @@ #ifdef ENABLE_SCRIPTING -# include "HookEngine.h" + #include "HookEngine.h" -# include "../core/EnumMap.hpp" -# include "ScriptEngine.h" + #include "../core/EnumMap.hpp" + #include "ScriptEngine.h" -# include + #include using namespace OpenRCT2::Scripting; diff --git a/src/openrct2/scripting/HookEngine.h b/src/openrct2/scripting/HookEngine.h index 839691aedb..550af6e85a 100644 --- a/src/openrct2/scripting/HookEngine.h +++ b/src/openrct2/scripting/HookEngine.h @@ -11,13 +11,13 @@ #ifdef ENABLE_SCRIPTING -# include "Duktape.hpp" + #include "Duktape.hpp" -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/Plugin.cpp b/src/openrct2/scripting/Plugin.cpp index 7a6d7efa69..a54e60ead2 100644 --- a/src/openrct2/scripting/Plugin.cpp +++ b/src/openrct2/scripting/Plugin.cpp @@ -9,16 +9,16 @@ #ifdef ENABLE_SCRIPTING -# include "Plugin.h" + #include "Plugin.h" -# include "../Diagnostic.h" -# include "../OpenRCT2.h" -# include "../core/File.h" -# include "Duktape.hpp" -# include "ScriptEngine.h" + #include "../Diagnostic.h" + #include "../OpenRCT2.h" + #include "../core/File.h" + #include "Duktape.hpp" + #include "ScriptEngine.h" -# include -# include + #include + #include using namespace OpenRCT2::Scripting; @@ -122,15 +122,15 @@ void Plugin::ThrowIfStopping() const void Plugin::Unload() { -// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105937, fixed in GCC13 -# if defined(__GNUC__) && !defined(__clang__) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -# endif + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105937, fixed in GCC13 + #if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" + #endif _metadata.Main = {}; -# if defined(__GNUC__) && !defined(__clang__) -# pragma GCC diagnostic pop -# endif + #if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic pop + #endif _hasLoaded = false; } diff --git a/src/openrct2/scripting/Plugin.h b/src/openrct2/scripting/Plugin.h index 2d6df869c6..8b91b08d82 100644 --- a/src/openrct2/scripting/Plugin.h +++ b/src/openrct2/scripting/Plugin.h @@ -11,12 +11,12 @@ #ifdef ENABLE_SCRIPTING -# include "Duktape.hpp" + #include "Duktape.hpp" -# include -# include -# include -# include + #include + #include + #include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/ScriptEngine.cpp b/src/openrct2/scripting/ScriptEngine.cpp index c73223c9a0..b678ee3ff2 100644 --- a/src/openrct2/scripting/ScriptEngine.cpp +++ b/src/openrct2/scripting/ScriptEngine.cpp @@ -9,61 +9,61 @@ #ifdef ENABLE_SCRIPTING -# include "ScriptEngine.h" + #include "ScriptEngine.h" -# include "../PlatformEnvironment.h" -# include "../actions/BannerPlaceAction.h" -# include "../actions/CustomAction.h" -# include "../actions/GameAction.h" -# include "../actions/LargeSceneryPlaceAction.h" -# include "../actions/RideCreateAction.h" -# include "../actions/StaffHireNewAction.h" -# include "../actions/WallPlaceAction.h" -# include "../config/Config.h" -# include "../core/EnumMap.hpp" -# include "../core/File.h" -# include "../core/FileScanner.h" -# include "../core/Path.hpp" -# include "../interface/InteractiveConsole.h" -# include "../platform/Platform.h" -# include "Duktape.hpp" -# include "bindings/entity/ScEntity.hpp" -# include "bindings/entity/ScGuest.hpp" -# include "bindings/entity/ScLitter.hpp" -# include "bindings/entity/ScParticle.hpp" -# include "bindings/entity/ScPeep.hpp" -# include "bindings/entity/ScStaff.hpp" -# include "bindings/entity/ScVehicle.hpp" -# include "bindings/game/ScCheats.hpp" -# include "bindings/game/ScConsole.hpp" -# include "bindings/game/ScContext.hpp" -# include "bindings/game/ScDisposable.hpp" -# include "bindings/game/ScPlugin.hpp" -# include "bindings/game/ScProfiler.hpp" -# include "bindings/network/ScNetwork.hpp" -# include "bindings/network/ScPlayer.hpp" -# include "bindings/network/ScPlayerGroup.hpp" -# include "bindings/network/ScSocket.hpp" -# include "bindings/object/ScInstalledObject.hpp" -# include "bindings/object/ScObject.hpp" -# include "bindings/object/ScObjectManager.h" -# include "bindings/ride/ScRide.hpp" -# include "bindings/ride/ScRideStation.hpp" -# include "bindings/world/ScClimate.hpp" -# include "bindings/world/ScDate.hpp" -# include "bindings/world/ScMap.hpp" -# include "bindings/world/ScPark.hpp" -# include "bindings/world/ScParkMessage.hpp" -# include "bindings/world/ScResearch.hpp" -# include "bindings/world/ScScenario.hpp" -# include "bindings/world/ScTile.hpp" -# include "bindings/world/ScTileElement.hpp" + #include "../PlatformEnvironment.h" + #include "../actions/BannerPlaceAction.h" + #include "../actions/CustomAction.h" + #include "../actions/GameAction.h" + #include "../actions/LargeSceneryPlaceAction.h" + #include "../actions/RideCreateAction.h" + #include "../actions/StaffHireNewAction.h" + #include "../actions/WallPlaceAction.h" + #include "../config/Config.h" + #include "../core/EnumMap.hpp" + #include "../core/File.h" + #include "../core/FileScanner.h" + #include "../core/Path.hpp" + #include "../interface/InteractiveConsole.h" + #include "../platform/Platform.h" + #include "Duktape.hpp" + #include "bindings/entity/ScEntity.hpp" + #include "bindings/entity/ScGuest.hpp" + #include "bindings/entity/ScLitter.hpp" + #include "bindings/entity/ScParticle.hpp" + #include "bindings/entity/ScPeep.hpp" + #include "bindings/entity/ScStaff.hpp" + #include "bindings/entity/ScVehicle.hpp" + #include "bindings/game/ScCheats.hpp" + #include "bindings/game/ScConsole.hpp" + #include "bindings/game/ScContext.hpp" + #include "bindings/game/ScDisposable.hpp" + #include "bindings/game/ScPlugin.hpp" + #include "bindings/game/ScProfiler.hpp" + #include "bindings/network/ScNetwork.hpp" + #include "bindings/network/ScPlayer.hpp" + #include "bindings/network/ScPlayerGroup.hpp" + #include "bindings/network/ScSocket.hpp" + #include "bindings/object/ScInstalledObject.hpp" + #include "bindings/object/ScObject.hpp" + #include "bindings/object/ScObjectManager.h" + #include "bindings/ride/ScRide.hpp" + #include "bindings/ride/ScRideStation.hpp" + #include "bindings/world/ScClimate.hpp" + #include "bindings/world/ScDate.hpp" + #include "bindings/world/ScMap.hpp" + #include "bindings/world/ScPark.hpp" + #include "bindings/world/ScParkMessage.hpp" + #include "bindings/world/ScResearch.hpp" + #include "bindings/world/ScScenario.hpp" + #include "bindings/world/ScTile.hpp" + #include "bindings/world/ScTileElement.hpp" -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include using namespace OpenRCT2; using namespace OpenRCT2::Scripting; @@ -443,10 +443,10 @@ void ScriptEngine::Initialise() ScPeep::Register(ctx); ScGuest::Register(ctx); ScThought::Register(ctx); -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK ScSocket::Register(ctx); ScListener::Register(ctx); -# endif + #endif ScScenario::Register(ctx); ScScenarioObjective::Register(ctx); ScPatrolArea::Register(ctx); @@ -1749,16 +1749,16 @@ void ScriptEngine::RemoveIntervals(const std::shared_ptr& plugin) } } -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK void ScriptEngine::AddSocket(const std::shared_ptr& socket) { _sockets.push_back(socket); } -# endif + #endif void ScriptEngine::UpdateSockets() { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK // Use simple for i loop as Update calls can modify the list auto it = _sockets.begin(); while (it != _sockets.end()) @@ -1774,12 +1774,12 @@ void ScriptEngine::UpdateSockets() it++; } } -# endif + #endif } void ScriptEngine::RemoveSockets(const std::shared_ptr& plugin) { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK auto it = _sockets.begin(); while (it != _sockets.end()) { @@ -1794,7 +1794,7 @@ void ScriptEngine::RemoveSockets(const std::shared_ptr& plugin) it++; } } -# endif + #endif } std::string OpenRCT2::Scripting::Stringify(const DukValue& val) diff --git a/src/openrct2/scripting/ScriptEngine.h b/src/openrct2/scripting/ScriptEngine.h index 9993840364..e05f1c2fa5 100644 --- a/src/openrct2/scripting/ScriptEngine.h +++ b/src/openrct2/scripting/ScriptEngine.h @@ -11,22 +11,22 @@ #ifdef ENABLE_SCRIPTING -# include "../actions/CustomAction.h" -# include "../core/FileWatcher.h" -# include "../management/Finance.h" -# include "../world/Location.hpp" -# include "HookEngine.h" -# include "Plugin.h" + #include "../actions/CustomAction.h" + #include "../core/FileWatcher.h" + #include "../management/Finance.h" + #include "../world/Location.hpp" + #include "HookEngine.h" + #include "Plugin.h" -# include -# include -# include -# include -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include + #include + #include + #include + #include struct duk_hthread; typedef struct duk_hthread duk_context; @@ -54,9 +54,9 @@ namespace OpenRCT2::Scripting static constexpr int32_t API_VERSION_68_CUSTOM_ACTION_ARGS = 68; static constexpr int32_t API_VERSION_77_NETWORK_IDS = 77; -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK class ScSocketBase; -# endif + #endif class ScriptExecutionInfo { @@ -173,9 +173,9 @@ namespace OpenRCT2::Scripting }; std::unordered_map _customActions; -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK std::list> _sockets; -# endif + #endif public: ScriptEngine(InteractiveConsole& console, IPlatformEnvironment& env); @@ -264,9 +264,9 @@ namespace OpenRCT2::Scripting static std::string_view ExpenditureTypeToString(ExpenditureType expenditureType); static ExpenditureType StringToExpenditureType(std::string_view expenditureType); -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK void AddSocket(const std::shared_ptr& socket); -# endif + #endif private: void RegisterConstants(); diff --git a/src/openrct2/scripting/bindings/entity/ScEntity.hpp b/src/openrct2/scripting/bindings/entity/ScEntity.hpp index 1f5010d436..2126a52842 100644 --- a/src/openrct2/scripting/bindings/entity/ScEntity.hpp +++ b/src/openrct2/scripting/bindings/entity/ScEntity.hpp @@ -11,16 +11,16 @@ #ifdef ENABLE_SCRIPTING -# include "../../../Context.h" -# include "../../../entity/EntityList.h" -# include "../../../entity/EntityRegistry.h" -# include "../../../entity/Peep.h" -# include "../../../util/Util.h" -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" + #include "../../../Context.h" + #include "../../../entity/EntityList.h" + #include "../../../entity/EntityRegistry.h" + #include "../../../entity/Peep.h" + #include "../../../util/Util.h" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" -# include -# include + #include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/entity/ScGuest.cpp b/src/openrct2/scripting/bindings/entity/ScGuest.cpp index adffa367b3..fec22eebc9 100644 --- a/src/openrct2/scripting/bindings/entity/ScGuest.cpp +++ b/src/openrct2/scripting/bindings/entity/ScGuest.cpp @@ -9,13 +9,13 @@ #ifdef ENABLE_SCRIPTING -# include "ScGuest.hpp" + #include "ScGuest.hpp" -# include "../../../GameState.h" -# include "../../../entity/Guest.h" -# include "../../../localisation/Formatting.h" -# include "../../../peep/PeepAnimationData.h" -# include "../../../ride/RideEntry.h" + #include "../../../GameState.h" + #include "../../../entity/Guest.h" + #include "../../../localisation/Formatting.h" + #include "../../../peep/PeepAnimationData.h" + #include "../../../ride/RideEntry.h" namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/entity/ScGuest.hpp b/src/openrct2/scripting/bindings/entity/ScGuest.hpp index 02947955b1..69d36bcaf3 100644 --- a/src/openrct2/scripting/bindings/entity/ScGuest.hpp +++ b/src/openrct2/scripting/bindings/entity/ScGuest.hpp @@ -11,9 +11,9 @@ #ifdef ENABLE_SCRIPTING -# include "../../../entity/Guest.h" -# include "../../../management/Marketing.h" -# include "ScPeep.hpp" + #include "../../../entity/Guest.h" + #include "../../../management/Marketing.h" + #include "ScPeep.hpp" enum class PeepAnimationType : uint8_t; diff --git a/src/openrct2/scripting/bindings/entity/ScLitter.cpp b/src/openrct2/scripting/bindings/entity/ScLitter.cpp index 67177cdef5..d6cef1eecc 100644 --- a/src/openrct2/scripting/bindings/entity/ScLitter.cpp +++ b/src/openrct2/scripting/bindings/entity/ScLitter.cpp @@ -9,9 +9,9 @@ #ifdef ENABLE_SCRIPTING -# include "ScLitter.hpp" + #include "ScLitter.hpp" -# include "../../../entity/Litter.h" + #include "../../../entity/Litter.h" namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/entity/ScLitter.hpp b/src/openrct2/scripting/bindings/entity/ScLitter.hpp index 6f83ae3d09..4cd837cf08 100644 --- a/src/openrct2/scripting/bindings/entity/ScLitter.hpp +++ b/src/openrct2/scripting/bindings/entity/ScLitter.hpp @@ -11,7 +11,7 @@ #ifdef ENABLE_SCRIPTING -# include "ScEntity.hpp" + #include "ScEntity.hpp" struct Litter; diff --git a/src/openrct2/scripting/bindings/entity/ScParticle.hpp b/src/openrct2/scripting/bindings/entity/ScParticle.hpp index 1dbdec41dc..2798e281d6 100644 --- a/src/openrct2/scripting/bindings/entity/ScParticle.hpp +++ b/src/openrct2/scripting/bindings/entity/ScParticle.hpp @@ -11,11 +11,11 @@ #ifdef ENABLE_SCRIPTING -# include "../../../entity/Particle.h" -# include "../../../world/Location.hpp" -# include "ScEntity.hpp" + #include "../../../entity/Particle.h" + #include "../../../world/Location.hpp" + #include "ScEntity.hpp" -# include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/entity/ScPeep.hpp b/src/openrct2/scripting/bindings/entity/ScPeep.hpp index 8cc4d4287a..9846349944 100644 --- a/src/openrct2/scripting/bindings/entity/ScPeep.hpp +++ b/src/openrct2/scripting/bindings/entity/ScPeep.hpp @@ -11,7 +11,7 @@ #ifdef ENABLE_SCRIPTING -# include "ScEntity.hpp" + #include "ScEntity.hpp" namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/entity/ScStaff.cpp b/src/openrct2/scripting/bindings/entity/ScStaff.cpp index 3f6b993ad5..8123de9f37 100644 --- a/src/openrct2/scripting/bindings/entity/ScStaff.cpp +++ b/src/openrct2/scripting/bindings/entity/ScStaff.cpp @@ -9,11 +9,11 @@ #ifdef ENABLE_SCRIPTING -# include "ScStaff.hpp" + #include "ScStaff.hpp" -# include "../../../entity/PatrolArea.h" -# include "../../../entity/Staff.h" -# include "../../../peep/PeepAnimationData.h" + #include "../../../entity/PatrolArea.h" + #include "../../../entity/Staff.h" + #include "../../../peep/PeepAnimationData.h" namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/entity/ScStaff.hpp b/src/openrct2/scripting/bindings/entity/ScStaff.hpp index 112431e4a0..12bb57819f 100644 --- a/src/openrct2/scripting/bindings/entity/ScStaff.hpp +++ b/src/openrct2/scripting/bindings/entity/ScStaff.hpp @@ -11,9 +11,9 @@ #ifdef ENABLE_SCRIPTING -# include "ScPeep.hpp" + #include "ScPeep.hpp" -# include + #include enum class PeepAnimationType : uint8_t; enum class StaffType : uint8_t; diff --git a/src/openrct2/scripting/bindings/entity/ScVehicle.hpp b/src/openrct2/scripting/bindings/entity/ScVehicle.hpp index 4837bf6cbe..7955a162a7 100644 --- a/src/openrct2/scripting/bindings/entity/ScVehicle.hpp +++ b/src/openrct2/scripting/bindings/entity/ScVehicle.hpp @@ -11,10 +11,10 @@ #ifdef ENABLE_SCRIPTING -# include "../../../ride/Ride.h" -# include "ScEntity.hpp" + #include "../../../ride/Ride.h" + #include "ScEntity.hpp" -# include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/game/ScCheats.hpp b/src/openrct2/scripting/bindings/game/ScCheats.hpp index 4ba6849a8b..c69a41cb1c 100644 --- a/src/openrct2/scripting/bindings/game/ScCheats.hpp +++ b/src/openrct2/scripting/bindings/game/ScCheats.hpp @@ -11,10 +11,10 @@ #ifdef ENABLE_SCRIPTING -# include "../../../Cheats.h" -# include "../../../GameState.h" -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" + #include "../../../Cheats.h" + #include "../../../GameState.h" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/game/ScConfiguration.hpp b/src/openrct2/scripting/bindings/game/ScConfiguration.hpp index 452aa69094..699714a8e9 100644 --- a/src/openrct2/scripting/bindings/game/ScConfiguration.hpp +++ b/src/openrct2/scripting/bindings/game/ScConfiguration.hpp @@ -11,11 +11,11 @@ #ifdef ENABLE_SCRIPTING -# include "../../../Context.h" -# include "../../../config/Config.h" -# include "../../../localisation/LocalisationService.h" -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" + #include "../../../Context.h" + #include "../../../config/Config.h" + #include "../../../localisation/LocalisationService.h" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/game/ScConsole.hpp b/src/openrct2/scripting/bindings/game/ScConsole.hpp index d5d13468a5..88d18d8ddc 100644 --- a/src/openrct2/scripting/bindings/game/ScConsole.hpp +++ b/src/openrct2/scripting/bindings/game/ScConsole.hpp @@ -11,9 +11,9 @@ #ifdef ENABLE_SCRIPTING -# include "../../../interface/InteractiveConsole.h" -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" + #include "../../../interface/InteractiveConsole.h" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/game/ScContext.hpp b/src/openrct2/scripting/bindings/game/ScContext.hpp index 8760ea6373..e1a28cbc92 100644 --- a/src/openrct2/scripting/bindings/game/ScContext.hpp +++ b/src/openrct2/scripting/bindings/game/ScContext.hpp @@ -11,23 +11,23 @@ #ifdef ENABLE_SCRIPTING -# include "../../../OpenRCT2.h" -# include "../../../actions/GameAction.h" -# include "../../../interface/Screenshot.h" -# include "../../../localisation/Formatting.h" -# include "../../../object/ObjectManager.h" -# include "../../../scenario/Scenario.h" -# include "../../Duktape.hpp" -# include "../../HookEngine.h" -# include "../../IconNames.hpp" -# include "../../ScriptEngine.h" -# include "../game/ScConfiguration.hpp" -# include "../game/ScDisposable.hpp" -# include "../object/ScObjectManager.h" -# include "../ride/ScTrackSegment.h" + #include "../../../OpenRCT2.h" + #include "../../../actions/GameAction.h" + #include "../../../interface/Screenshot.h" + #include "../../../localisation/Formatting.h" + #include "../../../object/ObjectManager.h" + #include "../../../scenario/Scenario.h" + #include "../../Duktape.hpp" + #include "../../HookEngine.h" + #include "../../IconNames.hpp" + #include "../../ScriptEngine.h" + #include "../game/ScConfiguration.hpp" + #include "../game/ScDisposable.hpp" + #include "../object/ScObjectManager.h" + #include "../ride/ScTrackSegment.h" -# include -# include + #include + #include namespace OpenRCT2::Scripting { @@ -267,12 +267,12 @@ namespace OpenRCT2::Scripting return 1; } -# ifdef _MSC_VER + #ifdef _MSC_VER // HACK workaround to resolve issue #14853 // The exception thrown in duk_error was causing a crash when RAII kicked in for this lambda. // Only ensuring it was not in the same generated method fixed it. __declspec(noinline) -# endif + #endif std::shared_ptr CreateSubscription(HOOK_TYPE hookType, const DukValue& callback) { diff --git a/src/openrct2/scripting/bindings/game/ScDisposable.hpp b/src/openrct2/scripting/bindings/game/ScDisposable.hpp index 761d7b204f..79e976afa7 100644 --- a/src/openrct2/scripting/bindings/game/ScDisposable.hpp +++ b/src/openrct2/scripting/bindings/game/ScDisposable.hpp @@ -11,9 +11,9 @@ #ifdef ENABLE_SCRIPTING -# include "../../Duktape.hpp" + #include "../../Duktape.hpp" -# include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/game/ScPlugin.hpp b/src/openrct2/scripting/bindings/game/ScPlugin.hpp index 0253b08e56..834f02472c 100644 --- a/src/openrct2/scripting/bindings/game/ScPlugin.hpp +++ b/src/openrct2/scripting/bindings/game/ScPlugin.hpp @@ -11,9 +11,9 @@ #ifdef ENABLE_SCRIPTING -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" -# include "../game/ScContext.hpp" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" + #include "../game/ScContext.hpp" namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/game/ScProfiler.hpp b/src/openrct2/scripting/bindings/game/ScProfiler.hpp index 27843c12b4..67ab448e15 100644 --- a/src/openrct2/scripting/bindings/game/ScProfiler.hpp +++ b/src/openrct2/scripting/bindings/game/ScProfiler.hpp @@ -11,8 +11,8 @@ #ifdef ENABLE_SCRIPTING -# include "../../../profiling/Profiling.h" -# include "../../Duktape.hpp" + #include "../../../profiling/Profiling.h" + #include "../../Duktape.hpp" namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/network/ScNetwork.cpp b/src/openrct2/scripting/bindings/network/ScNetwork.cpp index a3b1f08f5c..bc3ac9b55e 100644 --- a/src/openrct2/scripting/bindings/network/ScNetwork.cpp +++ b/src/openrct2/scripting/bindings/network/ScNetwork.cpp @@ -9,13 +9,13 @@ #ifdef ENABLE_SCRIPTING -# include "ScNetwork.hpp" + #include "ScNetwork.hpp" -# include "../../../Context.h" -# include "../../../actions/NetworkModifyGroupAction.h" -# include "../../../actions/PlayerKickAction.h" -# include "../../../network/NetworkAction.h" -# include "../../../network/network.h" + #include "../../../Context.h" + #include "../../../actions/NetworkModifyGroupAction.h" + #include "../../../actions/PlayerKickAction.h" + #include "../../../network/NetworkAction.h" + #include "../../../network/network.h" namespace OpenRCT2::Scripting { @@ -26,7 +26,7 @@ namespace OpenRCT2::Scripting std::string ScNetwork::mode_get() const { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK switch (NetworkGetMode()) { case NETWORK_MODE_SERVER: @@ -34,86 +34,86 @@ namespace OpenRCT2::Scripting case NETWORK_MODE_CLIENT: return "client"; } -# endif + #endif return "none"; } int32_t ScNetwork::numPlayers_get() const { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK return NetworkGetNumPlayers(); -# else + #else return 0; -# endif + #endif } int32_t ScNetwork::numGroups_get() const { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK return NetworkGetNumGroups(); -# else + #else return 0; -# endif + #endif } int32_t ScNetwork::defaultGroup_get() const { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK return NetworkGetDefaultGroup(); -# else + #else return 0; -# endif + #endif } void ScNetwork::defaultGroup_set(int32_t value) { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK auto action = NetworkModifyGroupAction(ModifyGroupType::SetDefault, value); GameActions::Execute(&action); -# endif + #endif } std::vector> ScNetwork::groups_get() const { std::vector> groups; -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK auto numGroups = NetworkGetNumGroups(); for (int32_t i = 0; i < numGroups; i++) { auto groupId = NetworkGetGroupID(i); groups.push_back(std::make_shared(groupId)); } -# endif + #endif return groups; } std::vector> ScNetwork::players_get() const { std::vector> players; -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK auto numPlayers = NetworkGetNumPlayers(); for (int32_t i = 0; i < numPlayers; i++) { auto playerId = NetworkGetPlayerID(i); players.push_back(std::make_shared(playerId)); } -# endif + #endif return players; } std::shared_ptr ScNetwork::currentPlayer_get() const { std::shared_ptr player; -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK auto playerId = NetworkGetCurrentPlayerId(); player = std::make_shared(playerId); -# endif + #endif return player; } std::shared_ptr ScNetwork::getPlayer(int32_t id) const { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK if (GetTargetAPIVersion() < API_VERSION_77_NETWORK_IDS) { auto index = id; @@ -133,13 +133,13 @@ namespace OpenRCT2::Scripting } } -# endif + #endif return nullptr; } DukValue ScNetwork::stats_get() const { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK auto obj = OpenRCT2::Scripting::DukObject(_context); auto networkStats = NetworkGetStats(); { @@ -165,14 +165,14 @@ namespace OpenRCT2::Scripting obj.Set("bytesSent", DukValue::take_from_stack(_context)); } return obj.Take(); -# else + #else return ToDuk(_context, nullptr); -# endif + #endif } std::shared_ptr ScNetwork::getGroup(int32_t id) const { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK if (GetTargetAPIVersion() < API_VERSION_77_NETWORK_IDS) { auto index = id; @@ -191,21 +191,21 @@ namespace OpenRCT2::Scripting return std::make_shared(id); } } -# endif + #endif return nullptr; } void ScNetwork::addGroup() { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK auto networkModifyGroup = NetworkModifyGroupAction(ModifyGroupType::AddGroup); GameActions::Execute(&networkModifyGroup); -# endif + #endif } void ScNetwork::removeGroup(int32_t id) { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK if (GetTargetAPIVersion() < API_VERSION_77_NETWORK_IDS) { auto index = id; @@ -226,12 +226,12 @@ namespace OpenRCT2::Scripting GameActions::Execute(&networkAction); } } -# endif + #endif } void ScNetwork::kickPlayer(int32_t id) { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK if (GetTargetAPIVersion() < API_VERSION_77_NETWORK_IDS) { auto index = id; @@ -252,12 +252,12 @@ namespace OpenRCT2::Scripting GameActions::Execute(&kickPlayerAction); } } -# endif + #endif } void ScNetwork::sendMessage(std::string message, DukValue players) { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK if (players.is_array()) { if (NetworkGetMode() == NETWORK_MODE_SERVER) @@ -285,10 +285,10 @@ namespace OpenRCT2::Scripting { NetworkSendChat(message.c_str()); } -# endif + #endif } -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK std::shared_ptr ScNetwork::createListener() { auto& scriptEngine = GetContext()->GetScriptEngine(); @@ -297,14 +297,14 @@ namespace OpenRCT2::Scripting scriptEngine.AddSocket(socket); return socket; } -# else + #else void ScNetwork::createListener() { duk_error(_context, DUK_ERR_ERROR, "Networking has been disabled."); } -# endif + #endif -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK std::shared_ptr ScNetwork::createSocket() { auto& scriptEngine = GetContext()->GetScriptEngine(); @@ -313,12 +313,12 @@ namespace OpenRCT2::Scripting scriptEngine.AddSocket(socket); return socket; } -# else + #else void ScNetwork::createSocket() { duk_error(_context, DUK_ERR_ERROR, "Networking has been disabled."); } -# endif + #endif void ScNetwork::Register(duk_context* ctx) { diff --git a/src/openrct2/scripting/bindings/network/ScNetwork.hpp b/src/openrct2/scripting/bindings/network/ScNetwork.hpp index d1b65c8db4..07b14a84d4 100644 --- a/src/openrct2/scripting/bindings/network/ScNetwork.hpp +++ b/src/openrct2/scripting/bindings/network/ScNetwork.hpp @@ -11,21 +11,21 @@ #ifdef ENABLE_SCRIPTING -# include "../../Duktape.hpp" -# include "ScPlayer.hpp" -# include "ScPlayerGroup.hpp" -# include "ScSocket.hpp" + #include "../../Duktape.hpp" + #include "ScPlayer.hpp" + #include "ScPlayerGroup.hpp" + #include "ScSocket.hpp" -# include + #include namespace OpenRCT2::Scripting { class ScNetwork { private: -# ifdef __clang__ + #ifdef __clang__ [[maybe_unused]] -# endif + #endif duk_context* _context; public: @@ -57,17 +57,17 @@ namespace OpenRCT2::Scripting void sendMessage(std::string message, DukValue players); -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK std::shared_ptr createListener(); -# else + #else void createListener(); -# endif + #endif -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK std::shared_ptr createSocket(); -# else + #else void createSocket(); -# endif + #endif static void Register(duk_context* ctx); }; diff --git a/src/openrct2/scripting/bindings/network/ScPlayer.cpp b/src/openrct2/scripting/bindings/network/ScPlayer.cpp index 2af77ef49d..56362bce3f 100644 --- a/src/openrct2/scripting/bindings/network/ScPlayer.cpp +++ b/src/openrct2/scripting/bindings/network/ScPlayer.cpp @@ -9,12 +9,12 @@ #ifdef ENABLE_SCRIPTING -# include "ScPlayer.hpp" + #include "ScPlayer.hpp" -# include "../../../Context.h" -# include "../../../actions/PlayerSetGroupAction.h" -# include "../../../network/NetworkAction.h" -# include "../../../network/network.h" + #include "../../../Context.h" + #include "../../../actions/PlayerSetGroupAction.h" + #include "../../../network/NetworkAction.h" + #include "../../../network/network.h" namespace OpenRCT2::Scripting { @@ -30,69 +30,69 @@ namespace OpenRCT2::Scripting std::string ScPlayer::name_get() const { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK auto index = NetworkGetPlayerIndex(_id); if (index == -1) return {}; return NetworkGetPlayerName(index); -# else + #else return {}; -# endif + #endif } int32_t ScPlayer::group_get() const { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK auto index = NetworkGetPlayerIndex(_id); if (index == -1) return {}; return NetworkGetPlayerGroup(index); -# else + #else return 0; -# endif + #endif } void ScPlayer::group_set(int32_t value) { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK auto playerSetGroupAction = PlayerSetGroupAction(_id, value); GameActions::Execute(&playerSetGroupAction); -# endif + #endif } int32_t ScPlayer::ping_get() const { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK auto index = NetworkGetPlayerIndex(_id); if (index == -1) return {}; return NetworkGetPlayerPing(index); -# else + #else return 0; -# endif + #endif } int32_t ScPlayer::commandsRan_get() const { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK auto index = NetworkGetPlayerIndex(_id); if (index == -1) return {}; return NetworkGetPlayerCommandsRan(index); -# else + #else return 0; -# endif + #endif } int32_t ScPlayer::moneySpent_get() const { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK auto index = NetworkGetPlayerIndex(_id); if (index == -1) return {}; return NetworkGetPlayerMoneySpent(index); -# else + #else return 0; -# endif + #endif } std::string ScPlayer::ipAddress_get() const diff --git a/src/openrct2/scripting/bindings/network/ScPlayer.hpp b/src/openrct2/scripting/bindings/network/ScPlayer.hpp index 1826597953..056dea1205 100644 --- a/src/openrct2/scripting/bindings/network/ScPlayer.hpp +++ b/src/openrct2/scripting/bindings/network/ScPlayer.hpp @@ -11,9 +11,9 @@ #ifdef ENABLE_SCRIPTING -# include "../../Duktape.hpp" + #include "../../Duktape.hpp" -# include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/network/ScPlayerGroup.cpp b/src/openrct2/scripting/bindings/network/ScPlayerGroup.cpp index 4ba8be2ebf..2bae124bdd 100644 --- a/src/openrct2/scripting/bindings/network/ScPlayerGroup.cpp +++ b/src/openrct2/scripting/bindings/network/ScPlayerGroup.cpp @@ -9,15 +9,15 @@ #ifdef ENABLE_SCRIPTING -# include "ScPlayerGroup.hpp" + #include "ScPlayerGroup.hpp" -# include "../../../Context.h" -# include "../../../actions/NetworkModifyGroupAction.h" -# include "../../../actions/PlayerSetGroupAction.h" -# include "../../../core/String.hpp" -# include "../../../network/NetworkAction.h" -# include "../../../network/network.h" -# include "../../Duktape.hpp" + #include "../../../Context.h" + #include "../../../actions/NetworkModifyGroupAction.h" + #include "../../../actions/PlayerSetGroupAction.h" + #include "../../../core/String.hpp" + #include "../../../network/NetworkAction.h" + #include "../../../network/network.h" + #include "../../Duktape.hpp" namespace OpenRCT2::Scripting { @@ -33,25 +33,25 @@ namespace OpenRCT2::Scripting std::string ScPlayerGroup::name_get() const { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK auto index = NetworkGetGroupIndex(_id); if (index == -1) return {}; return NetworkGetGroupName(index); -# else + #else return {}; -# endif + #endif } void ScPlayerGroup::name_set(std::string value) { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK auto action = NetworkModifyGroupAction(ModifyGroupType::SetName, _id, value); GameActions::Execute(&action); -# endif + #endif } -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK static std::string TransformPermissionKeyToJS(const std::string& s) { auto result = s.substr(sizeof("PERMISSION_") - 1); @@ -66,11 +66,11 @@ namespace OpenRCT2::Scripting { return "PERMISSION_" + String::ToUpper(s); } -# endif + #endif std::vector ScPlayerGroup::permissions_get() const { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK auto index = NetworkGetGroupIndex(_id); if (index == -1) return {}; @@ -87,14 +87,14 @@ namespace OpenRCT2::Scripting permissionIndex++; } return result; -# else + #else return {}; -# endif + #endif } void ScPlayerGroup::permissions_set(std::vector value) { -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK auto groupIndex = NetworkGetGroupIndex(_id); if (groupIndex == -1) return; @@ -131,7 +131,7 @@ namespace OpenRCT2::Scripting GameActions::Execute(&networkAction2); } } -# endif + #endif } void ScPlayerGroup::Register(duk_context* ctx) diff --git a/src/openrct2/scripting/bindings/network/ScPlayerGroup.hpp b/src/openrct2/scripting/bindings/network/ScPlayerGroup.hpp index f97a03bfc0..b2854ec0f3 100644 --- a/src/openrct2/scripting/bindings/network/ScPlayerGroup.hpp +++ b/src/openrct2/scripting/bindings/network/ScPlayerGroup.hpp @@ -11,10 +11,10 @@ #ifdef ENABLE_SCRIPTING -# include "../../Duktape.hpp" + #include "../../Duktape.hpp" -# include -# include + #include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/network/ScSocket.hpp b/src/openrct2/scripting/bindings/network/ScSocket.hpp index f5a6ab4e0d..1f9849993c 100644 --- a/src/openrct2/scripting/bindings/network/ScSocket.hpp +++ b/src/openrct2/scripting/bindings/network/ScSocket.hpp @@ -10,16 +10,16 @@ #pragma once #ifdef ENABLE_SCRIPTING -# ifndef DISABLE_NETWORK + #ifndef DISABLE_NETWORK -# include "../../../Context.h" -# include "../../../config/Config.h" -# include "../../../network/Socket.h" -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" + #include "../../../Context.h" + #include "../../../config/Config.h" + #include "../../../network/Socket.h" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" -# include -# include + #include + #include namespace OpenRCT2::Scripting { @@ -556,5 +556,5 @@ namespace OpenRCT2::Scripting }; } // namespace OpenRCT2::Scripting -# endif + #endif #endif diff --git a/src/openrct2/scripting/bindings/object/ScInstalledObject.hpp b/src/openrct2/scripting/bindings/object/ScInstalledObject.hpp index 7590eba2ee..57fc102304 100644 --- a/src/openrct2/scripting/bindings/object/ScInstalledObject.hpp +++ b/src/openrct2/scripting/bindings/object/ScInstalledObject.hpp @@ -11,12 +11,12 @@ #ifdef ENABLE_SCRIPTING -# include "../../../Context.h" -# include "../../../object/ObjectRepository.h" -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" + #include "../../../Context.h" + #include "../../../object/ObjectRepository.h" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" -# include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/object/ScObject.hpp b/src/openrct2/scripting/bindings/object/ScObject.hpp index 0f41cbc1b9..08c68c705c 100644 --- a/src/openrct2/scripting/bindings/object/ScObject.hpp +++ b/src/openrct2/scripting/bindings/object/ScObject.hpp @@ -11,18 +11,18 @@ #ifdef ENABLE_SCRIPTING -# include "../../../Context.h" -# include "../../../object/LargeSceneryObject.h" -# include "../../../object/ObjectManager.h" -# include "../../../object/RideObject.h" -# include "../../../object/SceneryGroupObject.h" -# include "../../../object/SmallSceneryObject.h" -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" -# include "ScInstalledObject.hpp" + #include "../../../Context.h" + #include "../../../object/LargeSceneryObject.h" + #include "../../../object/ObjectManager.h" + #include "../../../object/RideObject.h" + #include "../../../object/SceneryGroupObject.h" + #include "../../../object/SmallSceneryObject.h" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" + #include "ScInstalledObject.hpp" -# include -# include + #include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/object/ScObjectManager.cpp b/src/openrct2/scripting/bindings/object/ScObjectManager.cpp index 39742f16e4..b17ff1033d 100644 --- a/src/openrct2/scripting/bindings/object/ScObjectManager.cpp +++ b/src/openrct2/scripting/bindings/object/ScObjectManager.cpp @@ -9,12 +9,12 @@ #ifdef ENABLE_SCRIPTING -# include "ScObjectManager.h" + #include "ScObjectManager.h" -# include "../../../object/ObjectList.h" -# include "../../../ride/RideData.h" -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" + #include "../../../object/ObjectList.h" + #include "../../../ride/RideData.h" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" using namespace OpenRCT2; using namespace OpenRCT2::Scripting; diff --git a/src/openrct2/scripting/bindings/object/ScObjectManager.h b/src/openrct2/scripting/bindings/object/ScObjectManager.h index 4a440c019c..de3e3195e0 100644 --- a/src/openrct2/scripting/bindings/object/ScObjectManager.h +++ b/src/openrct2/scripting/bindings/object/ScObjectManager.h @@ -11,12 +11,12 @@ #ifdef ENABLE_SCRIPTING -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" -# include "ScInstalledObject.hpp" -# include "ScObject.hpp" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" + #include "ScInstalledObject.hpp" + #include "ScObject.hpp" -# include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/ride/ScRide.cpp b/src/openrct2/scripting/bindings/ride/ScRide.cpp index 60566ead32..5698a6f805 100644 --- a/src/openrct2/scripting/bindings/ride/ScRide.cpp +++ b/src/openrct2/scripting/bindings/ride/ScRide.cpp @@ -9,15 +9,15 @@ #ifdef ENABLE_SCRIPTING -# include "ScRide.hpp" + #include "ScRide.hpp" -# include "../../../Context.h" -# include "../../../core/UnitConversion.h" -# include "../../../ride/Ride.h" -# include "../../../ride/RideData.h" -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" -# include "../object/ScObject.hpp" + #include "../../../Context.h" + #include "../../../core/UnitConversion.h" + #include "../../../ride/Ride.h" + #include "../../../ride/RideData.h" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" + #include "../object/ScObject.hpp" namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/ride/ScRide.hpp b/src/openrct2/scripting/bindings/ride/ScRide.hpp index a1f3165630..fcff9e1cdc 100644 --- a/src/openrct2/scripting/bindings/ride/ScRide.hpp +++ b/src/openrct2/scripting/bindings/ride/ScRide.hpp @@ -11,12 +11,12 @@ #ifdef ENABLE_SCRIPTING -# include "../../../Context.h" -# include "../../../ride/Ride.h" -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" -# include "../object/ScObject.hpp" -# include "ScRideStation.hpp" + #include "../../../Context.h" + #include "../../../ride/Ride.h" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" + #include "../object/ScObject.hpp" + #include "ScRideStation.hpp" namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/ride/ScRideStation.cpp b/src/openrct2/scripting/bindings/ride/ScRideStation.cpp index 18a4c9e8b4..c1363486fd 100644 --- a/src/openrct2/scripting/bindings/ride/ScRideStation.cpp +++ b/src/openrct2/scripting/bindings/ride/ScRideStation.cpp @@ -9,13 +9,13 @@ #ifdef ENABLE_SCRIPTING -# include "ScRideStation.hpp" + #include "ScRideStation.hpp" -# include "../../../Context.h" -# include "../../../ride/Ride.h" -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" -# include "../object/ScObject.hpp" + #include "../../../Context.h" + #include "../../../ride/Ride.h" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" + #include "../object/ScObject.hpp" namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/ride/ScRideStation.hpp b/src/openrct2/scripting/bindings/ride/ScRideStation.hpp index 9dd604290e..34c0207da9 100644 --- a/src/openrct2/scripting/bindings/ride/ScRideStation.hpp +++ b/src/openrct2/scripting/bindings/ride/ScRideStation.hpp @@ -11,9 +11,9 @@ #ifdef ENABLE_SCRIPTING -# include "../../../Context.h" -# include "../../../ride/Ride.h" -# include "../../Duktape.hpp" + #include "../../../Context.h" + #include "../../../ride/Ride.h" + #include "../../Duktape.hpp" namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/ride/ScTrackIterator.cpp b/src/openrct2/scripting/bindings/ride/ScTrackIterator.cpp index a54e151b83..93283e907d 100644 --- a/src/openrct2/scripting/bindings/ride/ScTrackIterator.cpp +++ b/src/openrct2/scripting/bindings/ride/ScTrackIterator.cpp @@ -9,14 +9,14 @@ #ifdef ENABLE_SCRIPTING -# include "ScTrackIterator.h" + #include "ScTrackIterator.h" -# include "../../../Context.h" -# include "../../../ride/Ride.h" -# include "../../../ride/TrackData.h" -# include "../../../world/tile_element/TrackElement.h" -# include "../../ScriptEngine.h" -# include "ScTrackSegment.h" + #include "../../../Context.h" + #include "../../../ride/Ride.h" + #include "../../../ride/TrackData.h" + #include "../../../world/tile_element/TrackElement.h" + #include "../../ScriptEngine.h" + #include "ScTrackSegment.h" using namespace OpenRCT2::Scripting; using namespace OpenRCT2::TrackMetaData; diff --git a/src/openrct2/scripting/bindings/ride/ScTrackIterator.h b/src/openrct2/scripting/bindings/ride/ScTrackIterator.h index b3a977e957..6c5353afff 100644 --- a/src/openrct2/scripting/bindings/ride/ScTrackIterator.h +++ b/src/openrct2/scripting/bindings/ride/ScTrackIterator.h @@ -11,11 +11,11 @@ #ifdef ENABLE_SCRIPTING -# include "../../../Identifiers.h" -# include "../../Duktape.hpp" + #include "../../../Identifiers.h" + #include "../../Duktape.hpp" -# include -# include + #include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/ride/ScTrackSegment.cpp b/src/openrct2/scripting/bindings/ride/ScTrackSegment.cpp index 4a3c469eac..27da8c20cc 100644 --- a/src/openrct2/scripting/bindings/ride/ScTrackSegment.cpp +++ b/src/openrct2/scripting/bindings/ride/ScTrackSegment.cpp @@ -9,12 +9,12 @@ #ifdef ENABLE_SCRIPTING -# include "ScTrackSegment.h" + #include "ScTrackSegment.h" -# include "../../../Context.h" -# include "../../../ride/TrackData.h" -# include "../../../ride/Vehicle.h" -# include "../../ScriptEngine.h" + #include "../../../Context.h" + #include "../../../ride/TrackData.h" + #include "../../../ride/Vehicle.h" + #include "../../ScriptEngine.h" using namespace OpenRCT2::Scripting; using namespace OpenRCT2::TrackMetaData; diff --git a/src/openrct2/scripting/bindings/ride/ScTrackSegment.h b/src/openrct2/scripting/bindings/ride/ScTrackSegment.h index 92722711aa..3eee4d37af 100644 --- a/src/openrct2/scripting/bindings/ride/ScTrackSegment.h +++ b/src/openrct2/scripting/bindings/ride/ScTrackSegment.h @@ -11,10 +11,10 @@ #ifdef ENABLE_SCRIPTING -# include "../../Duktape.hpp" + #include "../../Duktape.hpp" -# include -# include + #include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/world/ScClimate.hpp b/src/openrct2/scripting/bindings/world/ScClimate.hpp index 677e658464..91d8c3d5fc 100644 --- a/src/openrct2/scripting/bindings/world/ScClimate.hpp +++ b/src/openrct2/scripting/bindings/world/ScClimate.hpp @@ -11,12 +11,12 @@ #ifdef ENABLE_SCRIPTING -# include "../../../Context.h" -# include "../../../GameState.h" -# include "../../../core/StringTypes.h" -# include "../../../world/Climate.h" -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" + #include "../../../Context.h" + #include "../../../GameState.h" + #include "../../../core/StringTypes.h" + #include "../../../world/Climate.h" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/world/ScDate.hpp b/src/openrct2/scripting/bindings/world/ScDate.hpp index a04b0a201f..27bcafdc60 100644 --- a/src/openrct2/scripting/bindings/world/ScDate.hpp +++ b/src/openrct2/scripting/bindings/world/ScDate.hpp @@ -11,13 +11,13 @@ #ifdef ENABLE_SCRIPTING -# include "../../../Context.h" -# include "../../../Date.h" -# include "../../../Game.h" -# include "../../../GameState.h" -# include "../../../localisation/Localisation.Date.h" -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" + #include "../../../Context.h" + #include "../../../Date.h" + #include "../../../Game.h" + #include "../../../GameState.h" + #include "../../../localisation/Localisation.Date.h" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/world/ScMap.cpp b/src/openrct2/scripting/bindings/world/ScMap.cpp index de59a8c083..8269838f6b 100644 --- a/src/openrct2/scripting/bindings/world/ScMap.cpp +++ b/src/openrct2/scripting/bindings/world/ScMap.cpp @@ -9,31 +9,31 @@ #ifdef ENABLE_SCRIPTING -# include "ScMap.hpp" + #include "ScMap.hpp" -# include "../../../GameState.h" -# include "../../../entity/Balloon.h" -# include "../../../entity/Duck.h" -# include "../../../entity/EntityList.h" -# include "../../../entity/Fountain.h" -# include "../../../entity/Guest.h" -# include "../../../entity/Litter.h" -# include "../../../entity/MoneyEffect.h" -# include "../../../entity/Particle.h" -# include "../../../entity/Staff.h" -# include "../../../ride/Ride.h" -# include "../../../ride/TrainManager.h" -# include "../../../world/Map.h" -# include "../../Duktape.hpp" -# include "../entity/ScEntity.hpp" -# include "../entity/ScGuest.hpp" -# include "../entity/ScLitter.hpp" -# include "../entity/ScParticle.hpp" -# include "../entity/ScStaff.hpp" -# include "../entity/ScVehicle.hpp" -# include "../ride/ScRide.hpp" -# include "../ride/ScTrackIterator.h" -# include "../world/ScTile.hpp" + #include "../../../GameState.h" + #include "../../../entity/Balloon.h" + #include "../../../entity/Duck.h" + #include "../../../entity/EntityList.h" + #include "../../../entity/Fountain.h" + #include "../../../entity/Guest.h" + #include "../../../entity/Litter.h" + #include "../../../entity/MoneyEffect.h" + #include "../../../entity/Particle.h" + #include "../../../entity/Staff.h" + #include "../../../ride/Ride.h" + #include "../../../ride/TrainManager.h" + #include "../../../world/Map.h" + #include "../../Duktape.hpp" + #include "../entity/ScEntity.hpp" + #include "../entity/ScGuest.hpp" + #include "../entity/ScLitter.hpp" + #include "../entity/ScParticle.hpp" + #include "../entity/ScStaff.hpp" + #include "../entity/ScVehicle.hpp" + #include "../ride/ScRide.hpp" + #include "../ride/ScTrackIterator.h" + #include "../world/ScTile.hpp" namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/world/ScMap.hpp b/src/openrct2/scripting/bindings/world/ScMap.hpp index dcae067c71..718f40115a 100644 --- a/src/openrct2/scripting/bindings/world/ScMap.hpp +++ b/src/openrct2/scripting/bindings/world/ScMap.hpp @@ -11,10 +11,10 @@ #ifdef ENABLE_SCRIPTING -# include "../../Duktape.hpp" -# include "../ride/ScRide.hpp" -# include "../ride/ScTrackIterator.h" -# include "../world/ScTile.hpp" + #include "../../Duktape.hpp" + #include "../ride/ScRide.hpp" + #include "../ride/ScTrackIterator.h" + #include "../world/ScTile.hpp" namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/world/ScPark.cpp b/src/openrct2/scripting/bindings/world/ScPark.cpp index 91a497da87..a6a6af0d9d 100644 --- a/src/openrct2/scripting/bindings/world/ScPark.cpp +++ b/src/openrct2/scripting/bindings/world/ScPark.cpp @@ -9,21 +9,21 @@ #ifdef ENABLE_SCRIPTING -# include "ScPark.hpp" + #include "ScPark.hpp" -# include "../../../Context.h" -# include "../../../Date.h" -# include "../../../GameState.h" -# include "../../../core/String.hpp" -# include "../../../entity/Guest.h" -# include "../../../management/Finance.h" -# include "../../../management/NewsItem.h" -# include "../../../windows/Intent.h" -# include "../../../world/Park.h" -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" -# include "../entity/ScGuest.hpp" -# include "ScParkMessage.hpp" + #include "../../../Context.h" + #include "../../../Date.h" + #include "../../../GameState.h" + #include "../../../core/String.hpp" + #include "../../../entity/Guest.h" + #include "../../../management/Finance.h" + #include "../../../management/NewsItem.h" + #include "../../../windows/Intent.h" + #include "../../../world/Park.h" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" + #include "../entity/ScGuest.hpp" + #include "ScParkMessage.hpp" namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/world/ScPark.hpp b/src/openrct2/scripting/bindings/world/ScPark.hpp index bf590bdefe..250f50b6a4 100644 --- a/src/openrct2/scripting/bindings/world/ScPark.hpp +++ b/src/openrct2/scripting/bindings/world/ScPark.hpp @@ -11,12 +11,12 @@ #ifdef ENABLE_SCRIPTING -# include "../../../Context.h" -# include "../../Duktape.hpp" -# include "ScParkMessage.hpp" -# include "ScResearch.hpp" + #include "../../../Context.h" + #include "../../Duktape.hpp" + #include "ScParkMessage.hpp" + #include "ScResearch.hpp" -# include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/world/ScParkMessage.cpp b/src/openrct2/scripting/bindings/world/ScParkMessage.cpp index 1274b29721..0ccd024262 100644 --- a/src/openrct2/scripting/bindings/world/ScParkMessage.cpp +++ b/src/openrct2/scripting/bindings/world/ScParkMessage.cpp @@ -9,18 +9,18 @@ #ifdef ENABLE_SCRIPTING -# include "ScParkMessage.hpp" + #include "ScParkMessage.hpp" -# include "../../../Context.h" -# include "../../../GameState.h" -# include "../../../core/String.hpp" -# include "../../../entity/Peep.h" -# include "../../../management/Finance.h" -# include "../../../management/NewsItem.h" -# include "../../../windows/Intent.h" -# include "../../../world/Park.h" -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" + #include "../../../Context.h" + #include "../../../GameState.h" + #include "../../../core/String.hpp" + #include "../../../entity/Peep.h" + #include "../../../management/Finance.h" + #include "../../../management/NewsItem.h" + #include "../../../windows/Intent.h" + #include "../../../world/Park.h" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/world/ScParkMessage.hpp b/src/openrct2/scripting/bindings/world/ScParkMessage.hpp index 368311976c..acfb0972a3 100644 --- a/src/openrct2/scripting/bindings/world/ScParkMessage.hpp +++ b/src/openrct2/scripting/bindings/world/ScParkMessage.hpp @@ -11,12 +11,12 @@ #ifdef ENABLE_SCRIPTING -# include "../../../Context.h" -# include "../../../management/NewsItem.h" -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" + #include "../../../Context.h" + #include "../../../management/NewsItem.h" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" -# include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/world/ScResearch.cpp b/src/openrct2/scripting/bindings/world/ScResearch.cpp index e61eb5a4a8..72795f74ab 100644 --- a/src/openrct2/scripting/bindings/world/ScResearch.cpp +++ b/src/openrct2/scripting/bindings/world/ScResearch.cpp @@ -9,16 +9,16 @@ #ifdef ENABLE_SCRIPTING -# include "ScResearch.hpp" + #include "ScResearch.hpp" -# include "../../../Context.h" -# include "../../../GameState.h" -# include "../../../core/String.hpp" -# include "../../../management/Research.h" -# include "../../../ride/RideData.h" -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" -# include "../object/ScObject.hpp" + #include "../../../Context.h" + #include "../../../GameState.h" + #include "../../../core/String.hpp" + #include "../../../management/Research.h" + #include "../../../ride/RideData.h" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" + #include "../object/ScObject.hpp" using namespace OpenRCT2; diff --git a/src/openrct2/scripting/bindings/world/ScResearch.hpp b/src/openrct2/scripting/bindings/world/ScResearch.hpp index e2f7577bb6..dfdff928e6 100644 --- a/src/openrct2/scripting/bindings/world/ScResearch.hpp +++ b/src/openrct2/scripting/bindings/world/ScResearch.hpp @@ -11,7 +11,7 @@ #ifdef ENABLE_SCRIPTING -# include "../../ScriptEngine.h" + #include "../../ScriptEngine.h" namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/world/ScScenario.hpp b/src/openrct2/scripting/bindings/world/ScScenario.hpp index c321f100f1..39d5f73eda 100644 --- a/src/openrct2/scripting/bindings/world/ScScenario.hpp +++ b/src/openrct2/scripting/bindings/world/ScScenario.hpp @@ -11,13 +11,13 @@ #ifdef ENABLE_SCRIPTING -# include "../../../Context.h" -# include "../../../GameState.h" -# include "../../../core/StringTypes.h" -# include "../../../scenario/Scenario.h" -# include "../../../world/Park.h" -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" + #include "../../../Context.h" + #include "../../../GameState.h" + #include "../../../core/StringTypes.h" + #include "../../../scenario/Scenario.h" + #include "../../../world/Park.h" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/world/ScTile.cpp b/src/openrct2/scripting/bindings/world/ScTile.cpp index 795911e97c..77c5986355 100644 --- a/src/openrct2/scripting/bindings/world/ScTile.cpp +++ b/src/openrct2/scripting/bindings/world/ScTile.cpp @@ -9,23 +9,23 @@ #ifdef ENABLE_SCRIPTING -# include "ScTile.hpp" + #include "ScTile.hpp" -# include "../../../Context.h" -# include "../../../core/Guard.hpp" -# include "../../../entity/EntityRegistry.h" -# include "../../../object/LargeSceneryEntry.h" -# include "../../../ride/Track.h" -# include "../../../world/Footpath.h" -# include "../../../world/Scenery.h" -# include "../../../world/tile_element/LargeSceneryElement.h" -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" -# include "ScTileElement.hpp" + #include "../../../Context.h" + #include "../../../core/Guard.hpp" + #include "../../../entity/EntityRegistry.h" + #include "../../../object/LargeSceneryEntry.h" + #include "../../../ride/Track.h" + #include "../../../world/Footpath.h" + #include "../../../world/Scenery.h" + #include "../../../world/tile_element/LargeSceneryElement.h" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" + #include "ScTileElement.hpp" -# include -# include -# include + #include + #include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/world/ScTile.hpp b/src/openrct2/scripting/bindings/world/ScTile.hpp index ff5c2b0271..7df486cfa0 100644 --- a/src/openrct2/scripting/bindings/world/ScTile.hpp +++ b/src/openrct2/scripting/bindings/world/ScTile.hpp @@ -11,14 +11,14 @@ #ifdef ENABLE_SCRIPTING -# include "../../Duktape.hpp" -# include "ScTileElement.hpp" + #include "../../Duktape.hpp" + #include "ScTileElement.hpp" -# include -# include -# include -# include -# include + #include + #include + #include + #include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/world/ScTileElement.cpp b/src/openrct2/scripting/bindings/world/ScTileElement.cpp index dbd13a201c..60a848c1da 100644 --- a/src/openrct2/scripting/bindings/world/ScTileElement.cpp +++ b/src/openrct2/scripting/bindings/world/ScTileElement.cpp @@ -9,32 +9,32 @@ #ifdef ENABLE_SCRIPTING -# include "ScTileElement.hpp" + #include "ScTileElement.hpp" -# include "../../../Context.h" -# include "../../../core/Guard.hpp" -# include "../../../entity/EntityRegistry.h" -# include "../../../object/LargeSceneryEntry.h" -# include "../../../object/WallSceneryEntry.h" -# include "../../../ride/Ride.h" -# include "../../../ride/RideData.h" -# include "../../../ride/Track.h" -# include "../../../world/Footpath.h" -# include "../../../world/Scenery.h" -# include "../../../world/tile_element/BannerElement.h" -# include "../../../world/tile_element/EntranceElement.h" -# include "../../../world/tile_element/LargeSceneryElement.h" -# include "../../../world/tile_element/PathElement.h" -# include "../../../world/tile_element/SmallSceneryElement.h" -# include "../../../world/tile_element/SurfaceElement.h" -# include "../../../world/tile_element/TrackElement.h" -# include "../../../world/tile_element/WallElement.h" -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" + #include "../../../Context.h" + #include "../../../core/Guard.hpp" + #include "../../../entity/EntityRegistry.h" + #include "../../../object/LargeSceneryEntry.h" + #include "../../../object/WallSceneryEntry.h" + #include "../../../ride/Ride.h" + #include "../../../ride/RideData.h" + #include "../../../ride/Track.h" + #include "../../../world/Footpath.h" + #include "../../../world/Scenery.h" + #include "../../../world/tile_element/BannerElement.h" + #include "../../../world/tile_element/EntranceElement.h" + #include "../../../world/tile_element/LargeSceneryElement.h" + #include "../../../world/tile_element/PathElement.h" + #include "../../../world/tile_element/SmallSceneryElement.h" + #include "../../../world/tile_element/SurfaceElement.h" + #include "../../../world/tile_element/TrackElement.h" + #include "../../../world/tile_element/WallElement.h" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" -# include -# include -# include + #include + #include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2/scripting/bindings/world/ScTileElement.hpp b/src/openrct2/scripting/bindings/world/ScTileElement.hpp index b3c45e1343..f91bbe6fa5 100644 --- a/src/openrct2/scripting/bindings/world/ScTileElement.hpp +++ b/src/openrct2/scripting/bindings/world/ScTileElement.hpp @@ -11,18 +11,18 @@ #ifdef ENABLE_SCRIPTING -# include "../../../Context.h" -# include "../../../core/Guard.hpp" -# include "../../../entity/EntityRegistry.h" -# include "../../../ride/Track.h" -# include "../../../world/Footpath.h" -# include "../../../world/Scenery.h" -# include "../../Duktape.hpp" -# include "../../ScriptEngine.h" + #include "../../../Context.h" + #include "../../../core/Guard.hpp" + #include "../../../entity/EntityRegistry.h" + #include "../../../ride/Track.h" + #include "../../../world/Footpath.h" + #include "../../../world/Scenery.h" + #include "../../Duktape.hpp" + #include "../../ScriptEngine.h" -# include -# include -# include + #include + #include + #include namespace OpenRCT2::Scripting { diff --git a/src/openrct2/util/Prefetch.h b/src/openrct2/util/Prefetch.h index 8fbeb40556..146c0800e1 100644 --- a/src/openrct2/util/Prefetch.h +++ b/src/openrct2/util/Prefetch.h @@ -8,27 +8,27 @@ *****************************************************************************/ #if defined(__amd64__) || defined(_M_AMD64) || defined(__i386__) || defined(_M_IX86) -// Don't bother checking for CPUID, prefetch is available since Pentium 4 -# include -// This cannot be expressed as `constexpr` function, exclude it from clang-tidy check -// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) -# define PREFETCH(x) _mm_prefetch(reinterpret_cast(x), _MM_HINT_T0) + // Don't bother checking for CPUID, prefetch is available since Pentium 4 + #include + // This cannot be expressed as `constexpr` function, exclude it from clang-tidy check + // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) + #define PREFETCH(x) _mm_prefetch(reinterpret_cast(x), _MM_HINT_T0) #elif defined(_MSC_VER) && defined(_M_ARM64) -// ARM64 prefetch is available since ARMv8. -// MSVC's help (https://learn.microsoft.com/en-us/cpp/intrinsics/arm64-intrinsics?view=msvc-170) -// is incorrect and points to a different header (arm64_neon.h), which doesn't contain prefetch. -// Correct header info taken from -// https://github.com/microsoft/wdkmetadata/blob/1ac0dd0719f19196334de12cf2a6dec20316d440/generation/WDK/IdlHeaders/km/crt/intrin.h#L2 -// and -// https://github.com/microsoft/wdkmetadata/blob/1ac0dd0719f19196334de12cf2a6dec20316d440/generation/WDK/IdlHeaders/km/crt/intrin.h#L411 -# include -# define PREFETCH(x) __prefetch(x) + // ARM64 prefetch is available since ARMv8. + // MSVC's help (https://learn.microsoft.com/en-us/cpp/intrinsics/arm64-intrinsics?view=msvc-170) + // is incorrect and points to a different header (arm64_neon.h), which doesn't contain prefetch. + // Correct header info taken from + // https://github.com/microsoft/wdkmetadata/blob/1ac0dd0719f19196334de12cf2a6dec20316d440/generation/WDK/IdlHeaders/km/crt/intrin.h#L2 + // and + // https://github.com/microsoft/wdkmetadata/blob/1ac0dd0719f19196334de12cf2a6dec20316d440/generation/WDK/IdlHeaders/km/crt/intrin.h#L411 + #include + #define PREFETCH(x) __prefetch(x) #elif defined(__GNUC__) -// Let the compiler handle prefetch instruction -# define PREFETCH(x) __builtin_prefetch(x) + // Let the compiler handle prefetch instruction + #define PREFETCH(x) __builtin_prefetch(x) #else -# define PREFETCH(x) + #define PREFETCH(x) #endif diff --git a/test/tests/tests.cpp b/test/tests/tests.cpp index 4293d589fe..fbbfa7b8f9 100644 --- a/test/tests/tests.cpp +++ b/test/tests/tests.cpp @@ -11,8 +11,8 @@ // directly into the test binary. #ifdef _MSC_VER -# include -# include + #include + #include int main(int argc, char** argv) {