diff --git a/src/openrct2/network/Network.cpp b/src/openrct2/network/Network.cpp index c0d81982c7..b1743f8721 100644 --- a/src/openrct2/network/Network.cpp +++ b/src/openrct2/network/Network.cpp @@ -1692,8 +1692,10 @@ void Network::RemoveClient(std::unique_ptr& connection) if (connection_player) { char text[256]; - const char* has_disconnected_args[2] - = { (char*)connection_player->Name.c_str(), connection->GetLastDisconnectReason() }; + const char* has_disconnected_args[2] = { + connection_player->Name.c_str(), + connection->GetLastDisconnectReason(), + }; if (has_disconnected_args[1]) { format_string(text, 256, STR_MULTIPLAYER_PLAYER_HAS_DISCONNECTED_WITH_REASON, has_disconnected_args); @@ -2178,7 +2180,10 @@ void Network::Client_Handle_MAP([[maybe_unused]] NetworkConnection& connection, chunk_buffer.resize(size); } char str_downloading_map[256]; - uint32_t downloading_map_args[2] = { (offset + chunksize) / 1024, size / 1024 }; + uint32_t downloading_map_args[2] = { + (offset + chunksize) / 1024, + size / 1024, + }; format_string(str_downloading_map, 256, STR_MULTIPLAYER_DOWNLOADING_MAP, downloading_map_args); auto intent = Intent(WC_NETWORK_STATUS); @@ -3046,9 +3051,11 @@ void game_command_set_player_group( NetworkPlayer* game_command_player = gNetwork.GetPlayerByID(game_command_playerid); NetworkGroup* new_player_group = gNetwork.GetGroupByID(groupid); char log_msg[256]; - const char* args[3] = { (char*)player->Name.c_str(), - (char*)new_player_group->GetName().c_str(), - (char*)game_command_player->Name.c_str() }; + const char* args[3] = { + player->Name.c_str(), + new_player_group->GetName().c_str(), + game_command_player->Name.c_str(), + }; format_string(log_msg, 256, STR_LOG_SET_PLAYER_GROUP, args); network_append_server_log(log_msg); } @@ -3082,7 +3089,10 @@ void game_command_modify_groups( if (game_command_player) { char log_msg[256]; - const char* args[2] = { (char*)game_command_player->Name.c_str(), (char*)newgroup->GetName().c_str() }; + const char* args[2] = { + game_command_player->Name.c_str(), + newgroup->GetName().c_str(), + }; format_string(log_msg, 256, STR_LOG_ADD_PLAYER_GROUP, args); network_append_server_log(log_msg); } @@ -3115,9 +3125,11 @@ void game_command_modify_groups( NetworkGroup* group = gNetwork.GetGroupByID(groupid); if (game_command_player && group) { - char* groupName = (char*)group->GetName().c_str(); char log_msg[256]; - const char* args[2] = { (char*)game_command_player->Name.c_str(), groupName }; + const char* args[2] = { + game_command_player->Name.c_str(), + group->GetName().c_str(), + }; format_string(log_msg, 256, STR_LOG_REMOVE_PLAYER_GROUP, args); network_append_server_log(log_msg); } @@ -3178,7 +3190,10 @@ void game_command_modify_groups( // Log edit player group permissions event char log_msg[256]; - const char* args[2] = { (char*)player->Name.c_str(), (char*)group->GetName().c_str() }; + const char* args[2] = { + player->Name.c_str(), + group->GetName().c_str(), + }; format_string(log_msg, 256, STR_LOG_EDIT_PLAYER_GROUP_PERMISSIONS, args); network_append_server_log(log_msg); } @@ -3226,7 +3241,11 @@ void game_command_modify_groups( // Log edit player group name event NetworkPlayer* player = gNetwork.GetPlayerByID(game_command_playerid); char log_msg[256]; - const char* args[3] = { (char*)player->Name.c_str(), oldName, newName }; + const char* args[3] = { + player->Name.c_str(), + oldName, + newName, + }; format_string(log_msg, 256, STR_LOG_EDIT_PLAYER_GROUP_NAME, args); network_append_server_log(log_msg); @@ -3252,7 +3271,10 @@ void game_command_modify_groups( NetworkPlayer* player = gNetwork.GetPlayerByID(game_command_playerid); NetworkGroup* group = gNetwork.GetGroupByID(groupid); char log_msg[256]; - const char* args[2] = { (char*)player->Name.c_str(), (char*)group->GetName().c_str() }; + const char* args[2] = { + player->Name.c_str(), + group->GetName().c_str(), + }; format_string(log_msg, 256, STR_LOG_EDIT_DEFAULT_PLAYER_GROUP, args); network_append_server_log(log_msg); } @@ -3308,8 +3330,8 @@ void game_command_kick_player( // Log kick player event char log_msg[256]; const char* args[2] = { - (char*)player->Name.c_str(), - (char*)kicker->Name.c_str(), + player->Name.c_str(), + kicker->Name.c_str(), }; format_string(log_msg, 256, STR_LOG_PLAYER_KICKED, args); network_append_server_log(log_msg); diff --git a/src/openrct2/network/NetworkServerAdvertiser.cpp b/src/openrct2/network/NetworkServerAdvertiser.cpp index 6c6997c096..4184b6202d 100644 --- a/src/openrct2/network/NetworkServerAdvertiser.cpp +++ b/src/openrct2/network/NetworkServerAdvertiser.cpp @@ -231,8 +231,9 @@ private: static std::string GenerateAdvertiseKey() { // Generate a string of 16 random hex characters (64-integer key as a hex formatted string) - static constexpr const char hexChars[] - = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; + static constexpr char hexChars[] = { + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', + }; char key[17]; for (int32_t i = 0; i < 16; i++) { diff --git a/src/openrct2/object/BannerObject.cpp b/src/openrct2/object/BannerObject.cpp index 5b468a5949..aed6426385 100644 --- a/src/openrct2/object/BannerObject.cpp +++ b/src/openrct2/object/BannerObject.cpp @@ -90,8 +90,11 @@ void BannerObject::ReadJson(IReadObjectContext* context, const json_t* root) _legacyType.banner.scrolling_mode = json_integer_value(json_object_get(properties, "scrollingMode")); _legacyType.banner.price = json_integer_value(json_object_get(properties, "price")); - _legacyType.banner.flags - = ObjectJsonHelpers::GetFlags(properties, { { "hasPrimaryColour", BANNER_ENTRY_FLAG_HAS_PRIMARY_COLOUR } }); + _legacyType.banner.flags = ObjectJsonHelpers::GetFlags( + properties, + { + { "hasPrimaryColour", BANNER_ENTRY_FLAG_HAS_PRIMARY_COLOUR }, + }); SetPrimarySceneryGroup(ObjectJsonHelpers::GetString(json_object_get(properties, "sceneryGroup"))); diff --git a/src/openrct2/object/FootpathItemObject.cpp b/src/openrct2/object/FootpathItemObject.cpp index a2b522b93b..4a73fc98bb 100644 --- a/src/openrct2/object/FootpathItemObject.cpp +++ b/src/openrct2/object/FootpathItemObject.cpp @@ -112,13 +112,15 @@ void FootpathItemObject::ReadJson(IReadObjectContext* context, const json_t* roo // Flags _legacyType.path_bit.flags = ObjectJsonHelpers::GetFlags( properties, - { { "isBin", PATH_BIT_FLAG_IS_BIN }, - { "isBench", PATH_BIT_FLAG_IS_BENCH }, - { "isBreakable", PATH_BIT_FLAG_BREAKABLE }, - { "isLamp", PATH_BIT_FLAG_LAMP }, - { "isJumpingFountainWater", PATH_BIT_FLAG_JUMPING_FOUNTAIN_WATER }, - { "isJumpingFountainSnow", PATH_BIT_FLAG_JUMPING_FOUNTAIN_SNOW }, - { "isTelevision", PATH_BIT_FLAG_IS_QUEUE_SCREEN } }); + { + { "isBin", PATH_BIT_FLAG_IS_BIN }, + { "isBench", PATH_BIT_FLAG_IS_BENCH }, + { "isBreakable", PATH_BIT_FLAG_BREAKABLE }, + { "isLamp", PATH_BIT_FLAG_LAMP }, + { "isJumpingFountainWater", PATH_BIT_FLAG_JUMPING_FOUNTAIN_WATER }, + { "isJumpingFountainSnow", PATH_BIT_FLAG_JUMPING_FOUNTAIN_SNOW }, + { "isTelevision", PATH_BIT_FLAG_IS_QUEUE_SCREEN }, + }); // HACK To avoid 'negated' properties in JSON, handle these separately until // flags are inverted in this code base. diff --git a/src/openrct2/object/FootpathObject.cpp b/src/openrct2/object/FootpathObject.cpp index 09245e116b..4c8b302d4c 100644 --- a/src/openrct2/object/FootpathObject.cpp +++ b/src/openrct2/object/FootpathObject.cpp @@ -75,9 +75,11 @@ void FootpathObject::ReadJson(IReadObjectContext* context, const json_t* root) // Flags _legacyType.flags = ObjectJsonHelpers::GetFlags( properties, - { { "hasSupportImages", FOOTPATH_ENTRY_FLAG_HAS_SUPPORT_BASE_SPRITE }, - { "hasElevatedPathImages", FOOTPATH_ENTRY_FLAG_HAS_PATH_BASE_SPRITE }, - { "editorOnly", FOOTPATH_ENTRY_FLAG_SHOW_ONLY_IN_SCENARIO_EDITOR } }); + { + { "hasSupportImages", FOOTPATH_ENTRY_FLAG_HAS_SUPPORT_BASE_SPRITE }, + { "hasElevatedPathImages", FOOTPATH_ENTRY_FLAG_HAS_PATH_BASE_SPRITE }, + { "editorOnly", FOOTPATH_ENTRY_FLAG_SHOW_ONLY_IN_SCENARIO_EDITOR }, + }); ObjectJsonHelpers::LoadStrings(root, GetStringTable()); ObjectJsonHelpers::LoadImages(context, root, GetImageTable()); diff --git a/src/openrct2/object/LargeSceneryObject.cpp b/src/openrct2/object/LargeSceneryObject.cpp index 8d07221e0a..0431a92de5 100644 --- a/src/openrct2/object/LargeSceneryObject.cpp +++ b/src/openrct2/object/LargeSceneryObject.cpp @@ -136,10 +136,12 @@ void LargeSceneryObject::ReadJson(IReadObjectContext* context, const json_t* roo // Flags _legacyType.large_scenery.flags = ObjectJsonHelpers::GetFlags( properties, - { { "hasPrimaryColour", LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR }, - { "hasSecondaryColour", LARGE_SCENERY_FLAG_HAS_SECONDARY_COLOUR }, - { "isAnimated", LARGE_SCENERY_FLAG_ANIMATED }, - { "isPhotogenic", LARGE_SCENERY_FLAG_PHOTOGENIC } }); + { + { "hasPrimaryColour", LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR }, + { "hasSecondaryColour", LARGE_SCENERY_FLAG_HAS_SECONDARY_COLOUR }, + { "isAnimated", LARGE_SCENERY_FLAG_ANIMATED }, + { "isPhotogenic", LARGE_SCENERY_FLAG_PHOTOGENIC }, + }); // Tiles auto jTiles = json_object_get(properties, "tiles"); @@ -220,7 +222,11 @@ std::unique_ptr LargeSceneryObject::ReadJson3dFont(const font->max_width = json_integer_value(json_object_get(j3dFont, "maxWidth")); font->num_images = json_integer_value(json_object_get(j3dFont, "numImages")); font->flags = ObjectJsonHelpers::GetFlags( - j3dFont, { { "isVertical", LARGE_SCENERY_TEXT_FLAG_VERTICAL }, { "isTwoLine", LARGE_SCENERY_TEXT_FLAG_TWO_LINE } }); + j3dFont, + { + { "isVertical", LARGE_SCENERY_TEXT_FLAG_VERTICAL }, + { "isTwoLine", LARGE_SCENERY_TEXT_FLAG_TWO_LINE }, + }); auto jGlyphs = json_object_get(j3dFont, "glyphs"); if (jGlyphs != nullptr) diff --git a/src/openrct2/object/ObjectRepository.cpp b/src/openrct2/object/ObjectRepository.cpp index 0c53c45fba..b350878756 100644 --- a/src/openrct2/object/ObjectRepository.cpp +++ b/src/openrct2/object/ObjectRepository.cpp @@ -85,8 +85,10 @@ public: VERSION, env.GetFilePath(PATHID::CACHE_OBJECTS), std::string(PATTERN), - std::vector({ env.GetDirectoryPath(DIRBASE::OPENRCT2, DIRID::OBJECT), - env.GetDirectoryPath(DIRBASE::USER, DIRID::OBJECT) })) + std::vector{ + env.GetDirectoryPath(DIRBASE::OPENRCT2, DIRID::OBJECT), + env.GetDirectoryPath(DIRBASE::USER, DIRID::OBJECT), + }) , _objectRepository(objectRepository) { } diff --git a/src/openrct2/object/RideObject.cpp b/src/openrct2/object/RideObject.cpp index 00fcf2461b..7e1248ba1c 100644 --- a/src/openrct2/object/RideObject.cpp +++ b/src/openrct2/object/RideObject.cpp @@ -169,7 +169,8 @@ void RideObject::Load() // RCT2 calculates num_vertical_frames and num_horizontal_frames and overwrites these properties on the vehicle // entry. Immediately afterwards, the two were multiplied in order to calculate base_num_frames and were never used // again. This has been changed to use the calculation results directly - num_vertical_frames and - // num_horizontal_frames are no longer set on the vehicle entry. 0x6DE946 + // num_horizontal_frames are no longer set on the vehicle entry. + // 0x6DE946 vehicleEntry->base_num_frames = CalculateNumVerticalFrames(vehicleEntry) * CalculateNumHorizontalFrames(vehicleEntry); vehicleEntry->base_image_id = cur_vehicle_images_offset; @@ -806,22 +807,24 @@ rct_ride_entry_vehicle RideObject::ReadJsonCar(const json_t* jCar) auto jFrames = json_object_get(jCar, "frames"); car.sprite_flags = ObjectJsonHelpers::GetFlags( jFrames, - { { "flat", VEHICLE_SPRITE_FLAG_FLAT }, - { "gentleSlopes", VEHICLE_SPRITE_FLAG_GENTLE_SLOPES }, - { "steepSlopes", VEHICLE_SPRITE_FLAG_STEEP_SLOPES }, - { "verticalSlopes", VEHICLE_SPRITE_FLAG_VERTICAL_SLOPES }, - { "diagonalSlopes", VEHICLE_SPRITE_FLAG_DIAGONAL_SLOPES }, - { "flatBanked", VEHICLE_SPRITE_FLAG_FLAT_BANKED }, - { "inlineTwists", VEHICLE_SPRITE_FLAG_INLINE_TWISTS }, - { "flatToGentleSlopeBankedTransitions", VEHICLE_SPRITE_FLAG_FLAT_TO_GENTLE_SLOPE_BANKED_TRANSITIONS }, - { "diagonalGentleSlopeBankedTransitions", VEHICLE_SPRITE_FLAG_DIAGONAL_GENTLE_SLOPE_BANKED_TRANSITIONS }, - { "gentleSlopeBankedTransitions", VEHICLE_SPRITE_FLAG_GENTLE_SLOPE_BANKED_TRANSITIONS }, - { "gentleSlopeBankedTurns", VEHICLE_SPRITE_FLAG_GENTLE_SLOPE_BANKED_TURNS }, - { "flatToGentleSlopeWhileBankedTransitions", VEHICLE_SPRITE_FLAG_FLAT_TO_GENTLE_SLOPE_WHILE_BANKED_TRANSITIONS }, - { "corkscrews", VEHICLE_SPRITE_FLAG_CORKSCREWS }, - { "restraintAnimation", VEHICLE_SPRITE_FLAG_RESTRAINT_ANIMATION }, - { "curvedLiftHill", VEHICLE_SPRITE_FLAG_CURVED_LIFT_HILL }, - { "VEHICLE_SPRITE_FLAG_15", VEHICLE_SPRITE_FLAG_15 } }); + { + { "flat", VEHICLE_SPRITE_FLAG_FLAT }, + { "gentleSlopes", VEHICLE_SPRITE_FLAG_GENTLE_SLOPES }, + { "steepSlopes", VEHICLE_SPRITE_FLAG_STEEP_SLOPES }, + { "verticalSlopes", VEHICLE_SPRITE_FLAG_VERTICAL_SLOPES }, + { "diagonalSlopes", VEHICLE_SPRITE_FLAG_DIAGONAL_SLOPES }, + { "flatBanked", VEHICLE_SPRITE_FLAG_FLAT_BANKED }, + { "inlineTwists", VEHICLE_SPRITE_FLAG_INLINE_TWISTS }, + { "flatToGentleSlopeBankedTransitions", VEHICLE_SPRITE_FLAG_FLAT_TO_GENTLE_SLOPE_BANKED_TRANSITIONS }, + { "diagonalGentleSlopeBankedTransitions", VEHICLE_SPRITE_FLAG_DIAGONAL_GENTLE_SLOPE_BANKED_TRANSITIONS }, + { "gentleSlopeBankedTransitions", VEHICLE_SPRITE_FLAG_GENTLE_SLOPE_BANKED_TRANSITIONS }, + { "gentleSlopeBankedTurns", VEHICLE_SPRITE_FLAG_GENTLE_SLOPE_BANKED_TURNS }, + { "flatToGentleSlopeWhileBankedTransitions", VEHICLE_SPRITE_FLAG_FLAT_TO_GENTLE_SLOPE_WHILE_BANKED_TRANSITIONS }, + { "corkscrews", VEHICLE_SPRITE_FLAG_CORKSCREWS }, + { "restraintAnimation", VEHICLE_SPRITE_FLAG_RESTRAINT_ANIMATION }, + { "curvedLiftHill", VEHICLE_SPRITE_FLAG_CURVED_LIFT_HILL }, + { "VEHICLE_SPRITE_FLAG_15", VEHICLE_SPRITE_FLAG_15 }, + }); car.flags |= ObjectJsonHelpers::GetFlags( jCar, diff --git a/src/openrct2/object/SmallSceneryObject.cpp b/src/openrct2/object/SmallSceneryObject.cpp index dded3a4377..1d2ea44eea 100644 --- a/src/openrct2/object/SmallSceneryObject.cpp +++ b/src/openrct2/object/SmallSceneryObject.cpp @@ -245,29 +245,31 @@ void SmallSceneryObject::ReadJson(IReadObjectContext* context, const json_t* roo // Flags _legacyType.small_scenery.flags = ObjectJsonHelpers::GetFlags( properties, - { { "SMALL_SCENERY_FLAG_VOFFSET_CENTRE", SMALL_SCENERY_FLAG_VOFFSET_CENTRE }, - { "requiresFlatSurface", SMALL_SCENERY_FLAG_REQUIRE_FLAT_SURFACE }, - { "isRotatable", SMALL_SCENERY_FLAG_ROTATABLE }, - { "isAnimated", SMALL_SCENERY_FLAG_ANIMATED }, - { "canWither", SMALL_SCENERY_FLAG_CAN_WITHER }, - { "canBeWatered", SMALL_SCENERY_FLAG_CAN_BE_WATERED }, - { "hasOverlayImage", SMALL_SCENERY_FLAG_ANIMATED_FG }, - { "hasGlass", SMALL_SCENERY_FLAG_HAS_GLASS }, - { "hasPrimaryColour", SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR }, - { "SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_1", SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_1 }, - { "SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_4", SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_4 }, - { "isClock", SMALL_SCENERY_FLAG_IS_CLOCK }, - { "SMALL_SCENERY_FLAG_SWAMP_GOO", SMALL_SCENERY_FLAG_SWAMP_GOO }, - { "SMALL_SCENERY_FLAG17", SMALL_SCENERY_FLAG17 }, - { "isStackable", SMALL_SCENERY_FLAG_STACKABLE }, - { "prohibitWalls", SMALL_SCENERY_FLAG_NO_WALLS }, - { "hasSecondaryColour", SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR }, - { "hasNoSupports", SMALL_SCENERY_FLAG_NO_SUPPORTS }, - { "SMALL_SCENERY_FLAG_VISIBLE_WHEN_ZOOMED", SMALL_SCENERY_FLAG_VISIBLE_WHEN_ZOOMED }, - { "SMALL_SCENERY_FLAG_COG", SMALL_SCENERY_FLAG_COG }, - { "allowSupportsAbove", SMALL_SCENERY_FLAG_BUILD_DIRECTLY_ONTOP }, - { "supportsHavePrimaryColour", SMALL_SCENERY_FLAG_PAINT_SUPPORTS }, - { "SMALL_SCENERY_FLAG27", SMALL_SCENERY_FLAG27 } }); + { + { "SMALL_SCENERY_FLAG_VOFFSET_CENTRE", SMALL_SCENERY_FLAG_VOFFSET_CENTRE }, + { "requiresFlatSurface", SMALL_SCENERY_FLAG_REQUIRE_FLAT_SURFACE }, + { "isRotatable", SMALL_SCENERY_FLAG_ROTATABLE }, + { "isAnimated", SMALL_SCENERY_FLAG_ANIMATED }, + { "canWither", SMALL_SCENERY_FLAG_CAN_WITHER }, + { "canBeWatered", SMALL_SCENERY_FLAG_CAN_BE_WATERED }, + { "hasOverlayImage", SMALL_SCENERY_FLAG_ANIMATED_FG }, + { "hasGlass", SMALL_SCENERY_FLAG_HAS_GLASS }, + { "hasPrimaryColour", SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR }, + { "SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_1", SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_1 }, + { "SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_4", SMALL_SCENERY_FLAG_FOUNTAIN_SPRAY_4 }, + { "isClock", SMALL_SCENERY_FLAG_IS_CLOCK }, + { "SMALL_SCENERY_FLAG_SWAMP_GOO", SMALL_SCENERY_FLAG_SWAMP_GOO }, + { "SMALL_SCENERY_FLAG17", SMALL_SCENERY_FLAG17 }, + { "isStackable", SMALL_SCENERY_FLAG_STACKABLE }, + { "prohibitWalls", SMALL_SCENERY_FLAG_NO_WALLS }, + { "hasSecondaryColour", SMALL_SCENERY_FLAG_HAS_SECONDARY_COLOUR }, + { "hasNoSupports", SMALL_SCENERY_FLAG_NO_SUPPORTS }, + { "SMALL_SCENERY_FLAG_VISIBLE_WHEN_ZOOMED", SMALL_SCENERY_FLAG_VISIBLE_WHEN_ZOOMED }, + { "SMALL_SCENERY_FLAG_COG", SMALL_SCENERY_FLAG_COG }, + { "allowSupportsAbove", SMALL_SCENERY_FLAG_BUILD_DIRECTLY_ONTOP }, + { "supportsHavePrimaryColour", SMALL_SCENERY_FLAG_PAINT_SUPPORTS }, + { "SMALL_SCENERY_FLAG27", SMALL_SCENERY_FLAG27 }, + }); // Determine shape flags from a shape string auto shape = ObjectJsonHelpers::GetString(properties, "shape"); diff --git a/src/openrct2/object/WallObject.cpp b/src/openrct2/object/WallObject.cpp index 3bb0c44142..d51ed63903 100644 --- a/src/openrct2/object/WallObject.cpp +++ b/src/openrct2/object/WallObject.cpp @@ -101,15 +101,21 @@ void WallObject::ReadJson(IReadObjectContext* context, const json_t* root) // Flags _legacyType.wall.flags = ObjectJsonHelpers::GetFlags( properties, - { { "hasPrimaryColour", WALL_SCENERY_HAS_PRIMARY_COLOUR }, - { "hasSecondaryColour", WALL_SCENERY_HAS_SECONDARY_COLOUR }, - { "hasTernaryColour", WALL_SCENERY_HAS_TERNARY_COLOUR }, - { "hasGlass", WALL_SCENERY_HAS_GLASS }, - { "isBanner", WALL_SCENERY_IS_BANNER }, - { "isDoor", WALL_SCENERY_IS_DOOR }, - { "isLongDoorAnimation", WALL_SCENERY_LONG_DOOR_ANIMATION } }); + { + { "hasPrimaryColour", WALL_SCENERY_HAS_PRIMARY_COLOUR }, + { "hasSecondaryColour", WALL_SCENERY_HAS_SECONDARY_COLOUR }, + { "hasTernaryColour", WALL_SCENERY_HAS_TERNARY_COLOUR }, + { "hasGlass", WALL_SCENERY_HAS_GLASS }, + { "isBanner", WALL_SCENERY_IS_BANNER }, + { "isDoor", WALL_SCENERY_IS_DOOR }, + { "isLongDoorAnimation", WALL_SCENERY_LONG_DOOR_ANIMATION }, + }); _legacyType.wall.flags2 = ObjectJsonHelpers::GetFlags( - properties, { { "isOpaque", WALL_SCENERY_2_IS_OPAQUE }, { "isAnimated", WALL_SCENERY_2_ANIMATED } }); + properties, + { + { "isOpaque", WALL_SCENERY_2_IS_OPAQUE }, + { "isAnimated", WALL_SCENERY_2_ANIMATED }, + }); // HACK To avoid 'negated' properties in JSON, handle this separately until // flag is inverted in this code base. diff --git a/src/openrct2/object/WaterObject.cpp b/src/openrct2/object/WaterObject.cpp index e038d21fd6..83dc980242 100644 --- a/src/openrct2/object/WaterObject.cpp +++ b/src/openrct2/object/WaterObject.cpp @@ -58,13 +58,18 @@ void WaterObject::DrawPreview(rct_drawpixelinfo* dpi, int32_t width, int32_t hei void WaterObject::ReadJson([[maybe_unused]] IReadObjectContext* context, const json_t* root) { auto properties = json_object_get(root, "properties"); - _legacyType.flags = ObjectJsonHelpers::GetFlags(properties, { { "allowDucks", WATER_FLAGS_ALLOW_DUCKS } }); + _legacyType.flags = ObjectJsonHelpers::GetFlags( + properties, + { + { "allowDucks", WATER_FLAGS_ALLOW_DUCKS }, + }); ObjectJsonHelpers::LoadStrings(root, GetStringTable()); // Images which are actually palette data - static const char* paletteNames[] - = { "general", "waves-0", "waves-1", "waves-2", "sparkles-0", "sparkles-1", "sparkles-2" }; + static const char* paletteNames[] = { + "general", "waves-0", "waves-1", "waves-2", "sparkles-0", "sparkles-1", "sparkles-2", + }; for (auto paletteName : paletteNames) { auto jPalettes = json_object_get(properties, "palettes"); diff --git a/src/openrct2/paint/Paint.cpp b/src/openrct2/paint/Paint.cpp index 39a2799f10..2d8f130f95 100644 --- a/src/openrct2/paint/Paint.cpp +++ b/src/openrct2/paint/Paint.cpp @@ -566,28 +566,60 @@ static void paint_ps_image_with_bounding_boxes(rct_drawpixelinfo* dpi, paint_str const uint8_t colour = BoundBoxDebugColours[ps->sprite_type]; const uint8_t rotation = get_current_rotation(); - const LocationXYZ16 frontTop = { (int16_t)ps->bounds.x_end, (int16_t)ps->bounds.y_end, (int16_t)ps->bounds.z_end }; + const LocationXYZ16 frontTop = { + (int16_t)ps->bounds.x_end, + (int16_t)ps->bounds.y_end, + (int16_t)ps->bounds.z_end, + }; const LocationXY16 screenCoordFrontTop = coordinate_3d_to_2d(&frontTop, rotation); - const LocationXYZ16 frontBottom = { (int16_t)ps->bounds.x_end, (int16_t)ps->bounds.y_end, (int16_t)ps->bounds.z }; + const LocationXYZ16 frontBottom = { + (int16_t)ps->bounds.x_end, + (int16_t)ps->bounds.y_end, + (int16_t)ps->bounds.z, + }; const LocationXY16 screenCoordFrontBottom = coordinate_3d_to_2d(&frontBottom, rotation); - const LocationXYZ16 leftTop = { (int16_t)ps->bounds.x, (int16_t)ps->bounds.y_end, (int16_t)ps->bounds.z_end }; + const LocationXYZ16 leftTop = { + (int16_t)ps->bounds.x, + (int16_t)ps->bounds.y_end, + (int16_t)ps->bounds.z_end, + }; const LocationXY16 screenCoordLeftTop = coordinate_3d_to_2d(&leftTop, rotation); - const LocationXYZ16 leftBottom = { (int16_t)ps->bounds.x, (int16_t)ps->bounds.y_end, (int16_t)ps->bounds.z }; + const LocationXYZ16 leftBottom = { + (int16_t)ps->bounds.x, + (int16_t)ps->bounds.y_end, + (int16_t)ps->bounds.z, + }; const LocationXY16 screenCoordLeftBottom = coordinate_3d_to_2d(&leftBottom, rotation); - const LocationXYZ16 rightTop = { (int16_t)ps->bounds.x_end, (int16_t)ps->bounds.y, (int16_t)ps->bounds.z_end }; + const LocationXYZ16 rightTop = { + (int16_t)ps->bounds.x_end, + (int16_t)ps->bounds.y, + (int16_t)ps->bounds.z_end, + }; const LocationXY16 screenCoordRightTop = coordinate_3d_to_2d(&rightTop, rotation); - const LocationXYZ16 rightBottom = { (int16_t)ps->bounds.x_end, (int16_t)ps->bounds.y, (int16_t)ps->bounds.z }; + const LocationXYZ16 rightBottom = { + (int16_t)ps->bounds.x_end, + (int16_t)ps->bounds.y, + (int16_t)ps->bounds.z, + }; const LocationXY16 screenCoordRightBottom = coordinate_3d_to_2d(&rightBottom, rotation); - const LocationXYZ16 backTop = { (int16_t)ps->bounds.x, (int16_t)ps->bounds.y, (int16_t)ps->bounds.z_end }; + const LocationXYZ16 backTop = { + (int16_t)ps->bounds.x, + (int16_t)ps->bounds.y, + (int16_t)ps->bounds.z_end, + }; const LocationXY16 screenCoordBackTop = coordinate_3d_to_2d(&backTop, rotation); - const LocationXYZ16 backBottom = { (int16_t)ps->bounds.x, (int16_t)ps->bounds.y, (int16_t)ps->bounds.z }; + const LocationXYZ16 backBottom = { + (int16_t)ps->bounds.x, + (int16_t)ps->bounds.y, + (int16_t)ps->bounds.z, + }; const LocationXY16 screenCoordBackBottom = coordinate_3d_to_2d(&backBottom, rotation); // bottom square @@ -748,9 +780,11 @@ paint_struct* sub_98196C( paint_struct* ps = &session->NextFreePaintStruct->basic; ps->image_id = image_id; - LocationXYZ16 coord_3d = { x_offset, // ax - y_offset, // cx - z_offset }; + LocationXYZ16 coord_3d = { + x_offset, // ax + y_offset, // cx + z_offset, + }; LocationXYZ16 boundBox = { bound_box_length_x, // di @@ -1149,7 +1183,11 @@ void paint_floating_money_effect( ps->args[3] = 0; ps->y_offsets = (uint8_t*)y_offsets; - const LocationXYZ16 position = { session->SpritePosition.x, session->SpritePosition.y, z }; + const LocationXYZ16 position = { + session->SpritePosition.x, + session->SpritePosition.y, + z, + }; const LocationXY16 coord = coordinate_3d_to_2d(&position, rotation); ps->x = coord.x + offset_x; diff --git a/src/openrct2/paint/VirtualFloor.cpp b/src/openrct2/paint/VirtualFloor.cpp index 30256f7d91..2b4af83e13 100644 --- a/src/openrct2/paint/VirtualFloor.cpp +++ b/src/openrct2/paint/VirtualFloor.cpp @@ -276,7 +276,12 @@ static void virtual_floor_get_tile_properties( void virtual_floor_paint(paint_session* session) { - static constexpr const CoordsXY scenery_half_tile_offsets[4] = { { -32, 0 }, { 0, 32 }, { 32, 0 }, { 0, -32 } }; + static constexpr const CoordsXY scenery_half_tile_offsets[4] = { + { -32, 0 }, + { 0, 32 }, + { 32, 0 }, + { 0, -32 }, + }; if (_virtualFloorHeight < MINIMUM_LAND_HEIGHT) return; diff --git a/src/openrct2/paint/sprite/Paint.Misc.cpp b/src/openrct2/paint/sprite/Paint.Misc.cpp index 354375bc31..946ac2dbc9 100644 --- a/src/openrct2/paint/sprite/Paint.Misc.cpp +++ b/src/openrct2/paint/sprite/Paint.Misc.cpp @@ -15,11 +15,15 @@ #include "Paint.Sprite.h" /** rct2: 0x0097EDA4 */ -static constexpr const int8_t money_wave[] = { 0, 1, 2, 2, 3, 3, 3, 3, 2, 2, 1, 0, -1, -2, -2, -3, -3, -3, -3, -2, -2, -1, - 0, 1, 2, 2, 3, 3, 3, 3, 2, 2, 1, 0, -1, -2, -2, -3, -3, -3, -3, -2, -2, -1 }; +static constexpr const int8_t money_wave[] = { + 0, 1, 2, 2, 3, 3, 3, 3, 2, 2, 1, 0, -1, -2, -2, -3, -3, -3, -3, -2, -2, -1, + 0, 1, 2, 2, 3, 3, 3, 3, 2, 2, 1, 0, -1, -2, -2, -3, -3, -3, -3, -2, -2, -1, +}; /** rct2: 0x0097ED90 */ -const uint32_t vehicle_particle_base_sprites[] = { 22577, 22589, 22601, 22613, 22625 }; +const uint32_t vehicle_particle_base_sprites[] = { + 22577, 22589, 22601, 22613, 22625, +}; /** * rct2: 0x00672AC9 diff --git a/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp b/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp index 68813ef5d9..fe6df87d54 100644 --- a/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp +++ b/src/openrct2/paint/tile_element/Paint.LargeScenery.cpp @@ -201,10 +201,27 @@ struct boundbox LocationXY16 length; }; -static constexpr const boundbox s98E3C4[] - = { { 3, 3, 26, 26 }, { 17, 17, 12, 12 }, { 17, 3, 12, 12 }, { 17, 3, 12, 26 }, { 3, 3, 12, 12 }, { 3, 3, 26, 26 }, - { 3, 3, 28, 12 }, { 3, 3, 26, 26 }, { 3, 17, 12, 12 }, { 3, 17, 26, 12 }, { 3, 3, 26, 26 }, { 3, 3, 26, 26 }, - { 3, 3, 12, 28 }, { 3, 3, 26, 26 }, { 3, 3, 26, 26 }, { 3, 3, 26, 26 }, { 1, 1, 30, 30 } }; +// clang-format off +static constexpr const boundbox s98E3C4[] = { + { 3, 3, 26, 26 }, + { 17, 17, 12, 12 }, + { 17, 3, 12, 12 }, + { 17, 3, 12, 26 }, + { 3, 3, 12, 12 }, + { 3, 3, 26, 26 }, + { 3, 3, 28, 12 }, + { 3, 3, 26, 26 }, + { 3, 17, 12, 12 }, + { 3, 17, 26, 12 }, + { 3, 3, 26, 26 }, + { 3, 3, 26, 26 }, + { 3, 3, 12, 28 }, + { 3, 3, 26, 26 }, + { 3, 3, 26, 26 }, + { 3, 3, 26, 26 }, + { 1, 1, 30, 30 }, +}; +// clang-format on /* * diff --git a/src/openrct2/paint/tile_element/Paint.Path.cpp b/src/openrct2/paint/tile_element/Paint.Path.cpp index b9896a7c69..2fad716a68 100644 --- a/src/openrct2/paint/tile_element/Paint.Path.cpp +++ b/src/openrct2/paint/tile_element/Paint.Path.cpp @@ -1366,7 +1366,12 @@ void path_paint_pole_support( ax = 8; } - uint8_t supports[] = { 6, 8, 7, 5 }; + uint8_t supports[] = { + 6, + 8, + 7, + 5, + }; for (int8_t i = 3; i > -1; --i) { diff --git a/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp b/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp index 61906f51a7..79f32e3a50 100644 --- a/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp +++ b/src/openrct2/paint/tile_element/Paint.SmallScenery.cpp @@ -19,7 +19,12 @@ #include "../Supports.h" #include "Paint.TileElement.h" -static constexpr const LocationXY16 lengths[] = { { 12, 26 }, { 26, 12 }, { 12, 26 }, { 26, 12 } }; +static constexpr const LocationXY16 lengths[] = { + { 12, 26 }, + { 26, 12 }, + { 12, 26 }, + { 26, 12 }, +}; /** * @@ -71,7 +76,12 @@ void scenery_paint(paint_session* session, uint8_t direction, int32_t height, co if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_HALF_SPACE)) { // 6DFFE3: - static constexpr const LocationXY16 scenery_half_tile_offsets[] = { { 3, 3 }, { 3, 17 }, { 17, 3 }, { 3, 3 } }; + static constexpr const LocationXY16 scenery_half_tile_offsets[] = { + { 3, 3 }, + { 3, 17 }, + { 17, 3 }, + { 3, 3 }, + }; boxoffset.x = scenery_half_tile_offsets[direction].x; boxoffset.y = scenery_half_tile_offsets[direction].y; boxlength.x = lengths[direction].x; diff --git a/src/openrct2/paint/tile_element/Paint.Surface.cpp b/src/openrct2/paint/tile_element/Paint.Surface.cpp index 37d75f2d14..8a5f897733 100644 --- a/src/openrct2/paint/tile_element/Paint.Surface.cpp +++ b/src/openrct2/paint/tile_element/Paint.Surface.cpp @@ -1068,16 +1068,18 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c const LocationXY16& base = session->SpritePosition; const corner_height& cornerHeights = corner_heights[surfaceShape]; - tile_descriptor selfDescriptor = { { base.x / 32, base.y / 32 }, - tileElement, - (uint8_t)terrain_type, - surfaceShape, - { - (uint8_t)(height / 16 + cornerHeights.top), - (uint8_t)(height / 16 + cornerHeights.right), - (uint8_t)(height / 16 + cornerHeights.bottom), - (uint8_t)(height / 16 + cornerHeights.left), - } }; + tile_descriptor selfDescriptor = { + { base.x / 32, base.y / 32 }, + tileElement, + (uint8_t)terrain_type, + surfaceShape, + { + (uint8_t)(height / 16 + cornerHeights.top), + (uint8_t)(height / 16 + cornerHeights.right), + (uint8_t)(height / 16 + cornerHeights.bottom), + (uint8_t)(height / 16 + cornerHeights.left), + }, + }; tile_descriptor tileDescriptors[5]; tileDescriptors[0] = selfDescriptor; @@ -1085,7 +1087,10 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c for (int32_t i = 0; i < 4; i++) { const LocationXY16& offset = viewport_surface_paint_data[i][rotation]; - const CoordsXY position = { (int32_t)(base.x + offset.x), (int32_t)(base.y + offset.y) }; + const CoordsXY position = { + (int32_t)(base.x + offset.x), + (int32_t)(base.y + offset.y), + }; tile_descriptor& descriptor = tileDescriptors[i + 1]; diff --git a/src/openrct2/paint/tile_element/Paint.Wall.cpp b/src/openrct2/paint/tile_element/Paint.Wall.cpp index 578a627d6f..dd05ff5f34 100644 --- a/src/openrct2/paint/tile_element/Paint.Wall.cpp +++ b/src/openrct2/paint/tile_element/Paint.Wall.cpp @@ -23,17 +23,21 @@ #include "../Paint.h" #include "Paint.TileElement.h" -static constexpr const uint8_t byte_9A406C[] - = { 2, 2, 22, 26, 30, 34, 34, 34, 34, 34, 30, 26, 22, 2, 6, 2, 2, 2, 6, 10, 14, 18, 18, 18, 18, 18, 14, 10, 6, 2, 22, 2 }; +static constexpr const uint8_t byte_9A406C[] = { + 2, 2, 22, 26, 30, 34, 34, 34, 34, 34, 30, 26, 22, 2, 6, 2, 2, 2, 6, 10, 14, 18, 18, 18, 18, 18, 14, 10, 6, 2, 22, 2, +}; -static constexpr const uint8_t byte_9A408C[] - = { 0, 0, 4, 8, 12, 16, 16, 16, 16, 16, 12, 8, 4, 0, 20, 0, 0, 0, 20, 24, 28, 32, 32, 32, 32, 32, 28, 24, 20, 0, 4, 0 }; +static constexpr const uint8_t byte_9A408C[] = { + 0, 0, 4, 8, 12, 16, 16, 16, 16, 16, 12, 8, 4, 0, 20, 0, 0, 0, 20, 24, 28, 32, 32, 32, 32, 32, 28, 24, 20, 0, 4, 0, +}; -static constexpr const uint8_t byte_9A40AC[] - = { 2, 2, 6, 10, 14, 18, 18, 18, 18, 18, 14, 10, 6, 2, 22, 2, 2, 2, 22, 26, 30, 34, 34, 34, 34, 34, 30, 26, 22, 2, 6, 2 }; +static constexpr const uint8_t byte_9A40AC[] = { + 2, 2, 6, 10, 14, 18, 18, 18, 18, 18, 14, 10, 6, 2, 22, 2, 2, 2, 22, 26, 30, 34, 34, 34, 34, 34, 30, 26, 22, 2, 6, 2, +}; -static constexpr const uint8_t byte_9A40CC[] - = { 0, 0, 20, 24, 28, 32, 32, 32, 32, 32, 28, 24, 20, 0, 4, 0, 0, 0, 4, 8, 12, 16, 16, 16, 16, 16, 12, 8, 4, 0, 20, 0 }; +static constexpr const uint8_t byte_9A40CC[] = { + 0, 0, 20, 24, 28, 32, 32, 32, 32, 32, 28, 24, 20, 0, 4, 0, 0, 0, 4, 8, 12, 16, 16, 16, 16, 16, 12, 8, 4, 0, 20, 0, +}; static void fence_paint_door( paint_session* session,