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.
This commit is contained in:
Jonathan G Rennison 2018-06-06 08:35:11 +01:00 committed by PeterN
parent 408cee123d
commit 0bd1022238
1 changed files with 1 additions and 1 deletions

View File

@ -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) ||