From f110ea14f57decb38a282475d3840a42ce9ba933 Mon Sep 17 00:00:00 2001 From: Michael Bernardi Date: Fri, 26 Jul 2024 18:48:35 +1000 Subject: [PATCH] Apply check-code-formatting changes --- .github/workflows/ci.yml | 2 +- src/openrct2-ui/windows/Map.cpp | 2 +- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/command_line/CommandLine.hpp | 25 ++++--------------- src/openrct2/core/BitSet.hpp | 2 +- src/openrct2/drawing/ScrollingText.cpp | 2 +- src/openrct2/drawing/TTFSDLPort.cpp | 1 + src/openrct2/entity/Guest.h | 2 +- src/openrct2/object/ObjectRepository.cpp | 10 ++++---- src/openrct2/platform/Platform.Linux.cpp | 2 +- src/openrct2/ride/TrackDesignRepository.cpp | 12 ++++----- src/openrct2/ride/TrackDesignRepository.h | 4 +-- src/openrct2/scenario/ScenarioRepository.cpp | 12 ++++----- .../scripting/bindings/game/ScContext.hpp | 3 ++- src/openrct2/ui/DummyWindowManager.cpp | 2 +- 15 files changed, 35 insertions(+), 48 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3d33bbcaf..f2e024c945 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,7 +63,7 @@ jobs: check-code-formatting: name: Check code formatting runs-on: ubuntu-latest - container: openrct2/openrct2-build:4-format + container: openrct2/openrct2-build:15-format defaults: run: shell: sh diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index db4acc0421..4f16633151 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -206,7 +206,7 @@ namespace OpenRCT2::Ui::Windows constexpr uint16_t FlashGuests = (1 << 1); constexpr uint16_t FlashStaff = (1 << 3); constexpr uint16_t SwitchColour = (1 << 15); // Every couple ticks the colour switches - } // namespace MapFlashingFlags + } // namespace MapFlashingFlags class MapWindow final : public Window { diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index 9d9d65f4a1..43b23a87d9 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -234,7 +234,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots std::memcpy(&valB, &spriteCmp.field, sizeof(struc::field)); \ uintptr_t offset = reinterpret_cast(&spriteBase.field) - reinterpret_cast(&spriteBase); \ changeData.diffs.push_back( \ - GameStateSpriteChange::Diff{ static_cast(offset), sizeof(struc::field), #struc, #field, valA, valB }); \ + GameStateSpriteChange::Diff { static_cast(offset), sizeof(struc::field), #struc, #field, valA, valB }); \ } void CompareSpriteDataCommon( diff --git a/src/openrct2/command_line/CommandLine.hpp b/src/openrct2/command_line/CommandLine.hpp index fbc6d497be..95998bb1d5 100644 --- a/src/openrct2/command_line/CommandLine.hpp +++ b/src/openrct2/command_line/CommandLine.hpp @@ -89,27 +89,12 @@ enum constexpr char NAC = '\0'; -#define ExampleTableEnd \ - { \ - nullptr, nullptr \ - } -#define OptionTableEnd \ - { \ - UINT8_MAX, nullptr, NAC, nullptr, nullptr \ - } -#define CommandTableEnd \ - { \ - nullptr, nullptr, nullptr, nullptr, nullptr \ - } +#define ExampleTableEnd { nullptr, nullptr } +#define OptionTableEnd { UINT8_MAX, nullptr, NAC, nullptr, nullptr } +#define CommandTableEnd { nullptr, nullptr, nullptr, nullptr, nullptr } -#define DefineCommand(name, params, options, func) \ - { \ - name, params, options, nullptr, func \ - } -#define DefineSubCommand(name, subcommandtable) \ - { \ - name, "", nullptr, subcommandtable, nullptr \ - } +#define DefineCommand(name, params, options, func) { name, params, options, nullptr, func } +#define DefineSubCommand(name, subcommandtable) { name, "", nullptr, subcommandtable, nullptr } namespace OpenRCT2::CommandLine { diff --git a/src/openrct2/core/BitSet.hpp b/src/openrct2/core/BitSet.hpp index 1ca06dbebb..4aef9c567f 100644 --- a/src/openrct2/core/BitSet.hpp +++ b/src/openrct2/core/BitSet.hpp @@ -130,7 +130,7 @@ namespace OpenRCT2 using value_type = typename StorageBlockType()>::value_type; }; } // namespace BitSet - } // namespace Detail + } // namespace Detail template class BitSet { diff --git a/src/openrct2/drawing/ScrollingText.cpp b/src/openrct2/drawing/ScrollingText.cpp index b1552f3f69..494663d279 100644 --- a/src/openrct2/drawing/ScrollingText.cpp +++ b/src/openrct2/drawing/ScrollingText.cpp @@ -160,7 +160,7 @@ static void ScrollingTextFormat(utf8* dst, size_t size, DrawScrollText* scrollTe extern bool TempForScrollText; -#define SCROLL_POS(x, y) (((y)*64) + (x)) +#define SCROLL_POS(x, y) (((y) * 64) + (x)) // clang-format off static constexpr int16_t _scrollpos0[] = { diff --git a/src/openrct2/drawing/TTFSDLPort.cpp b/src/openrct2/drawing/TTFSDLPort.cpp index 46ca0870ce..becfa00634 100644 --- a/src/openrct2/drawing/TTFSDLPort.cpp +++ b/src/openrct2/drawing/TTFSDLPort.cpp @@ -1,4 +1,5 @@ // Adapted from freetype.h in order to avoid C-style casts. +// clang-format off #define FT_LOAD_TARGET_ALT(x) (static_cast((x)&15) << 16) #define FT_IMAGE_TAG(value, _x1, _x2, _x3, _x4) \ diff --git a/src/openrct2/entity/Guest.h b/src/openrct2/entity/Guest.h index 330aeb1b39..915d4f8316 100644 --- a/src/openrct2/entity/Guest.h +++ b/src/openrct2/entity/Guest.h @@ -380,7 +380,7 @@ public: private: void UpdateRide(); - void UpdateOnRide(){}; // TODO + void UpdateOnRide() {}; // TODO void UpdateWalking(); void UpdateWaitingAtCrossing(); void UpdateQueuing(); diff --git a/src/openrct2/object/ObjectRepository.cpp b/src/openrct2/object/ObjectRepository.cpp index 0be587ed93..5be0e5eae8 100644 --- a/src/openrct2/object/ObjectRepository.cpp +++ b/src/openrct2/object/ObjectRepository.cpp @@ -84,11 +84,11 @@ private: public: explicit ObjectFileIndex(IObjectRepository& objectRepository, const IPlatformEnvironment& env) : FileIndex( - "object index", MAGIC_NUMBER, VERSION, env.GetFilePath(PATHID::CACHE_OBJECTS), std::string(PATTERN), - std::vector{ - env.GetDirectoryPath(DIRBASE::OPENRCT2, DIRID::OBJECT), - env.GetDirectoryPath(DIRBASE::USER, DIRID::OBJECT), - }) + "object index", MAGIC_NUMBER, VERSION, env.GetFilePath(PATHID::CACHE_OBJECTS), std::string(PATTERN), + std::vector{ + env.GetDirectoryPath(DIRBASE::OPENRCT2, DIRID::OBJECT), + env.GetDirectoryPath(DIRBASE::USER, DIRID::OBJECT), + }) , _objectRepository(objectRepository) { } diff --git a/src/openrct2/platform/Platform.Linux.cpp b/src/openrct2/platform/Platform.Linux.cpp index 309bb959da..4d4853d9e7 100644 --- a/src/openrct2/platform/Platform.Linux.cpp +++ b/src/openrct2/platform/Platform.Linux.cpp @@ -199,7 +199,7 @@ namespace OpenRCT2::Platform break; } } - } // end strip + } // end strip std::memcpy(pattern, langString, length); // copy all until first '.' or '@' pattern[length] = '\0'; // find _ if present diff --git a/src/openrct2/ride/TrackDesignRepository.cpp b/src/openrct2/ride/TrackDesignRepository.cpp index 9665171c84..20754ae482 100644 --- a/src/openrct2/ride/TrackDesignRepository.cpp +++ b/src/openrct2/ride/TrackDesignRepository.cpp @@ -61,12 +61,12 @@ private: public: explicit TrackDesignFileIndex(const IPlatformEnvironment& env) : FileIndex( - "track design index", MAGIC_NUMBER, VERSION, env.GetFilePath(PATHID::CACHE_TRACKS), std::string(PATTERN), - std::vector({ - env.GetDirectoryPath(DIRBASE::RCT1, DIRID::TRACK), - env.GetDirectoryPath(DIRBASE::RCT2, DIRID::TRACK), - env.GetDirectoryPath(DIRBASE::USER, DIRID::TRACK), - })) + "track design index", MAGIC_NUMBER, VERSION, env.GetFilePath(PATHID::CACHE_TRACKS), std::string(PATTERN), + std::vector({ + env.GetDirectoryPath(DIRBASE::RCT1, DIRID::TRACK), + env.GetDirectoryPath(DIRBASE::RCT2, DIRID::TRACK), + env.GetDirectoryPath(DIRBASE::USER, DIRID::TRACK), + })) { } diff --git a/src/openrct2/ride/TrackDesignRepository.h b/src/openrct2/ride/TrackDesignRepository.h index 41a83ce1cd..17aa3fdafc 100644 --- a/src/openrct2/ride/TrackDesignRepository.h +++ b/src/openrct2/ride/TrackDesignRepository.h @@ -32,8 +32,8 @@ struct ITrackDesignRepository [[nodiscard]] virtual size_t GetCount() const = 0; [[nodiscard]] virtual size_t GetCountForObjectEntry(ride_type_t rideType, const std::string& entry) const = 0; - [[nodiscard]] virtual std::vector GetItemsForObjectEntry( - ride_type_t rideType, const std::string& entry) const = 0; + [[nodiscard]] virtual std::vector + GetItemsForObjectEntry(ride_type_t rideType, const std::string& entry) const = 0; virtual void Scan(int32_t language) = 0; virtual bool Delete(const std::string& path) = 0; diff --git a/src/openrct2/scenario/ScenarioRepository.cpp b/src/openrct2/scenario/ScenarioRepository.cpp index 5c05dad2cd..e2b91456d4 100644 --- a/src/openrct2/scenario/ScenarioRepository.cpp +++ b/src/openrct2/scenario/ScenarioRepository.cpp @@ -130,12 +130,12 @@ private: public: explicit ScenarioFileIndex(const IPlatformEnvironment& env) : FileIndex( - "scenario index", MAGIC_NUMBER, VERSION, env.GetFilePath(PATHID::CACHE_SCENARIOS), std::string(PATTERN), - std::vector({ - env.GetDirectoryPath(DIRBASE::RCT1, DIRID::SCENARIO), - env.GetDirectoryPath(DIRBASE::RCT2, DIRID::SCENARIO), - env.GetDirectoryPath(DIRBASE::USER, DIRID::SCENARIO), - })) + "scenario index", MAGIC_NUMBER, VERSION, env.GetFilePath(PATHID::CACHE_SCENARIOS), std::string(PATTERN), + std::vector({ + env.GetDirectoryPath(DIRBASE::RCT1, DIRID::SCENARIO), + env.GetDirectoryPath(DIRBASE::RCT2, DIRID::SCENARIO), + env.GetDirectoryPath(DIRBASE::USER, DIRID::SCENARIO), + })) { } diff --git a/src/openrct2/scripting/bindings/game/ScContext.hpp b/src/openrct2/scripting/bindings/game/ScContext.hpp index f398c39f14..5a06de9371 100644 --- a/src/openrct2/scripting/bindings/game/ScContext.hpp +++ b/src/openrct2/scripting/bindings/game/ScContext.hpp @@ -273,7 +273,8 @@ namespace OpenRCT2::Scripting // Only ensuring it was not in the same generated method fixed it. __declspec(noinline) # endif - std::shared_ptr CreateSubscription(HOOK_TYPE hookType, const DukValue& callback) + std::shared_ptr + CreateSubscription(HOOK_TYPE hookType, const DukValue& callback) { auto owner = _execInfo.GetCurrentPlugin(); auto cookie = _hookEngine.Subscribe(hookType, owner, callback); diff --git a/src/openrct2/ui/DummyWindowManager.cpp b/src/openrct2/ui/DummyWindowManager.cpp index a00e0964c2..29fde53974 100644 --- a/src/openrct2/ui/DummyWindowManager.cpp +++ b/src/openrct2/ui/DummyWindowManager.cpp @@ -14,7 +14,7 @@ namespace OpenRCT2::Ui { class DummyWindowManager final : public IWindowManager { - void Init() override{}; + void Init() override {}; WindowBase* OpenWindow(WindowClass /*wc*/) override { return nullptr;