From 9aef29361feef7d5abf8b58c652680ed2dd6d379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Sat, 20 Feb 2021 19:40:32 +0100 Subject: [PATCH] Default-initialise more fields (#14130) Doesn't really fix any particular issue, but adds more defaults to fields in classes where other defaults are already present --- src/openrct2-ui/scripting/CustomWindow.cpp | 2 +- src/openrct2-ui/windows/Cheats.cpp | 2 +- src/openrct2-ui/windows/GuestList.cpp | 4 ++-- src/openrct2-ui/windows/TextInput.cpp | 4 ++-- src/openrct2/object/StationObject.h | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/openrct2-ui/scripting/CustomWindow.cpp b/src/openrct2-ui/scripting/CustomWindow.cpp index 7848ba63df..cd0683ae7a 100644 --- a/src/openrct2-ui/scripting/CustomWindow.cpp +++ b/src/openrct2-ui/scripting/CustomWindow.cpp @@ -94,7 +94,7 @@ namespace OpenRCT2::Ui::Windows ImageId Image; std::string Text; TextAlignment TextAlign; - colour_t Colour; + colour_t Colour{}; std::string Tooltip; std::vector Items; std::vector ListViewItems; diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp index 10815a3abb..1ca1f4439c 100644 --- a/src/openrct2-ui/windows/Cheats.cpp +++ b/src/openrct2-ui/windows/Cheats.cpp @@ -449,7 +449,7 @@ private: char _moneySpinnerText[MONEY_STRING_MAXLENGTH]; money32 _moneySpinnerValue = CHEATS_MONEY_DEFAULT; int32_t _selectedStaffSpeed = 1; - int32_t _parkRatingSpinnerValue; + int32_t _parkRatingSpinnerValue{}; int32_t _yearSpinnerValue = 1; int32_t _monthSpinnerValue = 1; int32_t _daySpinnerValue = 1; diff --git a/src/openrct2-ui/windows/GuestList.cpp b/src/openrct2-ui/windows/GuestList.cpp index 1436ce958f..5e36426445 100644 --- a/src/openrct2-ui/windows/GuestList.cpp +++ b/src/openrct2-ui/windows/GuestList.cpp @@ -128,7 +128,7 @@ private: static constexpr size_t MaxGroups = 240; TabId _selectedTab{}; - GuestViewType _selectedView; + GuestViewType _selectedView{}; bool _trackingOnly{}; std::optional _selectedFilter; FilterArguments _filterArguments; @@ -137,7 +137,7 @@ private: size_t _numPages{}; size_t _selectedPage{}; - GuestViewType _lastFindGroupsSelectedView; + GuestViewType _lastFindGroupsSelectedView{}; uint32_t _lastFindGroupsTick{}; uint32_t _lastFindGroupsWait{}; std::vector _groups; diff --git a/src/openrct2-ui/windows/TextInput.cpp b/src/openrct2-ui/windows/TextInput.cpp index b42899e93a..9256978e84 100644 --- a/src/openrct2-ui/windows/TextInput.cpp +++ b/src/openrct2-ui/windows/TextInput.cpp @@ -40,7 +40,7 @@ static rct_widget window_text_input_widgets[] = { class TextInputWindow final : public Window { private: - widget_identifier _parentWidget; + widget_identifier _parentWidget{}; std::string _title; rct_string_id _titleStringId = STR_NONE; @@ -52,7 +52,7 @@ private: std::function _cancelCallback; int32_t _cursorBlink{}; - size_t _maxInputLength; + size_t _maxInputLength{}; std::string _buffer; public: diff --git a/src/openrct2/object/StationObject.h b/src/openrct2/object/StationObject.h index 66300dc11e..0912661414 100644 --- a/src/openrct2/object/StationObject.h +++ b/src/openrct2/object/StationObject.h @@ -24,9 +24,9 @@ public: rct_string_id NameStringId{}; uint32_t BaseImageId{}; uint32_t ShelterImageId{}; - uint32_t Flags; - int32_t Height; - uint8_t ScrollingMode; + uint32_t Flags{}; + int32_t Height{}; + uint8_t ScrollingMode{}; explicit StationObject(const rct_object_entry& entry) : Object(entry)