diff options
author | frosch <frosch@openttd.org> | 2013-03-17 18:31:35 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2013-03-17 18:31:35 +0000 |
commit | cf4a2702f8d6094757c80e2bed39e94a0cba9cff (patch) | |
tree | 179e332aacaf79c7caad72aa9a3945350f86beaf /src | |
parent | 8ca173e365792b830d5fd090a011c827a0b4dcb3 (diff) | |
download | openttd-cf4a2702f8d6094757c80e2bed39e94a0cba9cff.tar.xz |
(svn r25099) -Fix [FS#5492]: Limit aircraft property 0D to 19, since the conversion result to km-ish/h needs to fit into a byte.
Diffstat (limited to 'src')
-rw-r--r-- | src/newgrf.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp index f56b99899..848903324 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -1618,9 +1618,15 @@ static ChangeInfoResult AircraftVehicleChangeInfo(uint engine, int numinfo, int avi->max_speed = (buf->ReadByte() * 128) / 10; break; - case 0x0D: // Acceleration - avi->acceleration = (buf->ReadByte() * 128) / 10; + case 0x0D: { // Acceleration + uint acceleration = (buf->ReadByte() * 128) / 10; + if (acceleration > UINT8_MAX) { + grfmsg(1, "Acceleration property of aircraft %d is too big.", engine + i); + acceleration = UINT8_MAX; + } + avi->acceleration = acceleration; break; + } case PROP_AIRCRAFT_RUNNING_COST_FACTOR: // 0x0E Running cost factor avi->running_cost = buf->ReadByte(); |