mirror of https://github.com/OpenTTD/OpenTTD.git
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:
parent
408cee123d
commit
0bd1022238
|
@ -1908,7 +1908,7 @@ static void SetDefaultRailGui()
|
||||||
RailType rt = (RailType)(_settings_client.gui.default_rail_type + RAILTYPE_END);
|
RailType rt = (RailType)(_settings_client.gui.default_rail_type + RAILTYPE_END);
|
||||||
if (rt == DEF_RAILTYPE_MOST_USED) {
|
if (rt == DEF_RAILTYPE_MOST_USED) {
|
||||||
/* Find the most used rail type */
|
/* Find the most used rail type */
|
||||||
RailType count[RAILTYPE_END];
|
uint count[RAILTYPE_END];
|
||||||
memset(count, 0, sizeof(count));
|
memset(count, 0, sizeof(count));
|
||||||
for (TileIndex t = 0; t < MapSize(); t++) {
|
for (TileIndex t = 0; t < MapSize(); t++) {
|
||||||
if (IsTileType(t, MP_RAILWAY) || IsLevelCrossingTile(t) || HasStationTileRail(t) ||
|
if (IsTileType(t, MP_RAILWAY) || IsLevelCrossingTile(t) || HasStationTileRail(t) ||
|
||||||
|
|
Loading…
Reference in New Issue