Skip to content

Commit

Permalink
Indent preprocessor directives
Browse files Browse the repository at this point in the history
  • Loading branch information
clang-format authored and Broxzier committed Jul 23, 2018
1 parent b02dfdb commit d787872
Show file tree
Hide file tree
Showing 93 changed files with 950 additions and 948 deletions.
1 change: 1 addition & 0 deletions .clang-format
Expand Up @@ -62,6 +62,7 @@ IncludeCategories:
- Regex: '^<'
Priority: 2
IndentCaseLabels: true
IndentPPDirectives: AfterHash
IndentWidth: 4
IndentWrappedFunctionNames: true
KeepEmptyLinesAtTheStartOfBlocks: false
Expand Down
4 changes: 2 additions & 2 deletions src/openrct2-ui/TextComposition.cpp
Expand Up @@ -23,9 +23,9 @@

#ifdef __MACOSX__
// macOS uses COMMAND rather than CTRL for many keyboard shortcuts
#define KEYBOARD_PRIMARY_MODIFIER KMOD_GUI
# define KEYBOARD_PRIMARY_MODIFIER KMOD_GUI
#else
#define KEYBOARD_PRIMARY_MODIFIER KMOD_CTRL
# define KEYBOARD_PRIMARY_MODIFIER KMOD_CTRL
#endif

using namespace OpenRCT2;
Expand Down
16 changes: 8 additions & 8 deletions src/openrct2-ui/UiContext.Android.cpp
Expand Up @@ -9,15 +9,15 @@

#ifdef __ANDROID__

#include "UiContext.h"
# include "UiContext.h"

#include <SDL.h>
#include <dlfcn.h>
#include <openrct2/common.h>
#include <openrct2/core/String.hpp>
#include <openrct2/ui/UiContext.h>
#include <sstream>
#include <stdexcept>
# include <SDL.h>
# include <dlfcn.h>
# include <openrct2/common.h>
# include <openrct2/core/String.hpp>
# include <openrct2/ui/UiContext.h>
# include <sstream>
# include <stdexcept>

namespace OpenRCT2::Ui
{
Expand Down
32 changes: 16 additions & 16 deletions src/openrct2-ui/UiContext.Linux.cpp
Expand Up @@ -9,17 +9,17 @@

#if (defined(__linux__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__)) && !defined(__ANDROID__)

#include "UiContext.h"
# include "UiContext.h"

#include <SDL.h>
#include <dlfcn.h>
#include <openrct2/common.h>
#include <openrct2/core/Path.hpp>
#include <openrct2/core/String.hpp>
#include <openrct2/localisation/Localisation.h>
#include <openrct2/ui/UiContext.h>
#include <sstream>
#include <stdexcept>
# include <SDL.h>
# include <dlfcn.h>
# include <openrct2/common.h>
# include <openrct2/core/Path.hpp>
# include <openrct2/core/String.hpp>
# include <openrct2/localisation/Localisation.h>
# include <openrct2/ui/UiContext.h>
# include <sstream>
# include <stdexcept>

namespace OpenRCT2::Ui
{
Expand All @@ -44,7 +44,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
{
Expand Down Expand Up @@ -79,9 +79,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
Expand Down Expand Up @@ -258,7 +258,7 @@ namespace OpenRCT2::Ui

static int32_t Execute(const std::string& command, std::string* output = nullptr)
{
#ifndef __EMSCRIPTEN__
# ifndef __EMSCRIPTEN__
log_verbose("executing \"%s\"...\n", command.c_str());
FILE* fpipe = popen(command.c_str(), "r");
if (fpipe == nullptr)
Expand Down Expand Up @@ -301,10 +301,10 @@ namespace OpenRCT2::Ui

// 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__
}

static std::string GetKDialogFilterString(const std::vector<FileDialogDesc::Filter> filters)
Expand Down
36 changes: 18 additions & 18 deletions src/openrct2-ui/UiContext.Win32.cpp
Expand Up @@ -9,31 +9,31 @@

#ifdef _WIN32

#ifdef __MINGW32__
# ifdef __MINGW32__
// 0x0600 == vista
#define WINVER 0x0600
#define _WIN32_WINNT 0x0600
#endif // __MINGW32__
# define WINVER 0x0600
# define _WIN32_WINNT 0x0600
# endif // __MINGW32__

// Windows.h needs to be included first
#include <windows.h>
#undef CreateWindow
# include <windows.h>
# undef CreateWindow

// Then the rest
#include "UiContext.h"

#include <SDL2/SDL.h>
#include <SDL2/SDL_syswm.h>
#include <openrct2/common.h>
#include <openrct2/core/Math.hpp>
#include <openrct2/core/Path.hpp>
#include <openrct2/core/String.hpp>
#include <openrct2/ui/UiContext.h>
#include <shlobj.h>
#include <sstream>
# include "UiContext.h"

# include <SDL2/SDL.h>
# include <SDL2/SDL_syswm.h>
# include <openrct2/common.h>
# include <openrct2/core/Math.hpp>
# include <openrct2/core/Path.hpp>
# include <openrct2/core/String.hpp>
# include <openrct2/ui/UiContext.h>
# include <shlobj.h>
# include <sstream>

// Native resource IDs
#include "../../resources/resource.h"
# include "../../resources/resource.h"

static std::wstring SHGetPathFromIDListLongPath(LPCITEMIDLIST pidl)
{
Expand Down
4 changes: 2 additions & 2 deletions src/openrct2-ui/UiContext.cpp
Expand Up @@ -51,9 +51,9 @@ using namespace OpenRCT2::Ui;

#ifdef __MACOSX__
// macOS uses COMMAND rather than CTRL for many keyboard shortcuts
#define KEYBOARD_PRIMARY_MODIFIER KMOD_GUI
# 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
Expand Down
18 changes: 9 additions & 9 deletions src/openrct2-ui/UiContext.macOS.mm
Expand Up @@ -9,19 +9,19 @@

#if defined(__APPLE__) && defined(__MACH__)

#include "UiContext.h"
# include "UiContext.h"

#include <openrct2/common.h>
#include <openrct2/core/String.hpp>
#include <openrct2/ui/UiContext.h>
# include <openrct2/common.h>
# include <openrct2/core/String.hpp>
# include <openrct2/ui/UiContext.h>

// undefine `interface` and `abstract`, because it's causing conflicts with Objective-C's keywords
#undef interface
#undef abstract
# undef interface
# undef abstract

#import <Cocoa/Cocoa.h>
#include <SDL.h>
#include <mach-o/dyld.h>
# import <Cocoa/Cocoa.h>
# include <SDL.h>
# include <mach-o/dyld.h>

namespace OpenRCT2::Ui
{
Expand Down
Expand Up @@ -9,7 +9,7 @@

#ifndef DISABLE_OPENGL

#include "ApplyPaletteShader.h"
# include "ApplyPaletteShader.h"

namespace
{
Expand Down
Expand Up @@ -9,7 +9,7 @@

#ifndef DISABLE_OPENGL

#include "ApplyTransparencyShader.h"
# include "ApplyTransparencyShader.h"

namespace
{
Expand Down
4 changes: 2 additions & 2 deletions src/openrct2-ui/drawing/engines/opengl/DrawLineShader.cpp
Expand Up @@ -9,9 +9,9 @@

#ifndef DISABLE_OPENGL

#include "DrawLineShader.h"
# include "DrawLineShader.h"

#include "OpenGLFramebuffer.h"
# include "OpenGLFramebuffer.h"

namespace
{
Expand Down
2 changes: 1 addition & 1 deletion src/openrct2-ui/drawing/engines/opengl/DrawRectShader.cpp
Expand Up @@ -9,7 +9,7 @@

#ifndef DISABLE_OPENGL

#include "DrawRectShader.h"
# include "DrawRectShader.h"

namespace
{
Expand Down
40 changes: 20 additions & 20 deletions src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.cpp
Expand Up @@ -9,34 +9,34 @@

#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 <SDL2/SDL_video.h>
#include <openrct2/core/Console.hpp>
# include <SDL2/SDL_video.h>
# include <openrct2/core/Console.hpp>

static const char* TryLoadAllProcAddresses()
{
#define OPENGL_PROC(TYPE, PROC) \
{ \
PROC = (TYPE)SDL_GL_GetProcAddress(#PROC); \
if (PROC == nullptr) \
{ \
return #PROC; \
} \
}
#include "OpenGLAPIProc.h"
#undef OPENGL_PROC
# define OPENGL_PROC(TYPE, PROC) \
{ \
PROC = (TYPE)SDL_GL_GetProcAddress(#PROC); \
if (PROC == nullptr) \
{ \
return #PROC; \
} \
}
# include "OpenGLAPIProc.h"
# undef OPENGL_PROC

return nullptr;
}

#endif /* #if OPENGL_NO_LINK */
# endif /* #if OPENGL_NO_LINK */

namespace OpenGLState
{
Expand All @@ -63,14 +63,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;
}

Expand Down

0 comments on commit d787872

Please sign in to comment.