1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-26 08:14:38 +01:00

Apply check-code-formatting changes

This commit is contained in:
Michael Bernardi
2024-07-26 18:48:35 +10:00
parent ffad32ee8c
commit f110ea14f5
15 changed files with 35 additions and 48 deletions

View File

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

View File

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

View File

@@ -234,7 +234,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots
std::memcpy(&valB, &spriteCmp.field, sizeof(struc::field)); \
uintptr_t offset = reinterpret_cast<uintptr_t>(&spriteBase.field) - reinterpret_cast<uintptr_t>(&spriteBase); \
changeData.diffs.push_back( \
GameStateSpriteChange::Diff{ static_cast<size_t>(offset), sizeof(struc::field), #struc, #field, valA, valB }); \
GameStateSpriteChange::Diff { static_cast<size_t>(offset), sizeof(struc::field), #struc, #field, valA, valB }); \
}
void CompareSpriteDataCommon(

View File

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

View File

@@ -130,7 +130,7 @@ namespace OpenRCT2
using value_type = typename StorageBlockType<ComputeBlockSize<TBitSize>()>::value_type;
};
} // namespace BitSet
} // namespace Detail
} // namespace Detail
template<size_t TBitSize> class BitSet
{

View File

@@ -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[] = {

View File

@@ -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<FT_Int32>((x)&15) << 16)
#define FT_IMAGE_TAG(value, _x1, _x2, _x3, _x4) \

View File

@@ -380,7 +380,7 @@ public:
private:
void UpdateRide();
void UpdateOnRide(){}; // TODO
void UpdateOnRide() {}; // TODO
void UpdateWalking();
void UpdateWaitingAtCrossing();
void UpdateQueuing();

View File

@@ -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<std::string>{
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<std::string>{
env.GetDirectoryPath(DIRBASE::OPENRCT2, DIRID::OBJECT),
env.GetDirectoryPath(DIRBASE::USER, DIRID::OBJECT),
})
, _objectRepository(objectRepository)
{
}

View File

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

View File

@@ -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<std::string>({
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<std::string>({
env.GetDirectoryPath(DIRBASE::RCT1, DIRID::TRACK),
env.GetDirectoryPath(DIRBASE::RCT2, DIRID::TRACK),
env.GetDirectoryPath(DIRBASE::USER, DIRID::TRACK),
}))
{
}

View File

@@ -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<TrackDesignFileRef> GetItemsForObjectEntry(
ride_type_t rideType, const std::string& entry) const = 0;
[[nodiscard]] virtual std::vector<TrackDesignFileRef>
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;

View File

@@ -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<std::string>({
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<std::string>({
env.GetDirectoryPath(DIRBASE::RCT1, DIRID::SCENARIO),
env.GetDirectoryPath(DIRBASE::RCT2, DIRID::SCENARIO),
env.GetDirectoryPath(DIRBASE::USER, DIRID::SCENARIO),
}))
{
}

View File

@@ -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<ScDisposable> CreateSubscription(HOOK_TYPE hookType, const DukValue& callback)
std::shared_ptr<ScDisposable>
CreateSubscription(HOOK_TYPE hookType, const DukValue& callback)
{
auto owner = _execInfo.GetCurrentPlugin();
auto cookie = _hookEngine.Subscribe(hookType, owner, callback);

View File

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