Changeset - r26725:fb7e6e5eedb4
[Not reviewed]
master
0 2 0
Rubidium - 22 months ago 2023-01-03 18:02:36
rubidium@openttd.org
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.
2 files changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/company_gui.cpp
Show inline comments
 
@@ -627,25 +627,25 @@ private:
 
	uint rows;
 
	uint line_height;
 
	GUIGroupList groups;
 
	std::vector<int> indents;
 
	Scrollbar *vscroll;
 

	
 
	void ShowColourDropDownMenu(uint32 widget)
 
	{
 
		uint32 used_colours = 0;
 
		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) {
 
			for (const Company *c : Company::Iterate()) {
 
				if (c->index != _local_company) SetBit(used_colours, c->colour);
 
			}
 
		}
 

	
 
		c = Company::Get((CompanyID)this->window_number);
 

	
 
		if (this->livery_class < LC_GROUP_RAIL) {
 
			/* Get the first selected livery to use as the default dropdown item */
src/script/api/script_rail.cpp
Show inline comments
 
@@ -440,25 +440,25 @@ static bool IsValidSignalType(int signal
 
	if (signal_type > ScriptRail::SIGNALTYPE_PBS_ONEWAY && signal_type < ScriptRail::SIGNALTYPE_NORMAL_TWOWAY) return false;
 
	return true;
 
}
 

	
 
/* static */ bool ScriptRail::BuildSignal(TileIndex tile, TileIndex front, SignalType signal)
 
{
 
	EnforcePrecondition(false, ScriptObject::GetCompany() != OWNER_DEITY);
 
	EnforcePrecondition(false, ScriptMap::DistanceManhattan(tile, front) == 1)
 
	EnforcePrecondition(false, ::IsPlainRailTile(tile));
 
	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++) {
 
		const Track &t = _possible_trackdirs[data_index][i].track;
 
		if (!(::TrackToTrackBits(t) & GetRailTracks(tile))) continue;
 
		track = t;
 
		signal_cycles = _possible_trackdirs[data_index][i].signal_cycles;
 
		break;
 
	}
 
	EnforcePrecondition(false, track != INVALID_TRACK);
 

	
 
	if (signal < SIGNALTYPE_TWOWAY) {
0 comments (0 inline, 0 general)