1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 09:32:29 +01:00

Merge pull request #22386 from mrmbernardi/format

Apply check-code-formatting changes
This commit is contained in:
Michael Steenbeek
2024-10-03 13:21:45 +02:00
committed by GitHub
21 changed files with 1163 additions and 1163 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:17-format
defaults:
run:
shell: sh

View File

@@ -16,4 +16,4 @@ fi
basedir="$($readlink_bin -f `dirname $0`/..)"
cd $basedir
scripts/run-clang-format.py -r src test data/shaders --exclude src/thirdparty
scripts/run-clang-format.py --clang-format-executable /usr/lib/llvm18/bin/clang-format -r src test data/shaders --exclude src/thirdparty

View File

@@ -207,7 +207,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,21 @@ enum
constexpr char NAC = '\0';
#define ExampleTableEnd \
{ \
nullptr, nullptr \
}
#define OptionTableEnd \
{ \
UINT8_MAX, nullptr, NAC, nullptr, nullptr \
}
#define CommandTableEnd \
{ \
nullptr, nullptr, nullptr, nullptr, nullptr \
}
constexpr CommandLineExample kExampleTableEnd = CommandLineExample{ nullptr, nullptr };
constexpr CommandLineOptionDefinition kOptionTableEnd = CommandLineOptionDefinition{ UINT8_MAX, nullptr, NAC, nullptr,
nullptr };
constexpr CommandLineCommand kCommandTableEnd = CommandLineCommand{ nullptr, nullptr, nullptr, nullptr, nullptr };
#define DefineCommand(name, params, options, func) \
{ \
name, params, options, nullptr, func \
}
#define DefineSubCommand(name, subcommandtable) \
{ \
name, "", nullptr, subcommandtable, nullptr \
}
consteval CommandLineCommand DefineCommand(
const char* name, const char* params, const CommandLineOptionDefinition* options, const CommandLineFunc func)
{
return CommandLineCommand{ name, params, options, nullptr, func };
}
consteval CommandLineCommand DefineSubCommand(const char* name, const CommandLineCommand* subcommandtable)
{
return CommandLineCommand{ name, "", nullptr, subcommandtable, nullptr };
}
namespace OpenRCT2::CommandLine
{

View File

@@ -21,7 +21,7 @@ using namespace OpenRCT2;
// clang-format off
static constexpr CommandLineOptionDefinition NoOptions[]
{
OptionTableEnd
kOptionTableEnd
};
static exitcode_t HandleObjectsInfo(CommandLineArgEnumerator *argEnumerator);
@@ -30,7 +30,7 @@ const CommandLineCommand CommandLine::ParkInfoCommands[]{
// Main commands
DefineCommand("objects", "<savefile>", NoOptions, HandleObjectsInfo),
CommandTableEnd
kCommandTableEnd
};
// clang-format on

View File

@@ -87,7 +87,7 @@ static constexpr CommandLineOptionDefinition StandardOptions[]
#ifdef USE_BREAKPAD
{ CMDLINE_TYPE_SWITCH, &_silentBreakpad, NAC, "silent-breakpad", "make breakpad crash reporting silent" },
#endif // USE_BREAKPAD
OptionTableEnd
kOptionTableEnd
};
static exitcode_t HandleNoCommand(CommandLineArgEnumerator * enumerator);
@@ -146,7 +146,7 @@ const CommandLineCommand CommandLine::RootCommands[]
DefineSubCommand("sprite", CommandLine::SpriteCommands ),
DefineSubCommand("simulate", CommandLine::SimulateCommands ),
DefineSubCommand("parkinfo", CommandLine::ParkInfoCommands ),
CommandTableEnd
kCommandTableEnd
};
const CommandLineExample CommandLine::RootExamples[]
@@ -160,7 +160,7 @@ const CommandLineExample CommandLine::RootExamples[]
#ifndef DISABLE_NETWORK
{ "host ./my_park.sv6 --port 11753 --headless", "run a headless server for a saved park" },
#endif
ExampleTableEnd
kExampleTableEnd
};
// clang-format on

View File

@@ -27,7 +27,7 @@ static constexpr CommandLineOptionDefinition ScreenshotOptionsDef[]
{ CMDLINE_TYPE_SWITCH, &_options.remove_litter, NAC, "remove-litter", "remove litter for the screenshot" },
{ CMDLINE_TYPE_SWITCH, &_options.tidy_up_park, NAC, "tidy-up-park", "clear grass, water plants, fix vandalism and remove litter" },
{ CMDLINE_TYPE_SWITCH, &_options.transparent, NAC, "transparent", "make the background transparent" },
OptionTableEnd
kOptionTableEnd
};
static exitcode_t HandleScreenshot(CommandLineArgEnumerator *argEnumerator);
@@ -37,7 +37,7 @@ const CommandLineCommand CommandLine::ScreenshotCommands[]
// Main commands
DefineCommand("", "<file> <output_image> <width> <height> [<x> <y> <zoom> <rotation>]", ScreenshotOptionsDef, HandleScreenshot),
DefineCommand("", "<file> <output_image> giant <zoom> <rotation>", ScreenshotOptionsDef, HandleScreenshot),
CommandTableEnd
kCommandTableEnd
};
// clang-format on

View File

@@ -26,7 +26,8 @@ using namespace OpenRCT2;
static exitcode_t HandleSimulate(CommandLineArgEnumerator* argEnumerator);
const CommandLineCommand CommandLine::SimulateCommands[]{ // Main commands
DefineCommand("", "<ticks>", nullptr, HandleSimulate), CommandTableEnd
DefineCommand("", "<ticks>", nullptr, HandleSimulate),
kCommandTableEnd
};
static exitcode_t HandleSimulate(CommandLineArgEnumerator* argEnumerator)

View File

@@ -28,7 +28,7 @@ static const char* _mode;
static constexpr CommandLineOptionDefinition SpriteOptions[]
{
{ CMDLINE_TYPE_STRING, &_mode, 'm', "mode", "the type of sprite conversion <" SZ_DEFAULT "|" SZ_CLOSEST "|" SZ_DITHERING ">" },
OptionTableEnd
kOptionTableEnd
};
static exitcode_t HandleSprite(CommandLineArgEnumerator *argEnumerator);
@@ -45,7 +45,7 @@ const CommandLineCommand CommandLine::SpriteCommands[]
DefineCommand("exportall", "<spritefile> <output directory>", SpriteOptions, HandleSprite),
DefineCommand("exportalldat", "<DAT identifier> <output directory>", SpriteOptions, HandleSprite),
CommandTableEnd
kCommandTableEnd
};
// clang-format on

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
{

File diff suppressed because it is too large Load Diff

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;