diff --git a/src/openrct2/actions/GameAction.h b/src/openrct2/actions/GameAction.h index 746b123888..5041351bcb 100644 --- a/src/openrct2/actions/GameAction.h +++ b/src/openrct2/actions/GameAction.h @@ -77,7 +77,7 @@ public: rct_string_id ErrorTitle = STR_NONE; rct_string_id ErrorMessage = STR_NONE; std::array ErrorMessageArgs; - CoordsXYZ Position = { 0 }; + CoordsXYZ Position = {}; money32 Cost = 0; uint16 ExpenditureType = 0; diff --git a/src/openrct2/core/Json.hpp b/src/openrct2/core/Json.hpp index 3264d446fb..ce305a8724 100644 --- a/src/openrct2/core/Json.hpp +++ b/src/openrct2/core/Json.hpp @@ -34,7 +34,7 @@ namespace Json class JsonException final : public std::runtime_error { private: - json_error_t _jsonError = { 0 }; + json_error_t _jsonError = {}; public: explicit JsonException(const std::string &message) : std::runtime_error(message) { } diff --git a/src/openrct2/drawing/Drawing.Sprite.cpp b/src/openrct2/drawing/Drawing.Sprite.cpp index 2811659d4e..cee30f9e2c 100644 --- a/src/openrct2/drawing/Drawing.Sprite.cpp +++ b/src/openrct2/drawing/Drawing.Sprite.cpp @@ -217,12 +217,12 @@ static std::string gfx_get_csg_data_path() return path; } -static rct_gx _g1 = { 0 }; -static rct_gx _g2 = { 0 }; -static rct_gx _csg = { 0 }; +static rct_gx _g1 = {}; +static rct_gx _g2 = {}; +static rct_gx _csg = {}; static bool _csgLoaded = false; -static rct_g1_element _g1Temp = { nullptr }; +static rct_g1_element _g1Temp = {}; bool gTinyFontAntiAliased = false; /** diff --git a/src/openrct2/drawing/Image.cpp b/src/openrct2/drawing/Image.cpp index d33993f6f7..42be5e0919 100644 --- a/src/openrct2/drawing/Image.cpp +++ b/src/openrct2/drawing/Image.cpp @@ -238,7 +238,7 @@ void gfx_object_free_images(uint32 baseImageId, uint32 count) for (uint32 i = 0; i < count; i++) { uint32 imageId = baseImageId + i; - rct_g1_element g1 = { nullptr }; + rct_g1_element g1 = {}; gfx_set_g1_element(imageId, &g1); drawing_engine_invalidate_image(imageId); } diff --git a/src/openrct2/drawing/LightFX.cpp b/src/openrct2/drawing/LightFX.cpp index 096df96055..c84eefca26 100644 --- a/src/openrct2/drawing/LightFX.cpp +++ b/src/openrct2/drawing/LightFX.cpp @@ -277,7 +277,7 @@ void lightfx_prepare_light_list() } for (sint32 pat = startSamplePoint; pat < totalSamplePoints; pat++) { - LocationXY16 mapCoord = { 0 }; + LocationXY16 mapCoord = {}; rct_tile_element *tileElement = nullptr; diff --git a/src/openrct2/drawing/TTF.cpp b/src/openrct2/drawing/TTF.cpp index 1b6d54c86e..dbafee5c8c 100644 --- a/src/openrct2/drawing/TTF.cpp +++ b/src/openrct2/drawing/TTF.cpp @@ -47,12 +47,12 @@ struct ttf_getwidth_cache_entry uint32 lastUseTick; }; -static ttf_cache_entry _ttfSurfaceCache[TTF_SURFACE_CACHE_SIZE] = { nullptr }; +static ttf_cache_entry _ttfSurfaceCache[TTF_SURFACE_CACHE_SIZE] = {}; static sint32 _ttfSurfaceCacheCount = 0; static sint32 _ttfSurfaceCacheHitCount = 0; static sint32 _ttfSurfaceCacheMissCount = 0; -static ttf_getwidth_cache_entry _ttfGetWidthCache[TTF_GETWIDTH_CACHE_SIZE] = { 0 }; +static ttf_getwidth_cache_entry _ttfGetWidthCache[TTF_GETWIDTH_CACHE_SIZE] = {}; static sint32 _ttfGetWidthCacheCount = 0; static sint32 _ttfGetWidthCacheHitCount = 0; static sint32 _ttfGetWidthCacheMissCount = 0; diff --git a/src/openrct2/drawing/X8DrawingEngine.h b/src/openrct2/drawing/X8DrawingEngine.h index 92802531ca..e6c9829457 100644 --- a/src/openrct2/drawing/X8DrawingEngine.h +++ b/src/openrct2/drawing/X8DrawingEngine.h @@ -79,9 +79,9 @@ namespace OpenRCT2 size_t _bitsSize = 0; uint8 * _bits = nullptr; - DirtyGrid _dirtyGrid = { 0 }; + DirtyGrid _dirtyGrid = {}; - rct_drawpixelinfo _bitsDPI = { 0 }; + rct_drawpixelinfo _bitsDPI = {}; #ifdef __ENABLE_LIGHTFX__ bool _lastLightFXenabled = false; diff --git a/src/openrct2/interface/Colour.cpp b/src/openrct2/interface/Colour.cpp index 743bc3c89a..b1227951b7 100644 --- a/src/openrct2/interface/Colour.cpp +++ b/src/openrct2/interface/Colour.cpp @@ -20,7 +20,7 @@ #include "../sprites.h" #include "Colour.h" -rct_colour_map ColourMapA[COLOUR_COUNT] = { 0 }; +rct_colour_map ColourMapA[COLOUR_COUNT] = {}; enum { diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index b03abc477a..2d1c5e2df4 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -464,7 +464,7 @@ static sint32 cc_get(InteractiveConsole &console, const utf8 **argv, sint32 argc if (w != nullptr) { sint32 interactionType; rct_tile_element *tileElement; - LocationXY16 mapCoord = { 0 }; + LocationXY16 mapCoord = {}; rct_viewport * viewport = window_get_viewport(w); get_map_coordinates_from_pos(viewport->view_width / 2, viewport->view_height / 2, VIEWPORT_INTERACTION_MASK_TERRAIN, &mapCoord.x, &mapCoord.y, &interactionType, &tileElement, nullptr); mapCoord.x -= 16; diff --git a/src/openrct2/interface/Viewport.cpp b/src/openrct2/interface/Viewport.cpp index 44888ce7e5..c5ebc5e151 100644 --- a/src/openrct2/interface/Viewport.cpp +++ b/src/openrct2/interface/Viewport.cpp @@ -670,7 +670,7 @@ void viewport_update_smart_guest_follow(rct_window * window, rct_peep * peep) { sprite_focus sprite; coordinate_focus coordinate; - } focus = { 0 }; // The focus will be either a sprite or a coordinate. + } focus = {}; // The focus will be either a sprite or a coordinate. focus.sprite.sprite_id = window->viewport_smart_follow_sprite; @@ -730,7 +730,7 @@ void viewport_update_smart_guest_follow(rct_window * window, rct_peep * peep) void viewport_update_smart_staff_follow(rct_window * window, rct_peep * peep) { - sprite_focus focus = { 0 }; + sprite_focus focus = {}; focus.sprite_id = window->viewport_smart_follow_sprite; @@ -753,7 +753,7 @@ void viewport_update_smart_staff_follow(rct_window * window, rct_peep * peep) void viewport_update_smart_vehicle_follow(rct_window * window) { // Can be expanded in the future if needed - sprite_focus focus = { 0 }; + sprite_focus focus = {}; focus.sprite_id = window->viewport_smart_follow_sprite; @@ -970,7 +970,7 @@ LocationXY16 screen_coord_to_viewport_coord(rct_viewport *viewport, uint16 x, ui LocationXY16 viewport_coord_to_map_coord(sint32 x, sint32 y, sint32 z) { - LocationXY16 ret = { 0 }; + LocationXY16 ret = {}; switch (get_current_rotation()) { case 0: ret.x = -x / 2 + y + z; diff --git a/src/openrct2/interface/ViewportInteraction.cpp b/src/openrct2/interface/ViewportInteraction.cpp index bec4f8ce53..cf09849bcf 100644 --- a/src/openrct2/interface/ViewportInteraction.cpp +++ b/src/openrct2/interface/ViewportInteraction.cpp @@ -64,7 +64,7 @@ sint32 viewport_interaction_get_item_left(sint32 x, sint32 y, viewport_interacti if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) return info->type = VIEWPORT_INTERACTION_ITEM_NONE; - LocationXY16 mapCoord = { 0 }; + LocationXY16 mapCoord = {}; get_map_coordinates_from_pos(x, y, VIEWPORT_INTERACTION_MASK_SPRITE & VIEWPORT_INTERACTION_MASK_RIDE & VIEWPORT_INTERACTION_MASK_PARK, &mapCoord.x, &mapCoord.y, &info->type, &info->tileElement, nullptr); info->x = mapCoord.x; info->y = mapCoord.y; @@ -197,7 +197,7 @@ sint32 viewport_interaction_get_item_right(sint32 x, sint32 y, viewport_interact if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) return info->type = VIEWPORT_INTERACTION_ITEM_NONE; - LocationXY16 mapCoord = { 0 }; + LocationXY16 mapCoord = {}; get_map_coordinates_from_pos(x, y, ~(VIEWPORT_INTERACTION_MASK_TERRAIN & VIEWPORT_INTERACTION_MASK_WATER), &mapCoord.x, &mapCoord.y, &info->type, &info->tileElement, nullptr); info->x = mapCoord.x; info->y = mapCoord.y; diff --git a/src/openrct2/network/Http.cpp b/src/openrct2/network/Http.cpp index d250113aaa..b58c14f071 100644 --- a/src/openrct2/network/Http.cpp +++ b/src/openrct2/network/Http.cpp @@ -155,7 +155,7 @@ static http_response_t *http_request(const HttpRequest2 &request) CURL *curl; CURLcode curlResult; http_response_t *response; - read_buffer readBuffer = { nullptr }; + read_buffer readBuffer = {}; write_buffer writeBuffer; curl = curl_easy_init(); diff --git a/src/openrct2/network/NetworkPlayer.h b/src/openrct2/network/NetworkPlayer.h index 484e985bd6..3b93fccaec 100644 --- a/src/openrct2/network/NetworkPlayer.h +++ b/src/openrct2/network/NetworkPlayer.h @@ -37,7 +37,7 @@ public: uint32 CommandsRan = 0; sint32 LastAction = -999; uint32 LastActionTime = 0; - LocationXYZ16 LastActionCoord = { 0 }; + LocationXYZ16 LastActionCoord = {}; rct_peep* PickupPeep = nullptr; sint32 PickupPeepOldX = LOCATION_NULL; std::string KeyHash; diff --git a/src/openrct2/network/TcpSocket.cpp b/src/openrct2/network/TcpSocket.cpp index 32e7a75eb1..e3ef23b792 100644 --- a/src/openrct2/network/TcpSocket.cpp +++ b/src/openrct2/network/TcpSocket.cpp @@ -442,7 +442,7 @@ private: { std::string serviceName = std::to_string(port); - addrinfo hints = { 0 }; + addrinfo hints = {}; hints.ai_family = AF_UNSPEC; if (address == nullptr) { diff --git a/src/openrct2/network/Twitch.cpp b/src/openrct2/network/Twitch.cpp index 05a8ad1b78..c53cb26f8a 100644 --- a/src/openrct2/network/Twitch.cpp +++ b/src/openrct2/network/Twitch.cpp @@ -78,7 +78,7 @@ namespace Twitch static AudienceMember FromJson(json_t * json) { - AudienceMember member = { nullptr }; + AudienceMember member = {}; if (!json_is_object(json)) return member; json_t * name = json_object_get(json, "name"); diff --git a/src/openrct2/object/BannerObject.h b/src/openrct2/object/BannerObject.h index 0f1148e753..b66b87c54c 100644 --- a/src/openrct2/object/BannerObject.h +++ b/src/openrct2/object/BannerObject.h @@ -23,7 +23,7 @@ class BannerObject final : public SceneryObject { private: - rct_scenery_entry _legacyType = { 0 }; + rct_scenery_entry _legacyType = {}; public: explicit BannerObject(const rct_object_entry &entry) : SceneryObject(entry) { } diff --git a/src/openrct2/object/EntranceObject.h b/src/openrct2/object/EntranceObject.h index 6d6c0b65cb..8c66665a91 100644 --- a/src/openrct2/object/EntranceObject.h +++ b/src/openrct2/object/EntranceObject.h @@ -23,7 +23,7 @@ class EntranceObject final : public Object { private: - rct_entrance_type _legacyType = { 0 }; + rct_entrance_type _legacyType = {}; public: explicit EntranceObject(const rct_object_entry &entry) : Object(entry) { } diff --git a/src/openrct2/object/FootpathItemObject.h b/src/openrct2/object/FootpathItemObject.h index d2099b569d..4878a2551c 100644 --- a/src/openrct2/object/FootpathItemObject.h +++ b/src/openrct2/object/FootpathItemObject.h @@ -23,7 +23,7 @@ class FootpathItemObject final : public SceneryObject { private: - rct_scenery_entry _legacyType = { 0 }; + rct_scenery_entry _legacyType = {}; public: explicit FootpathItemObject(const rct_object_entry &entry) : SceneryObject(entry) { } diff --git a/src/openrct2/object/FootpathObject.h b/src/openrct2/object/FootpathObject.h index 8d4cbecf00..e0d3b14af8 100644 --- a/src/openrct2/object/FootpathObject.h +++ b/src/openrct2/object/FootpathObject.h @@ -23,7 +23,7 @@ class FootpathObject final : public Object { private: - rct_footpath_entry _legacyType = { 0 }; + rct_footpath_entry _legacyType = {}; public: explicit FootpathObject(const rct_object_entry &entry) : Object(entry) { } diff --git a/src/openrct2/object/LargeSceneryObject.cpp b/src/openrct2/object/LargeSceneryObject.cpp index d1cf4c79fd..9513d500cb 100644 --- a/src/openrct2/object/LargeSceneryObject.cpp +++ b/src/openrct2/object/LargeSceneryObject.cpp @@ -174,7 +174,7 @@ std::vector LargeSceneryObject::ReadJsonTiles(const json const json_t * jTile; json_array_foreach(jTiles, index, jTile) { - rct_large_scenery_tile tile = { 0 }; + rct_large_scenery_tile tile = {}; tile.x_offset = json_integer_value(json_object_get(jTile, "x")); tile.y_offset = json_integer_value(json_object_get(jTile, "y")); tile.z_offset = json_integer_value(json_object_get(jTile, "z")); @@ -246,7 +246,7 @@ std::vector LargeSceneryObject::ReadJsonOffsets(const json_t * jOf const json_t * jOffset; json_array_foreach(jOffsets, index, jOffset) { - LocationXY16 offset = { 0 }; + LocationXY16 offset = {}; offset.x = json_integer_value(json_object_get(jOffset, "x")); offset.y = json_integer_value(json_object_get(jOffset, "y")); offsets.push_back(offset); diff --git a/src/openrct2/object/LargeSceneryObject.h b/src/openrct2/object/LargeSceneryObject.h index 4a7af55aad..866972e065 100644 --- a/src/openrct2/object/LargeSceneryObject.h +++ b/src/openrct2/object/LargeSceneryObject.h @@ -25,7 +25,7 @@ class LargeSceneryObject final : public SceneryObject { private: - rct_scenery_entry _legacyType = { 0 }; + rct_scenery_entry _legacyType = {}; uint32 _baseImageId = 0; std::vector _tiles; std::unique_ptr _3dFont; diff --git a/src/openrct2/object/Object.cpp b/src/openrct2/object/Object.cpp index d5a664a491..3c122b57c1 100644 --- a/src/openrct2/object/Object.cpp +++ b/src/openrct2/object/Object.cpp @@ -93,7 +93,7 @@ rct_object_entry Object::GetScgPathXHeader() rct_object_entry Object::CreateHeader(const char name[DAT_NAME_LENGTH + 1], uint32 flags, uint32 checksum) { - rct_object_entry header = { 0 }; + rct_object_entry header = {}; header.flags = flags; std::copy_n(name, DAT_NAME_LENGTH, header.name); header.checksum = checksum; diff --git a/src/openrct2/object/ObjectFactory.cpp b/src/openrct2/object/ObjectFactory.cpp index e8a01a99e9..e3413fd022 100644 --- a/src/openrct2/object/ObjectFactory.cpp +++ b/src/openrct2/object/ObjectFactory.cpp @@ -357,7 +357,7 @@ namespace ObjectFactory { auto id = json_string_value(json_object_get(jRoot, "id")); - rct_object_entry entry = { 0 }; + rct_object_entry entry = {}; auto originalId = String::ToStd(json_string_value(json_object_get(jRoot, "originalId"))); auto originalName = originalId; if (originalId.length() == 8 + 1 + 8 + 1 + 8) diff --git a/src/openrct2/object/ObjectJsonHelpers.cpp b/src/openrct2/object/ObjectJsonHelpers.cpp index 05c1867732..18485bc151 100644 --- a/src/openrct2/object/ObjectJsonHelpers.cpp +++ b/src/openrct2/object/ObjectJsonHelpers.cpp @@ -167,7 +167,7 @@ namespace ObjectJsonHelpers rct_object_entry ParseObjectEntry(const std::string & s) { - rct_object_entry entry = { 0 }; + rct_object_entry entry = {}; std::fill_n(entry.name, sizeof(entry.name), ' '); auto copyLen = std::min(8, s.size()); std::copy_n(s.c_str(), copyLen, entry.name); @@ -284,7 +284,7 @@ namespace ObjectJsonHelpers std::vector result; if (s.empty()) { - rct_g1_element emptyg1 = { 0 }; + rct_g1_element emptyg1 = {}; result.push_back(emptyg1); } else if (String::StartsWith(s, "$CSG")) @@ -359,7 +359,7 @@ namespace ObjectJsonHelpers auto msg = String::StdFormat("Unable to load image '%s': %s", s.c_str(), e.what()); context->LogWarning(OBJECT_ERROR_BAD_IMAGE_TABLE, msg.c_str()); - rct_g1_element emptyg1 = { 0 }; + rct_g1_element emptyg1 = {}; result.push_back(emptyg1); } } @@ -396,7 +396,7 @@ namespace ObjectJsonHelpers auto msg = String::StdFormat("Unable to load image '%s': %s", path.c_str(), e.what()); context->LogWarning(OBJECT_ERROR_BAD_IMAGE_TABLE, msg.c_str()); - rct_g1_element emptyg1 = { 0 }; + rct_g1_element emptyg1 = {}; result.push_back(emptyg1); } return result; diff --git a/src/openrct2/object/ObjectManager.cpp b/src/openrct2/object/ObjectManager.cpp index 630800bfed..88f298ce31 100644 --- a/src/openrct2/object/ObjectManager.cpp +++ b/src/openrct2/object/ObjectManager.cpp @@ -433,7 +433,7 @@ private: const ObjectRepositoryItem * ori = nullptr; if (object_entry_is_empty(&entry)) { - entry = { 0 }; + entry = {}; continue; } @@ -448,7 +448,7 @@ private: else { log_info("Ignoring missing STEX entry."); - entry = { 0 }; + entry = {}; continue; } } diff --git a/src/openrct2/object/ObjectRepository.cpp b/src/openrct2/object/ObjectRepository.cpp index 3146badc25..9892d6023d 100644 --- a/src/openrct2/object/ObjectRepository.cpp +++ b/src/openrct2/object/ObjectRepository.cpp @@ -117,7 +117,7 @@ public: } if (object != nullptr) { - ObjectRepositoryItem item = { 0 }; + ObjectRepositoryItem item = {}; item.ObjectEntry = *object->GetObjectEntry(); item.Path = path; item.Name = object->GetName(); @@ -248,7 +248,7 @@ public: const ObjectRepositoryItem * FindObject(const utf8 * name) const override { - rct_object_entry entry = { 0 }; + rct_object_entry entry = {}; utf8 entryName[9] = { ' ' }; String::Set(entryName, sizeof(entryName), name); std::copy_n(entryName, 8, entry.name); diff --git a/src/openrct2/object/RideObject.cpp b/src/openrct2/object/RideObject.cpp index 3def718bde..19cb74db54 100644 --- a/src/openrct2/object/RideObject.cpp +++ b/src/openrct2/object/RideObject.cpp @@ -726,7 +726,7 @@ std::vector RideObject::ReadJsonCars(const json_t * jCar rct_ride_entry_vehicle RideObject::ReadJsonCar(const json_t * jCar) { - rct_ride_entry_vehicle car = { 0 }; + rct_ride_entry_vehicle car = {}; car.rotation_frame_mask = ObjectJsonHelpers::GetInteger(jCar, "rotationFrameMask"); car.spacing = ObjectJsonHelpers::GetInteger(jCar, "spacing"); car.car_mass = ObjectJsonHelpers::GetInteger(jCar, "mass"); @@ -869,7 +869,7 @@ vehicle_colour_preset_list RideObject::ReadJsonCarColours(const json_t * jCarCol { // Read all colours from first config auto config = ReadJsonColourConfiguration(firstElement); - vehicle_colour_preset_list list = { 0 }; + vehicle_colour_preset_list list = {}; list.count = 255; std::copy_n(config.data(), std::min(numColours, 32), list.list); return list; @@ -877,7 +877,7 @@ vehicle_colour_preset_list RideObject::ReadJsonCarColours(const json_t * jCarCol } // Read first colour for each config - vehicle_colour_preset_list list = { 0 }; + vehicle_colour_preset_list list = {}; size_t index; const json_t * jConfiguration; json_array_foreach(jCarColours, index, jConfiguration) @@ -905,7 +905,7 @@ std::vector RideObject::ReadJsonColourConfiguration(const json_t const json_t * jColours; json_array_foreach(jColourConfig, index, jColours) { - vehicle_colour carColour = { 0 }; + vehicle_colour carColour = {}; auto colours = ObjectJsonHelpers::GetJsonStringArray(jColours); if (colours.size() >= 1) { diff --git a/src/openrct2/object/RideObject.h b/src/openrct2/object/RideObject.h index 014beb4316..90c37a86a4 100644 --- a/src/openrct2/object/RideObject.h +++ b/src/openrct2/object/RideObject.h @@ -23,8 +23,8 @@ class RideObject final : public Object { private: - rct_ride_entry _legacyType = { }; - vehicle_colour_preset_list _presetColours = { 0 }; + rct_ride_entry _legacyType = {}; + vehicle_colour_preset_list _presetColours = {}; std::vector _peepLoadingPositions[MAX_VEHICLES_PER_RIDE_ENTRY]; std::vector > _peepLoadingWaypoints[MAX_VEHICLES_PER_RIDE_ENTRY]; diff --git a/src/openrct2/object/SceneryGroupObject.h b/src/openrct2/object/SceneryGroupObject.h index 6c6cb47f75..d72f510d63 100644 --- a/src/openrct2/object/SceneryGroupObject.h +++ b/src/openrct2/object/SceneryGroupObject.h @@ -25,7 +25,7 @@ struct ObjectRepositoryItem; class SceneryGroupObject final : public Object { private: - rct_scenery_group_entry _legacyType = { 0 }; + rct_scenery_group_entry _legacyType = {}; std::vector _items; public: diff --git a/src/openrct2/object/SmallSceneryObject.h b/src/openrct2/object/SmallSceneryObject.h index 15043e6e9c..9b390080e5 100644 --- a/src/openrct2/object/SmallSceneryObject.h +++ b/src/openrct2/object/SmallSceneryObject.h @@ -23,7 +23,7 @@ class SmallSceneryObject final : public SceneryObject { private: - rct_scenery_entry _legacyType = { 0 }; + rct_scenery_entry _legacyType = {}; std::vector _frameOffsets; public: diff --git a/src/openrct2/object/StexObject.h b/src/openrct2/object/StexObject.h index bcd752d25d..8a83f7d934 100644 --- a/src/openrct2/object/StexObject.h +++ b/src/openrct2/object/StexObject.h @@ -23,7 +23,7 @@ class StexObject final : public Object { private: - rct_stex_entry _legacyType = { 0 }; + rct_stex_entry _legacyType = {}; public: explicit StexObject(const rct_object_entry &entry) : Object(entry) { } diff --git a/src/openrct2/object/WallObject.h b/src/openrct2/object/WallObject.h index 388685f905..902fc2aa8e 100644 --- a/src/openrct2/object/WallObject.h +++ b/src/openrct2/object/WallObject.h @@ -23,7 +23,7 @@ class WallObject final : public SceneryObject { private: - rct_scenery_entry _legacyType = { 0 }; + rct_scenery_entry _legacyType = {}; public: explicit WallObject(const rct_object_entry &entry) : SceneryObject(entry) { } diff --git a/src/openrct2/object/WaterObject.cpp b/src/openrct2/object/WaterObject.cpp index 2edcc3c338..4bd45bac33 100644 --- a/src/openrct2/object/WaterObject.cpp +++ b/src/openrct2/object/WaterObject.cpp @@ -117,7 +117,7 @@ void WaterObject::ReadJsonPalette(const json_t * jPalette) dataIndex += 3; } - rct_g1_element g1 = { 0 }; + rct_g1_element g1 = {}; g1.offset = data.get(); g1.width = (sint16)numColours; g1.x_offset = (sint16)paletteStartIndex; diff --git a/src/openrct2/object/WaterObject.h b/src/openrct2/object/WaterObject.h index 7b30929d26..532150b100 100644 --- a/src/openrct2/object/WaterObject.h +++ b/src/openrct2/object/WaterObject.h @@ -23,7 +23,7 @@ class WaterObject final : public Object { private: - rct_water_type _legacyType = { 0 }; + rct_water_type _legacyType = {}; public: explicit WaterObject(const rct_object_entry &entry) : Object(entry) { } diff --git a/src/openrct2/paint/Paint.cpp b/src/openrct2/paint/Paint.cpp index 34391793ad..7c892f7747 100644 --- a/src/openrct2/paint/Paint.cpp +++ b/src/openrct2/paint/Paint.cpp @@ -448,7 +448,7 @@ paint_struct * paint_arrange_structs_helper(paint_struct * ps_next, uint16 quadr */ paint_struct paint_session_arrange(paint_session * session) { - paint_struct psHead = { 0 }; + paint_struct psHead = {}; paint_struct * ps = &psHead; ps->next_quadrant_ps = nullptr; uint32 quadrantIndex = session->QuadrantBackIndex; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 91fd4b8259..718da26fb5 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -110,7 +110,7 @@ class S4Importer final : public IParkImporter { private: std::string _s4Path; - rct1_s4 _s4 = { 0 }; + rct1_s4 _s4 = {}; uint8 _gameVersion = 0; uint8 _parkValueConversionFactor = 0; @@ -220,7 +220,7 @@ public: bool GetDetails(scenario_index_entry * dst) override { - *dst = { 0 }; + *dst = {}; source_desc desc; // If no entry is found, this is a custom scenario. diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 2af25a6249..92835bcd01 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -454,7 +454,7 @@ void S6Exporter::ExportRides() { auto src = get_ride(index); auto dst = &_s6.rides[index]; - *dst = { 0 }; + *dst = {}; if (src->type == RIDE_TYPE_NULL) { dst->type = RIDE_TYPE_NULL; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index c07e465b64..0fa70ffcd0 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -180,7 +180,7 @@ public: bool GetDetails(scenario_index_entry * dst) override { - *dst = { 0 }; + *dst = {}; return false; } @@ -474,7 +474,7 @@ public: { auto src = &_s6.rides[index]; auto dst = get_ride(index); - *dst = { 0 }; + *dst = {}; if (src->type == RIDE_TYPE_NULL) { dst->type = RIDE_TYPE_NULL; diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 685df1cdea..b584d4cc32 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -796,25 +796,21 @@ bool track_block_get_previous(sint32 x, sint32 y, rct_tile_element *tileElement, */ sint32 ride_find_track_gap(CoordsXYE *input, CoordsXYE *output) { - rct_window *w; - Ride *ride; - track_circuit_iterator it = { 0 }, slowIt; - sint32 rideIndex; - assert(input->element->GetType() == TILE_ELEMENT_TYPE_TRACK); - rideIndex = track_element_get_ride_index(input->element); - ride = get_ride(rideIndex); + sint32 rideIndex = track_element_get_ride_index(input->element); + Ride* ride = get_ride(rideIndex); if (ride->type == RIDE_TYPE_MAZE) return 0; - w = window_find_by_class(WC_RIDE_CONSTRUCTION); + rct_window* w = window_find_by_class(WC_RIDE_CONSTRUCTION); if (w != nullptr && _rideConstructionState != RIDE_CONSTRUCTION_STATE_0 && _currentRideIndex == rideIndex) ride_construction_invalidate_current_track(); bool moveSlowIt = true; + track_circuit_iterator it = {}; track_circuit_iterator_begin(&it, *input); - slowIt = it; + track_circuit_iterator slowIt = it; while (track_circuit_iterator_next(&it)) { if (!track_is_connected_by_shape(it.last.element, it.current.element)) { *output = it.current; @@ -4713,7 +4709,8 @@ static train_ref vehicle_create_train(sint32 rideIndex, sint32 x, sint32 y, sint static void vehicle_create_trains(sint32 rideIndex, sint32 x, sint32 y, sint32 z, rct_tile_element *tileElement) { Ride *ride = get_ride(rideIndex); - train_ref firstTrain = { nullptr }, lastTrain = { nullptr }; + train_ref firstTrain = {}; + train_ref lastTrain = {}; sint32 remainingDistance = 0; for (sint32 vehicleIndex = 0; vehicleIndex < ride->num_vehicles; vehicleIndex++) { @@ -5228,7 +5225,7 @@ sint32 ride_is_valid_for_test(sint32 rideIndex, sint32 goingToBeOpen, sint32 isA { sint32 stationIndex; Ride *ride; - CoordsXYE trackElement, problematicTrackElement = { 0 }; + CoordsXYE trackElement, problematicTrackElement = {}; ride = get_ride(rideIndex); if (ride->type == RIDE_TYPE_NULL) @@ -5357,7 +5354,7 @@ sint32 ride_is_valid_for_open(sint32 rideIndex, sint32 goingToBeOpen, sint32 isA { sint32 stationIndex; Ride *ride; - CoordsXYE trackElement, problematicTrackElement = { 0 }; + CoordsXYE trackElement, problematicTrackElement = {}; ride = get_ride(rideIndex); @@ -6905,7 +6902,7 @@ static void ride_update_vehicle_colours(sint32 rideIndex) for (sint32 i = 0; i < MAX_VEHICLES_PER_RIDE; i++) { sint32 carIndex = 0; uint16 spriteIndex = ride->vehicles[i]; - rct_vehicle_colour colours = { 0 }; + rct_vehicle_colour colours = {}; uint8 coloursExtended = 0; while (spriteIndex != SPRITE_INDEX_NULL) { diff --git a/src/openrct2/ride/TrackDesignSave.cpp b/src/openrct2/ride/TrackDesignSave.cpp index 83fdc044a8..42a4b01c8c 100644 --- a/src/openrct2/ride/TrackDesignSave.cpp +++ b/src/openrct2/ride/TrackDesignSave.cpp @@ -1186,7 +1186,7 @@ bool track_design_save_to_file(const utf8 *path) window_close_construction_windows(); // Create TD6 data buffer - auto_buffer td6Buffer = { 0 }; + auto_buffer td6Buffer = {}; auto_buffer_write(&td6Buffer, td6, 0xA3); if (td6->type == RIDE_TYPE_MAZE) { auto_buffer_write(&td6Buffer, td6->maze_elements, track_design_get_maze_elements_count(td6) * sizeof(rct_td6_maze_element)); diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 3dc1d3c7ff..4728378c05 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -817,7 +817,7 @@ const rct_vehicle_info * vehicle_get_move_info(sint32 cd, sint32 typeAndDirectio { if (!vehicle_move_info_valid(cd, typeAndDirection, offset)) { - static constexpr const rct_vehicle_info zero = { 0 }; + static constexpr const rct_vehicle_info zero = {}; return &zero; } return &gTrackVehicleInfo[cd][typeAndDirection]->info[offset]; @@ -2743,7 +2743,7 @@ assert_struct_size(rct_synchronised_vehicle, 4); #define SYNCHRONISED_VEHICLE_COUNT 16 // Synchronised vehicle info -static rct_synchronised_vehicle _synchronisedVehicles[SYNCHRONISED_VEHICLE_COUNT] = { 0 }; +static rct_synchronised_vehicle _synchronisedVehicles[SYNCHRONISED_VEHICLE_COUNT] = {}; static rct_synchronised_vehicle * _lastSynchronisedVehicle = nullptr; @@ -7981,7 +7981,7 @@ static void sub_6DBF3E(rct_vehicle * vehicle) static bool vehicle_update_track_motion_forwards_get_new_track(rct_vehicle * vehicle, uint16 trackType, Ride * ride, rct_ride_entry * rideEntry) { - registers regs = { 0 }; + registers regs = {}; _vehicleVAngleEndF64E36 = TrackDefinitions[trackType].vangle_end; _vehicleBankEndF64E37 = TrackDefinitions[trackType].bank_end; @@ -8178,7 +8178,7 @@ loc_6DB41D: static bool vehicle_update_track_motion_forwards(rct_vehicle * vehicle, rct_ride_entry_vehicle * vehicleEntry, Ride * ride, rct_ride_entry * rideEntry) { - registers regs = { 0 }; + registers regs = {}; loc_6DAEB9: regs.edi = vehicle->track_type; regs.cx = vehicle->track_type >> 2; @@ -8584,7 +8584,7 @@ static bool vehicle_update_track_motion_backwards_get_new_track(rct_vehicle * ve static bool vehicle_update_track_motion_backwards(rct_vehicle * vehicle, rct_ride_entry_vehicle * vehicleEntry, Ride * ride, rct_ride_entry * rideEntry) { - registers regs = { 0 }; + registers regs = {}; loc_6DBA33:; uint16 trackType = vehicle->track_type >> 2; @@ -8741,7 +8741,7 @@ loc_6DBE7F: */ static sint32 vehicle_update_track_motion_mini_golf(rct_vehicle * vehicle, sint32 * outStation) { - registers regs = { 0 }; + registers regs = {}; Ride * ride = get_ride(vehicle->ride); rct_ride_entry * rideEntry = get_ride_entry(vehicle->ride_subtype); @@ -9604,7 +9604,7 @@ static void vehicle_update_track_motion_powered_ride_acceleration(rct_vehicle * */ sint32 vehicle_update_track_motion(rct_vehicle * vehicle, sint32 * outStation) { - registers regs = { 0 }; + registers regs = {}; Ride * ride = get_ride(vehicle->ride); rct_ride_entry * rideEntry = get_ride_entry(vehicle->ride_subtype); diff --git a/src/openrct2/scenario/ScenarioRepository.cpp b/src/openrct2/scenario/ScenarioRepository.cpp index 49eae21046..cc206735c6 100644 --- a/src/openrct2/scenario/ScenarioRepository.cpp +++ b/src/openrct2/scenario/ScenarioRepository.cpp @@ -264,7 +264,7 @@ private: static scenario_index_entry CreateNewScenarioEntry(const std::string &path, uint64 timestamp, rct_s6_info * s6Info) { - scenario_index_entry entry = { 0 }; + scenario_index_entry entry = {}; // Set new entry String::Set(entry.path, sizeof(entry.path), path.c_str()); diff --git a/src/openrct2/title/TitleSequence.cpp b/src/openrct2/title/TitleSequence.cpp index df8f54d23a..594ca162d2 100644 --- a/src/openrct2/title/TitleSequence.cpp +++ b/src/openrct2/title/TitleSequence.cpp @@ -46,7 +46,7 @@ static std::string LegacyScriptWrite(TitleSequence * seq); TitleSequence * CreateTitleSequence() { TitleSequence * seq = Memory::Allocate(); - *seq = { 0 }; + *seq = {}; return seq; } @@ -400,7 +400,7 @@ static std::vector LegacyScriptRead(utf8 * script, size_t scriptLe token = &parts[0 * 128]; part1 = &parts[1 * 128]; part2 = &parts[2 * 128]; - TitleCommand command = { 0 }; + TitleCommand command = {}; command.Type = TITLE_SCRIPT_UNDEFINED; if (token[0] != 0) diff --git a/src/openrct2/title/TitleSequencePlayer.cpp b/src/openrct2/title/TitleSequencePlayer.cpp index 83cfb0205b..c01123789b 100644 --- a/src/openrct2/title/TitleSequencePlayer.cpp +++ b/src/openrct2/title/TitleSequencePlayer.cpp @@ -60,7 +60,7 @@ private: sint32 _lastScreenWidth = 0; sint32 _lastScreenHeight = 0; - CoordsXY _viewCentreLocation = { 0 }; + CoordsXY _viewCentreLocation = {}; public: explicit TitleSequencePlayer(IScenarioRepository& scenarioRepository, GameState& gameState) diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index a764942bb5..2a690fa4eb 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -874,7 +874,7 @@ void footpath_get_coordinates_from_pos(sint32 screenX, sint32 screenY, sint32 *x sint32 z = 0, interactionType; rct_tile_element *myTileElement; rct_viewport *viewport; - LocationXY16 position = { 0 }; + LocationXY16 position = {}; get_map_coordinates_from_pos(screenX, screenY, VIEWPORT_INTERACTION_MASK_FOOTPATH, &position.x, &position.y, &interactionType, &myTileElement, &viewport); if (interactionType != VIEWPORT_INTERACTION_ITEM_FOOTPATH || !(viewport->flags & (VIEWPORT_FLAG_UNDERGROUND_INSIDE | VIEWPORT_FLAG_HIDE_BASE | VIEWPORT_FLAG_HIDE_VERTICAL))) { @@ -948,7 +948,7 @@ void footpath_bridge_get_info_from_pos(sint32 screenX, sint32 screenY, sint32 *x sint32 interactionType; rct_viewport *viewport; - LocationXY16 map_pos = { 0 }; + LocationXY16 map_pos = {}; get_map_coordinates_from_pos(screenX, screenY, VIEWPORT_INTERACTION_MASK_RIDE, &map_pos.x, &map_pos.y, &interactionType, tileElement, &viewport); *x = map_pos.x; *y = map_pos.y; diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index f33ee53580..b896614461 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -4080,7 +4080,7 @@ static void translate_3d_to_2d(sint32 rotation, sint32 *x, sint32 *y) CoordsXY translate_3d_to_2d_with_z(sint32 rotation, CoordsXYZ pos) { - CoordsXY result = { 0 }; + CoordsXY result = {}; switch (rotation & 3) { default: case 0: