From 3729ca71719bf8963331bd65a77c5154c19355ff Mon Sep 17 00:00:00 2001 From: Bas Date: Sat, 12 Oct 2024 23:13:09 +0200 Subject: [PATCH] Format project, apply custom clang-format only to Unity bindings project --- .clang-format | 2 -- src/openrct2-bindings/.clang-format | 6 ++++++ src/openrct2-bindings/Map/Path.cpp | 2 +- src/openrct2-bindings/Map/Surface.cpp | 6 ++---- src/openrct2-bindings/Map/Track.cpp | 2 +- src/openrct2-bindings/Map/Wall.cpp | 2 +- 6 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 src/openrct2-bindings/.clang-format diff --git a/.clang-format b/.clang-format index 392af73e9415..b81be7ebbaa0 100644 --- a/.clang-format +++ b/.clang-format @@ -24,7 +24,6 @@ BraceWrapping: AfterClass: true AfterControlStatement: true AfterEnum: true - AfterExternBlock: true AfterFunction: true AfterNamespace: true AfterStruct: true @@ -63,7 +62,6 @@ IncludeCategories: - Regex: '^<' Priority: 2 IndentCaseLabels: true -IndentExternBlock: true IndentPPDirectives: AfterHash IndentWidth: 4 IndentWrappedFunctionNames: true diff --git a/src/openrct2-bindings/.clang-format b/src/openrct2-bindings/.clang-format new file mode 100644 index 000000000000..b220b4727fb0 --- /dev/null +++ b/src/openrct2-bindings/.clang-format @@ -0,0 +1,6 @@ +--- +BasedOnStyle: InheritParentConfig +BraceWrapping: + AfterExternBlock: true +IndentExternBlock: true +... diff --git a/src/openrct2-bindings/Map/Path.cpp b/src/openrct2-bindings/Map/Path.cpp index 5fa1e460e61c..e5a58ec612d0 100644 --- a/src/openrct2-bindings/Map/Path.cpp +++ b/src/openrct2-bindings/Map/Path.cpp @@ -73,7 +73,7 @@ extern "C" EXPORT void GetPathElementAt(int x, int y, int index, PathInfo* element) { const TileElement* source = GetTileElementAt(x, y, index, TileElementType::Path); - SetPathInfo(x, y, index, source, element); + SetPathInfo(x, y, index, source, element); } // Writes all the path element details to the specified buffer. diff --git a/src/openrct2-bindings/Map/Surface.cpp b/src/openrct2-bindings/Map/Surface.cpp index b5639e6caa4b..663fe6fad7d8 100644 --- a/src/openrct2-bindings/Map/Surface.cpp +++ b/src/openrct2-bindings/Map/Surface.cpp @@ -2,11 +2,9 @@ #include "../Utilities/Logging.h" #include "../Utilities/TileElementHelper.h" -#include #include #include #include -#include #include extern "C" @@ -32,9 +30,9 @@ extern "C" uint8_t grassLength = surface->GetGrassLength(); auto imageId = ImageId(surfaceObject->GetImageId({ x, y }, grassLength, element->GetDirection(), 0, false, false)); if (surfaceObject->Colour != 255) - { + { imageId = imageId.WithPrimary(surfaceObject->Colour); - } + } return imageId.ToUInt32(); } diff --git a/src/openrct2-bindings/Map/Track.cpp b/src/openrct2-bindings/Map/Track.cpp index dc71376ecd36..d43241b18d5a 100644 --- a/src/openrct2-bindings/Map/Track.cpp +++ b/src/openrct2-bindings/Map/Track.cpp @@ -28,7 +28,7 @@ extern "C" static void SetTrackInfo(int x, int y, int index, const TileElement* source, TrackInfo* target) { const TrackElement* track = source->AsTrack(); - + if (track == nullptr) { dll_log("Could not find track element at %i, %i, index %i", x, y, index); diff --git a/src/openrct2-bindings/Map/Wall.cpp b/src/openrct2-bindings/Map/Wall.cpp index e24627b654d5..37cbd2708d23 100644 --- a/src/openrct2-bindings/Map/Wall.cpp +++ b/src/openrct2-bindings/Map/Wall.cpp @@ -93,7 +93,7 @@ extern "C" const TileElement* source = GetTileElementAt(x, y, index, TileElementType::Wall); SetWallInfo(x, y, index, source, element); } - + // Writes all the wall element details to the specified buffer. EXPORT int GetAllWallElementsAt(int x, int y, WallInfo* elements, int length) {