From 170f37d07fff493cf43be1557af9d654e6669142 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Tue, 3 Jan 2023 19:02:36 +0100 Subject: [PATCH] Codechange: silence some potentially uninitialized local variable errors In these cases technically they are false positives, however dismissing the alerts when the underlying code may make them true positives does not seem like the safest solution. --- src/company_gui.cpp | 2 +- src/script/api/script_rail.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 965d0c804b..3d8fe8896b 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -636,7 +636,7 @@ private: const Company *c; const Livery *livery, *default_livery = nullptr; bool primary = widget == WID_SCL_PRI_COL_DROPDOWN; - byte default_col; + byte default_col = 0; /* Disallow other company colours for the primary colour */ if (this->livery_class < LC_GROUP_RAIL && HasBit(this->sel, LS_DEFAULT) && primary) { diff --git a/src/script/api/script_rail.cpp b/src/script/api/script_rail.cpp index 39f14cd0be..76eda79f4d 100644 --- a/src/script/api/script_rail.cpp +++ b/src/script/api/script_rail.cpp @@ -449,7 +449,7 @@ static bool IsValidSignalType(int signal_type) EnforcePrecondition(false, ::IsValidSignalType(signal)); Track track = INVALID_TRACK; - uint signal_cycles; + uint signal_cycles = 0; int data_index = 2 + (::TileX(front) - ::TileX(tile)) + 2 * (::TileY(front) - ::TileY(tile)); for (int i = 0; i < NUM_TRACK_DIRECTIONS; i++) {