(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.

pull/155/head
frosch 11 years ago
parent 3e07957338
commit 2ae1b438ec

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

Loading…
Cancel
Save