summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Pigott <charlespigott@googlemail.com>2019-06-29 20:09:50 +0100
committerCharles Pigott <charlespigott@googlemail.com>2019-09-30 14:00:06 +0100
commit73a2cee779857fe5762931306d896239f98c7c76 (patch)
treec23bc047dd395b33b78a8d9e2a0dab982088d0e4
parent71a3e83468e36613ffe53b4e1689d52062da7c80 (diff)
downloadopenttd-73a2cee779857fe5762931306d896239f98c7c76.tar.xz
Fix: Quiet a bogus -Wmaybe-unitialized warning from GCC9
-rw-r--r--src/vehicle_cmd.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp
index a1ea3590a..9a6e236d5 100644
--- a/src/vehicle_cmd.cpp
+++ b/src/vehicle_cmd.cpp
@@ -135,7 +135,7 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
/* Vehicle construction needs random bits, so we have to save the random
* seeds to prevent desyncs. */
SavedRandomSeeds saved_seeds;
- if (flags != subflags) SaveRandomSeeds(&saved_seeds);
+ SaveRandomSeeds(&saved_seeds);
Vehicle *v = nullptr;
switch (type) {
@@ -185,6 +185,7 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
}
}
+ /* Only restore if we actually did some refitting */
if (flags != subflags) RestoreRandomSeeds(saved_seeds);
return value;