clang-format: change IndentPPDirectives to BeforeHash (#23287)

This commit is contained in:
Aaron van Geffen 2024-11-29 12:04:56 +09:00 committed by GitHub
parent c8388002d9
commit 3685d1a24b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
173 changed files with 1636 additions and 1636 deletions

View file

@ -62,7 +62,7 @@ IncludeCategories:
- Regex: '^<'
Priority: 2
IndentCaseLabels: true
IndentPPDirectives: AfterHash
IndentPPDirectives: BeforeHash
IndentWidth: 4
IndentWrappedFunctionNames: true
KeepEmptyLinesAtTheStartOfBlocks: false

View file

@ -20,10 +20,10 @@
#include <openrct2/core/UTF8.h>
#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;

View file

@ -9,17 +9,17 @@
#ifdef __ANDROID__
# include "UiContext.h"
#include "UiContext.h"
# include <SDL.h>
# include <dlfcn.h>
# include <jni.h>
# include <openrct2/Diagnostic.h>
# include <openrct2/core/String.hpp>
# include <openrct2/platform/Platform.h>
# include <openrct2/ui/UiContext.h>
# include <sstream>
# include <stdexcept>
#include <SDL.h>
#include <dlfcn.h>
#include <jni.h>
#include <openrct2/Diagnostic.h>
#include <openrct2/core/String.hpp>
#include <openrct2/platform/Platform.h>
#include <openrct2/ui/UiContext.h>
#include <sstream>
#include <stdexcept>
namespace OpenRCT2::Ui
{

View file

@ -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 <SDL.h>
# include <algorithm>
# include <dlfcn.h>
# include <openrct2/Diagnostic.h>
# include <openrct2/core/Path.hpp>
# include <openrct2/core/String.hpp>
# include <openrct2/core/StringBuilder.h>
# include <openrct2/localisation/Language.h>
# include <openrct2/platform/Platform.h>
# include <openrct2/ui/UiContext.h>
# include <sstream>
# include <stdexcept>
# include <unistd.h>
#include <SDL.h>
#include <algorithm>
#include <dlfcn.h>
#include <openrct2/Diagnostic.h>
#include <openrct2/core/Path.hpp>
#include <openrct2/core/String.hpp>
#include <openrct2/core/StringBuilder.h>
#include <openrct2/localisation/Language.h>
#include <openrct2/platform/Platform.h>
#include <openrct2/ui/UiContext.h>
#include <sstream>
#include <stdexcept>
#include <unistd.h>
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

View file

@ -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 <openrct2/Diagnostic.h>
# include <windows.h>
# include <shellapi.h>
// windows.h needs to be included first
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <shellapi.h>
#undef CreateWindow
// clang-format on
# undef CreateWindow
// Then the rest
# include "UiContext.h"
// Then the rest
#include "UiContext.h"
# include <SDL.h>
# include <SDL_syswm.h>
# include <openrct2/core/Path.hpp>
# include <openrct2/core/String.hpp>
# include <openrct2/ui/UiContext.h>
# include <shobjidl.h>
# include <wrl/client.h>
#include <SDL.h>
#include <SDL_syswm.h>
#include <openrct2/Diagnostic.h>
#include <openrct2/core/Path.hpp>
#include <openrct2/core/String.hpp>
#include <openrct2/ui/UiContext.h>
#include <shobjidl.h>
#include <wrl/client.h>
// Native resource IDs
# include "../../resources/resource.h"
// Native resource IDs
#include "../../resources/resource.h"
using namespace Microsoft::WRL;

View file

@ -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

View file

@ -13,10 +13,10 @@
#include <stdexcept>
#ifndef DISABLE_FLAC
# include <FLAC/all.h>
# include <SDL.h>
# include <cstring>
# include <vector>
#include <FLAC/all.h>
#include <SDL.h>
#include <cstring>
#include <vector>
#endif
namespace OpenRCT2::Audio

View file

@ -14,10 +14,10 @@
#include <stdexcept>
#ifndef DISABLE_VORBIS
# include <SDL.h>
# include <optional>
# include <vector>
# include <vorbis/vorbisfile.h>
#include <SDL.h>
#include <optional>
#include <vector>
#include <vorbis/vorbisfile.h>
#endif
namespace OpenRCT2::Audio

View file

@ -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<SDLAudioSource> CreateAudioSource(SDL_RWops* rw);

View file

@ -9,7 +9,7 @@
#ifndef DISABLE_OPENGL
# include "ApplyPaletteShader.h"
#include "ApplyPaletteShader.h"
using namespace OpenRCT2::Ui;

View file

@ -9,7 +9,7 @@
#ifndef DISABLE_OPENGL
# include "ApplyTransparencyShader.h"
#include "ApplyTransparencyShader.h"
using namespace OpenRCT2::Ui;

View file

@ -9,9 +9,9 @@
#ifndef DISABLE_OPENGL
# include "DrawLineShader.h"
#include "DrawLineShader.h"
# include "OpenGLFramebuffer.h"
#include "OpenGLFramebuffer.h"
using namespace OpenRCT2::Ui;

View file

@ -9,7 +9,7 @@
#ifndef DISABLE_OPENGL
# include "DrawRectShader.h"
#include "DrawRectShader.h"
using namespace OpenRCT2::Ui;

View file

@ -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 <SDL_video.h>
# include <openrct2/core/Console.hpp>
#include <SDL_video.h>
#include <openrct2/core/Console.hpp>
static const char* TryLoadAllProcAddresses()
{
# define OPENGL_PROC(TYPE, PROC) \
#define OPENGL_PROC(TYPE, PROC) \
{ \
PROC = reinterpret_cast<TYPE>(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;
}

View file

@ -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 */

View file

@ -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

View file

@ -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 <SDL.h>
# include <algorithm>
# include <cassert>
# include <cmath>
# include <openrct2-ui/interface/Window.h>
# include <openrct2/config/Config.h>
# include <openrct2/core/Console.hpp>
# include <openrct2/drawing/Drawing.h>
# include <openrct2/drawing/IDrawingContext.h>
# include <openrct2/drawing/IDrawingEngine.h>
# include <openrct2/drawing/LightFX.h>
# include <openrct2/drawing/Weather.h>
# include <openrct2/interface/Screenshot.h>
# include <openrct2/ui/UiContext.h>
# include <openrct2/util/Util.h>
# include <openrct2/world/Climate.h>
#include <SDL.h>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <openrct2-ui/interface/Window.h>
#include <openrct2/config/Config.h>
#include <openrct2/core/Console.hpp>
#include <openrct2/drawing/Drawing.h>
#include <openrct2/drawing/IDrawingContext.h>
#include <openrct2/drawing/IDrawingEngine.h>
#include <openrct2/drawing/LightFX.h>
#include <openrct2/drawing/Weather.h>
#include <openrct2/interface/Screenshot.h>
#include <openrct2/ui/UiContext.h>
#include <openrct2/util/Util.h>
#include <openrct2/world/Climate.h>
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<uint32_t>(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<int32_t>(dpi.bits - screenDPI->bits);
# ifndef NDEBUG
#ifndef NDEBUG
const ptrdiff_t bitsSize = static_cast<ptrdiff_t>(screenDPI->height) * static_cast<ptrdiff_t>(bytesPerRow);
assert(static_cast<ptrdiff_t>(bitsOffset) < bitsSize && static_cast<ptrdiff_t>(bitsOffset) >= 0);
# endif
#endif
const int32_t left = bitsOffset % bytesPerRow;
const int32_t top = bitsOffset / bytesPerRow;

View file

@ -9,12 +9,12 @@
#ifndef DISABLE_OPENGL
# include "OpenGLFramebuffer.h"
#include "OpenGLFramebuffer.h"
# include <SDL_video.h>
# include <algorithm>
# include <cassert>
# include <memory>
#include <SDL_video.h>
#include <algorithm>
#include <cassert>
#include <memory>
using namespace OpenRCT2::Ui;

View file

@ -9,14 +9,14 @@
#ifndef DISABLE_OPENGL
# include "OpenGLShaderProgram.h"
#include "OpenGLShaderProgram.h"
# include <openrct2/Context.h>
# include <openrct2/PlatformEnvironment.h>
# include <openrct2/core/Console.hpp>
# include <openrct2/core/FileStream.h>
# include <openrct2/core/Path.hpp>
# include <openrct2/core/String.hpp>
#include <openrct2/Context.h>
#include <openrct2/PlatformEnvironment.h>
#include <openrct2/core/Console.hpp>
#include <openrct2/core/FileStream.h>
#include <openrct2/core/Path.hpp>
#include <openrct2/core/String.hpp>
using namespace OpenRCT2::Ui;

View file

@ -9,9 +9,9 @@
#ifndef DISABLE_OPENGL
# include "SwapFramebuffer.h"
#include "SwapFramebuffer.h"
# include "OpenGLFramebuffer.h"
#include "OpenGLFramebuffer.h"
using namespace OpenRCT2::Ui;

View file

@ -9,16 +9,16 @@
#ifndef DISABLE_OPENGL
# include "TextureCache.h"
#include "TextureCache.h"
# include <algorithm>
# include <openrct2/Diagnostic.h>
# include <openrct2/drawing/Drawing.h>
# include <openrct2/interface/Colour.h>
# include <openrct2/util/Util.h>
# include <openrct2/world/Location.hpp>
# include <stdexcept>
# include <vector>
#include <algorithm>
#include <openrct2/Diagnostic.h>
#include <openrct2/drawing/Drawing.h>
#include <openrct2/interface/Colour.h>
#include <openrct2/util/Util.h>
#include <openrct2/world/Location.hpp>
#include <stdexcept>
#include <vector>
using namespace OpenRCT2::Ui;
@ -352,9 +352,9 @@ AtlasTextureInfo TextureCache::AllocateImage(int32_t imageWidth, int32_t imageHe
auto atlasIndex = static_cast<int32_t>(_atlases.size());
int32_t atlasSize = powf(2, static_cast<float>(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);

View file

@ -9,12 +9,12 @@
#ifndef DISABLE_OPENGL
# include "TransparencyDepth.h"
#include "TransparencyDepth.h"
# include <algorithm>
# include <cassert>
# include <map>
# include <vector>
#include <algorithm>
#include <cassert>
#include <map>
#include <vector>
namespace OpenRCT2::Ui
{

View file

@ -9,15 +9,15 @@
#ifdef ENABLE_SCRIPTING
# include "CustomImages.h"
#include "CustomImages.h"
# include "ScGraphicsContext.hpp"
#include "ScGraphicsContext.hpp"
# include <openrct2/Context.h>
# include <openrct2/drawing/Image.h>
# include <openrct2/drawing/ImageImporter.h>
# include <openrct2/drawing/X8DrawingEngine.h>
# include <openrct2/scripting/Plugin.h>
#include <openrct2/Context.h>
#include <openrct2/drawing/Image.h>
#include <openrct2/drawing/ImageImporter.h>
#include <openrct2/drawing/X8DrawingEngine.h>
#include <openrct2/scripting/Plugin.h>
using namespace OpenRCT2::Drawing;

View file

@ -11,12 +11,12 @@
#ifdef ENABLE_SCRIPTING
# include <memory>
# include <openrct2/drawing/Image.h>
# include <openrct2/drawing/ImageId.hpp>
# include <openrct2/scripting/Duktape.hpp>
# include <openrct2/scripting/Plugin.h>
# include <openrct2/scripting/ScriptEngine.h>
#include <memory>
#include <openrct2/drawing/Image.h>
#include <openrct2/drawing/ImageId.hpp>
#include <openrct2/scripting/Duktape.hpp>
#include <openrct2/scripting/Plugin.h>
#include <openrct2/scripting/ScriptEngine.h>
namespace OpenRCT2::Scripting
{

View file

@ -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 <numeric>
# include <openrct2/Context.h>
# include <openrct2/localisation/Formatter.h>
# include <openrct2/localisation/Formatting.h>
# include <openrct2/util/Util.h>
#include <numeric>
#include <openrct2/Context.h>
#include <openrct2/localisation/Formatter.h>
#include <openrct2/localisation/Formatting.h>
#include <openrct2/util/Util.h>
using namespace OpenRCT2::Scripting;
using namespace OpenRCT2::Ui::Windows;

View file

@ -11,15 +11,15 @@
#ifdef ENABLE_SCRIPTING
# include "../interface/Window.h"
#include "../interface/Window.h"
# include <cstdint>
# include <memory>
# include <openrct2/scripting/Duktape.hpp>
# include <openrct2/scripting/ScriptEngine.h>
# include <optional>
# include <string>
# include <vector>
#include <cstdint>
#include <memory>
#include <openrct2/scripting/Duktape.hpp>
#include <openrct2/scripting/ScriptEngine.h>
#include <optional>
#include <string>
#include <vector>
namespace OpenRCT2::Ui::Windows
{

View file

@ -9,14 +9,14 @@
#ifdef ENABLE_SCRIPTING
# include "CustomMenu.h"
#include "CustomMenu.h"
# include "../interface/Viewport.h"
#include "../interface/Viewport.h"
# include <openrct2-ui/UiContext.h>
# include <openrct2-ui/input/ShortcutManager.h>
# include <openrct2/Input.h>
# include <openrct2/world/Map.h>
#include <openrct2-ui/UiContext.h>
#include <openrct2-ui/input/ShortcutManager.h>
#include <openrct2/Input.h>
#include <openrct2/world/Map.h>
using namespace OpenRCT2;
using namespace OpenRCT2::Ui;

View file

@ -11,13 +11,13 @@
#ifdef ENABLE_SCRIPTING
# include <memory>
# include <openrct2/Context.h>
# include <openrct2/interface/Cursors.h>
# include <openrct2/scripting/Duktape.hpp>
# include <openrct2/scripting/ScriptEngine.h>
# include <string>
# include <vector>
#include <memory>
#include <openrct2/Context.h>
#include <openrct2/interface/Cursors.h>
#include <openrct2/scripting/Duktape.hpp>
#include <openrct2/scripting/ScriptEngine.h>
#include <string>
#include <vector>
enum class CursorID : uint8_t;

View file

@ -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 <limits>
# include <openrct2/drawing/Drawing.h>
# include <openrct2/interface/Window.h>
# include <openrct2/localisation/Formatter.h>
# include <openrct2/localisation/Language.h>
# include <openrct2/scripting/Plugin.h>
# include <openrct2/sprites.h>
# include <optional>
# include <string>
# include <utility>
# include <vector>
#include <limits>
#include <openrct2/drawing/Drawing.h>
#include <openrct2/interface/Window.h>
#include <openrct2/localisation/Formatter.h>
#include <openrct2/localisation/Language.h>
#include <openrct2/scripting/Plugin.h>
#include <openrct2/sprites.h>
#include <optional>
#include <string>
#include <utility>
#include <vector>
using namespace OpenRCT2;
using namespace OpenRCT2::Scripting;

View file

@ -11,11 +11,11 @@
#ifdef ENABLE_SCRIPTING
# include "../interface/Window.h"
#include "../interface/Window.h"
# include <memory>
# include <optional>
# include <string_view>
#include <memory>
#include <optional>
#include <string_view>
namespace OpenRCT2::Ui::Windows
{

View file

@ -11,10 +11,10 @@
#ifdef ENABLE_SCRIPTING
# include "CustomImages.h"
#include "CustomImages.h"
# include <openrct2/drawing/Text.h>
# include <openrct2/scripting/Duktape.hpp>
#include <openrct2/drawing/Text.h>
#include <openrct2/scripting/Duktape.hpp>
namespace OpenRCT2::Scripting
{

View file

@ -11,12 +11,12 @@
#ifdef ENABLE_SCRIPTING
# include "CustomImages.h"
#include "CustomImages.h"
# include <openrct2/Context.h>
# include <openrct2/drawing/Image.h>
# include <openrct2/scripting/Duktape.hpp>
# include <openrct2/sprites.h>
#include <openrct2/Context.h>
#include <openrct2/drawing/Image.h>
#include <openrct2/scripting/Duktape.hpp>
#include <openrct2/sprites.h>
namespace OpenRCT2::Scripting
{

View file

@ -11,8 +11,8 @@
#ifdef ENABLE_SCRIPTING
# include <openrct2/scripting/Duktape.hpp>
# include <openrct2/world/Map.h>
#include <openrct2/scripting/Duktape.hpp>
#include <openrct2/world/Map.h>
namespace OpenRCT2::Scripting
{

View file

@ -11,23 +11,23 @@
#ifdef ENABLE_SCRIPTING
# include <memory>
# include <openrct2/Context.h>
# include <openrct2/Game.h>
# include <openrct2/GameState.h>
# include <openrct2/OpenRCT2.h>
# include <openrct2/ParkImporter.h>
# include <openrct2/core/String.hpp>
# include <openrct2/entity/EntityRegistry.h>
# include <openrct2/object/ObjectManager.h>
# include <openrct2/scenario/Scenario.h>
# include <openrct2/scenes/title/TitleScene.h>
# include <openrct2/scenes/title/TitleSequence.h>
# include <openrct2/scenes/title/TitleSequenceManager.h>
# include <openrct2/scenes/title/TitleSequencePlayer.h>
# include <openrct2/scripting/ScriptEngine.h>
# include <type_traits>
# include <variant>
#include <memory>
#include <openrct2/Context.h>
#include <openrct2/Game.h>
#include <openrct2/GameState.h>
#include <openrct2/OpenRCT2.h>
#include <openrct2/ParkImporter.h>
#include <openrct2/core/String.hpp>
#include <openrct2/entity/EntityRegistry.h>
#include <openrct2/object/ObjectManager.h>
#include <openrct2/scenario/Scenario.h>
#include <openrct2/scenes/title/TitleScene.h>
#include <openrct2/scenes/title/TitleSequence.h>
#include <openrct2/scenes/title/TitleSequenceManager.h>
#include <openrct2/scenes/title/TitleSequencePlayer.h>
#include <openrct2/scripting/ScriptEngine.h>
#include <type_traits>
#include <variant>
namespace OpenRCT2::Scripting
{

View file

@ -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 <memory>
# include <openrct2/Context.h>
# include <openrct2/Input.h>
# include <openrct2/scenario/ScenarioRepository.h>
# include <openrct2/scripting/Duktape.hpp>
# include <openrct2/scripting/ScriptEngine.h>
# include <string>
#include <memory>
#include <openrct2/Context.h>
#include <openrct2/Input.h>
#include <openrct2/scenario/ScenarioRepository.h>
#include <openrct2/scripting/Duktape.hpp>
#include <openrct2/scripting/ScriptEngine.h>
#include <string>
namespace OpenRCT2::Scripting
{

View file

@ -11,14 +11,14 @@
#ifdef ENABLE_SCRIPTING
# include "../interface/Window.h"
#include "../interface/Window.h"
# include <memory>
# include <openrct2/Context.h>
# include <openrct2/interface/Viewport.h>
# include <openrct2/scripting/Duktape.hpp>
# include <openrct2/scripting/ScriptEngine.h>
# include <openrct2/world/Map.h>
#include <memory>
#include <openrct2/Context.h>
#include <openrct2/interface/Viewport.h>
#include <openrct2/scripting/Duktape.hpp>
#include <openrct2/scripting/ScriptEngine.h>
#include <openrct2/world/Map.h>
namespace OpenRCT2::Scripting
{

View file

@ -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 <memory>
# include <openrct2/Context.h>
# include <openrct2/scripting/Duktape.hpp>
# include <openrct2/scripting/IconNames.hpp>
# include <openrct2/scripting/ScriptEngine.h>
#include <memory>
#include <openrct2/Context.h>
#include <openrct2/scripting/Duktape.hpp>
#include <openrct2/scripting/IconNames.hpp>
#include <openrct2/scripting/ScriptEngine.h>
namespace OpenRCT2::Scripting
{

View file

@ -11,12 +11,12 @@
#ifdef ENABLE_SCRIPTING
# include "ScWidget.hpp"
#include "ScWidget.hpp"
# include <openrct2/interface/Window.h>
# include <openrct2/interface/Window_internal.h>
# include <openrct2/localisation/Language.h>
# include <openrct2/scripting/Duktape.hpp>
#include <openrct2/interface/Window.h>
#include <openrct2/interface/Window_internal.h>
#include <openrct2/localisation/Language.h>
#include <openrct2/scripting/Duktape.hpp>
namespace OpenRCT2::Scripting
{

View file

@ -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 <openrct2/scripting/ScriptEngine.h>
#include <openrct2/scripting/ScriptEngine.h>
using namespace OpenRCT2::Scripting;

View file

@ -9,32 +9,32 @@
#ifndef DISABLE_NETWORK
# include <cassert>
# include <chrono>
# include <openrct2-ui/interface/Dropdown.h>
# include <openrct2-ui/interface/Widget.h>
# include <openrct2-ui/windows/Window.h>
# include <openrct2/Context.h>
# include <openrct2/Diagnostic.h>
# include <openrct2/config/Config.h>
# include <openrct2/core/Json.hpp>
# include <openrct2/drawing/Text.h>
# include <openrct2/interface/Colour.h>
# include <openrct2/localisation/Formatter.h>
# include <openrct2/network/ServerList.h>
# include <openrct2/network/network.h>
# include <openrct2/platform/Platform.h>
# include <openrct2/sprites.h>
# include <openrct2/util/Util.h>
# include <tuple>
#include <cassert>
#include <chrono>
#include <openrct2-ui/interface/Dropdown.h>
#include <openrct2-ui/interface/Widget.h>
#include <openrct2-ui/windows/Window.h>
#include <openrct2/Context.h>
#include <openrct2/Diagnostic.h>
#include <openrct2/config/Config.h>
#include <openrct2/core/Json.hpp>
#include <openrct2/drawing/Text.h>
#include <openrct2/interface/Colour.h>
#include <openrct2/localisation/Formatter.h>
#include <openrct2/network/ServerList.h>
#include <openrct2/network/network.h>
#include <openrct2/platform/Platform.h>
#include <openrct2/sprites.h>
#include <openrct2/util/Util.h>
#include <tuple>
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()

View file

@ -9,17 +9,17 @@
#ifndef DISABLE_NETWORK
# include "../interface/Theme.h"
#include "../interface/Theme.h"
# include <openrct2-ui/interface/Widget.h>
# include <openrct2-ui/windows/Window.h>
# include <openrct2/Context.h>
# include <openrct2/ParkImporter.h>
# include <openrct2/config/Config.h>
# include <openrct2/interface/Chat.h>
# include <openrct2/network/network.h>
# include <openrct2/util/Util.h>
# include <openrct2/windows/Intent.h>
#include <openrct2-ui/interface/Widget.h>
#include <openrct2-ui/windows/Window.h>
#include <openrct2/Context.h>
#include <openrct2/ParkImporter.h>
#include <openrct2/config/Config.h>
#include <openrct2/interface/Chat.h>
#include <openrct2/network/network.h>
#include <openrct2/util/Util.h>
#include <openrct2/windows/Intent.h>
namespace OpenRCT2::Ui::Windows
{

View file

@ -8,8 +8,8 @@
*****************************************************************************/
#ifdef __EMSCRIPTEN__
# include <cassert>
# include <emscripten.h>
#include <cassert>
#include <emscripten.h>
#endif // __EMSCRIPTEN__
#include "AssetPackManager.h"

View file

@ -17,7 +17,7 @@
#include <cstdio>
#ifdef __ANDROID__
# include <android/log.h>
#include <android/log.h>
#endif
using namespace OpenRCT2;

View file

@ -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<uint8_t>(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

View file

@ -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

View file

@ -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[];

View file

@ -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;

View file

@ -11,7 +11,7 @@
#ifdef ENABLE_SCRIPTING
# include "GameAction.h"
#include "GameAction.h"
class CustomAction final : public GameActionBase<GameCommand::Custom>
{

View file

@ -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<GameCommand TId>

View file

@ -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

View file

@ -17,7 +17,7 @@
// windows.h defines an interface keyword
#ifdef interface
# undef interface
#undef interface
#endif
namespace OpenRCT2::Config

View file

@ -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

View file

@ -34,9 +34,9 @@ namespace OpenRCT2
std::memcpy(&temp, reinterpret_cast<const std::byte*>(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;

View file

@ -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 <cstdint>
# include <cstring>
# include <iomanip>
# include <limits>
# include <sstream>
# include <stdexcept>
# include <string>
# include <tuple>
#include <cstdint>
#include <cstring>
#include <iomanip>
#include <limits>
#include <sstream>
#include <stdexcept>
#include <string>
#include <tuple>
// clang-format off
// CNG: Cryptography API: Next Generation (CNG)

View file

@ -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 <openssl/evp.h>
# include <openssl/pem.h>
# include <stdexcept>
# include <string>
# include <vector>
#include <openssl/evp.h>
#include <openssl/pem.h>
#include <stdexcept>
#include <string>
#include <vector>
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

View file

@ -10,7 +10,7 @@
#pragma once
#ifdef _MSC_VER
# include <ctime>
#include <ctime>
#endif
#include <cstdint>

View file

@ -8,7 +8,7 @@
*****************************************************************************/
#if defined(DEBUG) && defined(_WIN32)
# include <windows.h>
#include <windows.h>
#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

View file

@ -8,9 +8,9 @@
*****************************************************************************/
#ifdef _WIN32
# include <windows.h>
#include <windows.h>
#else
# include <sys/stat.h>
#include <sys/stat.h>
#endif
#include "../Diagnostic.h"

View file

@ -8,17 +8,17 @@
*****************************************************************************/
#ifdef _WIN32
# include <windows.h>
#include <windows.h>
#endif
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
# include <dirent.h>
# include <sys/stat.h>
# include <sys/types.h>
# include <unistd.h>
#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#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"

View file

@ -15,14 +15,14 @@
#include <string_view>
#ifndef _WIN32
# include <sys/stat.h>
#include <sys/stat.h>
#else
# include <io.h>
#include <io.h>
#endif
#ifdef _MSC_VER
# define ftello _ftelli64
# define fseeko _fseeki64
#define ftello _ftelli64
#define fseeko _fseeki64
#endif
namespace OpenRCT2

View file

@ -16,43 +16,43 @@
// Find out if std::filesystem is available:
#if defined(_MSC_VER) // Visual Studio supports <filesystem>
# 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(<filesystem>)
# define HAVE_STD_FILESYSTEM 1
# else
# define HAVE_STD_FILESYSTEM 0
# endif
#if __has_include(<filesystem>)
#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 <filesystem>
#include <filesystem>
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 <filesystem.hpp>
# 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 <filesystem.hpp>
#ifdef _WIN32
#undef CreateDirectory
#undef CreateWindow
#undef GetMessage
#undef BITMAP
#undef PATTERN
#endif
namespace fs = ghc::filesystem;
#endif

View file

@ -15,14 +15,14 @@
#include <stdexcept>
#ifdef _WIN32
# include <windows.h>
#include <windows.h>
#elif defined(__linux__)
# include <fcntl.h>
# include <sys/inotify.h>
# include <sys/types.h>
# include <unistd.h>
#include <fcntl.h>
#include <sys/inotify.h>
#include <sys/types.h>
#include <unistd.h>
#elif defined(__APPLE__)
# include <CoreServices/CoreServices.h>
#include <CoreServices/CoreServices.h>
#endif
#include "../core/Guard.hpp"

View file

@ -17,11 +17,11 @@
#include <vector>
#ifdef _WIN32
# include "FileSystem.hpp"
#include "FileSystem.hpp"
typedef void* HANDLE;
#elif defined(__APPLE__)
# include <CoreServices/CoreServices.h>
#include <CoreServices/CoreServices.h>
#endif
/**

View file

@ -8,8 +8,8 @@
*****************************************************************************/
#ifdef _WIN32
# include <cassert>
# include <windows.h>
#include <cassert>
#include <windows.h>
#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

View file

@ -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 <SDL.h>
# include <android/log.h>
# include <jni.h>
#include <SDL.h>
#include <android/log.h>
#include <jni.h>
# define OPENRCT2_USER_AGENT "OpenRCT2/" OPENRCT2_VERSION
#define OPENRCT2_USER_AGENT "OpenRCT2/" OPENRCT2_VERSION
namespace OpenRCT2::Http
{

View file

@ -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 <cstdio>
# include <stdexcept>
# include <windows.h>
# include <winhttp.h>
#include <cstdio>
#include <stdexcept>
#include <windows.h>
#include <winhttp.h>
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);

View file

@ -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 <cstring>
# include <memory>
# include <stdexcept>
# include <thread>
#include <cstring>
#include <memory>
#include <stdexcept>
#include <thread>
# 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 <curl/curl.h>
#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 <curl/curl.h>
# define OPENRCT2_USER_AGENT "OpenRCT2/" OPENRCT2_VERSION
#define OPENRCT2_USER_AGENT "OpenRCT2/" OPENRCT2_VERSION
namespace OpenRCT2::Http
{

View file

@ -11,10 +11,10 @@
#ifndef DISABLE_HTTP
# include <functional>
# include <map>
# include <string>
# include <thread>
#include <functional>
#include <map>
#include <string>
#include <thread>
namespace OpenRCT2::Http
{

View file

@ -19,9 +19,9 @@
#include <vector>
#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

View file

@ -16,7 +16,7 @@
#include <string_view>
#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;

View file

@ -15,7 +15,7 @@
#include <type_traits>
#ifdef _MSC_VER
# include <intrin.h>
#include <intrin.h>
#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

View file

@ -8,17 +8,17 @@
*****************************************************************************/
#if defined(_WIN32) && defined(USE_FRIBIDI)
# include "RTL.h"
#include "RTL.h"
# include "../Diagnostic.h"
#include "../Diagnostic.h"
# include <string>
#include <string>
extern "C" {
# include <fribidi/fribidi-bidi-types.h>
# include <fribidi/fribidi-char-sets.h>
# include <fribidi/fribidi-flags.h>
# include <fribidi/fribidi.h>
#include <fribidi/fribidi-bidi-types.h>
#include <fribidi/fribidi-char-sets.h>
#include <fribidi/fribidi-flags.h>
#include <fribidi/fribidi.h>
}
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 <string>
#include <string>
static bool hasWarned = false;

View file

@ -8,16 +8,16 @@
*****************************************************************************/
#ifndef _WIN32
# include "RTL.h"
#include "RTL.h"
# include <algorithm>
# include <string>
# include <unicode/ubidi.h>
# include <unicode/unistr.h>
# include <unicode/ushape.h>
# include <unicode/ustring.h>
# include <unicode/utf.h>
# include <unicode/utypes.h>
#include <algorithm>
#include <string>
#include <unicode/ubidi.h>
#include <unicode/unistr.h>
#include <unicode/ushape.h>
#include <unicode/ustring.h>
#include <unicode/utf.h>
#include <unicode/utypes.h>
std::string FixRTL(std::string& input)
{

View file

@ -17,14 +17,14 @@
#include <vector>
#ifndef _WIN32
# if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
# include <alloca.h>
# endif
# include <unicode/ucnv.h>
# include <unicode/unistr.h>
# include <unicode/utypes.h>
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
#include <alloca.h>
#endif
#include <unicode/ucnv.h>
#include <unicode/unistr.h>
#include <unicode/utypes.h>
#else
# include <windows.h>
#include <windows.h>
#endif
#include "../util/Util.h"
@ -34,8 +34,8 @@
#include "UTF8.h"
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
# include <strings.h>
# define _stricmp(x, y) strcasecmp((x), (y))
#include <strings.h>
#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<const UChar32*>(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<const wchar_t*>(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<size_t>(str.length());
std::wstring result(length, '\0');
UErrorCode status = U_ZERO_ERROR;
str.toUTF32(reinterpret_cast<UChar32*>(&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<wchar_t*>(buffer);
# else
# error Unsupported U_SIZEOF_WCHAR_T size
# endif
#else
#error Unsupported U_SIZEOF_WCHAR_T size
#endif
return result;
#endif

View file

@ -12,7 +12,7 @@
#include "IStream.hpp"
#ifndef __ANDROID__
# include <zip.h>
#include <zip.h>
#endif
using namespace OpenRCT2;

View file

@ -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 <SDL.h>
# include <jni.h>
# include <string>
#include <SDL.h>
#include <jni.h>
#include <string>
using namespace OpenRCT2;

View file

@ -12,7 +12,7 @@
#ifdef __AVX2__
# include <immintrin.h>
#include <immintrin.h>
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,

View file

@ -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;
}

View file

@ -31,11 +31,11 @@ static uint32_t _allocatedImageCount;
#ifdef DEBUG_LEVEL_1
static std::list<ImageList> _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<ImageList> _allocatedLists;
return contains;
}
# pragma warning(pop)
#pragma warning(pop)
static bool AllocatedListRemove(uint32_t baseImageId, uint32_t count)
{

View file

@ -12,7 +12,7 @@
#ifdef __SSE4_1__
# include <immintrin.h>
#include <immintrin.h>
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,

View file

@ -9,24 +9,24 @@
#ifndef NO_TTF
# include "../Diagnostic.h"
#include "../Diagnostic.h"
# include <mutex>
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdocumentation"
# include <ft2build.h>
# include FT_FREETYPE_H
# pragma clang diagnostic pop
#include <mutex>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"
#include <ft2build.h>
#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()
{

View file

@ -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<Ui::IUiContext>& 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)

View file

@ -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<Ui::IUiContext>& 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

View file

@ -15,7 +15,7 @@ constexpr std::nullptr_t kFamilyOpenRCT2Sprite = nullptr;
#ifndef NO_TTF
# include <vector>
#include <vector>
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

View file

@ -74,7 +74,7 @@
#include <vector>
#ifndef NO_TTF
# include "../drawing/TTF.h"
#include "../drawing/TTF.h"
#endif
using namespace OpenRCT2;

View file

@ -19,7 +19,7 @@
// Ignore isatty warning on WIN32
#ifdef _MSC_VER
# pragma warning(disable : 4996)
#pragma warning(disable : 4996)
#endif
void StdInOutConsole::Start()

View file

@ -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

View file

@ -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 <chrono>
# include <discord_rpc.h>
#include <chrono>
#include <discord_rpc.h>
using namespace OpenRCT2;

View file

@ -11,9 +11,9 @@
#ifdef __ENABLE_DISCORD__
# include "../core/Timer.hpp"
#include "../core/Timer.hpp"
# include <limits>
#include <limits>
class DiscordService final
{

View file

@ -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 <algorithm>
#include <algorithm>
NetworkPermission NetworkActions::FindCommand(GameCommand command)
{

View file

@ -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 <array>
# include <cerrno>
# include <cmath>
# include <fstream>
# include <functional>
# include <list>
# include <map>
# include <memory>
# include <set>
# include <string>
# include <vector>
#include <array>
#include <cerrno>
#include <cmath>
#include <fstream>
#include <functional>
#include <list>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <vector>
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<uint32_t>(0u);
packetScriptHeader << static_cast<uint32_t>(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;
}

View file

@ -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;
}

View file

@ -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 <deque>
# include <memory>
# include <string_view>
# include <vector>
#include <deque>
#include <memory>
#include <string_view>
#include <vector>
class NetworkPlayer;
struct ObjectRepositoryItem;

View file

@ -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;

View file

@ -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 <vector>
#include <vector>
using namespace OpenRCT2;

View file

@ -11,9 +11,9 @@
#ifndef DISABLE_NETWORK
# include <memory>
# include <string>
# include <vector>
#include <memory>
#include <string>
#include <vector>
namespace OpenRCT2
{

View file

@ -9,11 +9,11 @@
#ifndef DISABLE_NETWORK
# include "NetworkPacket.h"
#include "NetworkPacket.h"
# include "NetworkTypes.h"
#include "NetworkTypes.h"
# include <memory>
#include <memory>
NetworkPacket::NetworkPacket(NetworkCommand id) noexcept
: Header{ 0, id }

View file

@ -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)
{

View file

@ -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 <cstring>
# include <iterator>
# include <memory>
# include <random>
# include <string>
#include <cstring>
#include <iterator>
#include <memory>
#include <random>
#include <string>
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<INetworkServerAdvertiser> CreateServerAdvertiser(uint16_t port)

View file

@ -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 <unordered_set>
#include <unordered_set>
using namespace OpenRCT2;

Some files were not shown because too many files have changed in this diff Show more