summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan G Rennison <j.g.rennison@gmail.com>2018-06-06 08:35:11 +0100
committerPeterN <peter@fuzzle.org>2018-06-06 11:02:50 +0100
commit0bd1022238613917b8f9ac42d0f021de56057af2 (patch)
treef0d4a1a38ab4c7257e885b8ad2dca7c3cdec6071
parent408cee123df526002b7d39949330f938d29fb349 (diff)
downloadopenttd-0bd1022238613917b8f9ac42d0f021de56057af2.tar.xz
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.
-rw-r--r--src/rail_gui.cpp2
1 files changed, 1 insertions, 1 deletions
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) ||