From 0bd1022238613917b8f9ac42d0f021de56057af2 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Wed, 6 Jun 2018 08:35:11 +0100 Subject: Codechange: Change element type used for rail type usage stats array in SetDefaultRailGui The array is rail type sized in terms of number of elements. Each element should be a unsigned integer, not a rail type itself. This fixes runtime warnings reported by UndefinedBehaviorSanitizer. --- src/rail_gui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 73fe29da0..de8d43474 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -1908,7 +1908,7 @@ static void SetDefaultRailGui() RailType rt = (RailType)(_settings_client.gui.default_rail_type + RAILTYPE_END); if (rt == DEF_RAILTYPE_MOST_USED) { /* Find the most used rail type */ - RailType count[RAILTYPE_END]; + uint count[RAILTYPE_END]; memset(count, 0, sizeof(count)); for (TileIndex t = 0; t < MapSize(); t++) { if (IsTileType(t, MP_RAILWAY) || IsLevelCrossingTile(t) || HasStationTileRail(t) || -- cgit v1.2.3-70-g09d2