(svn r20164) -Fix [FS#3870]: inconsistencies w.r.t. to km/h vs km-ish/h as "base" unit for aircraft speeds

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
rubidium 14 years ago
parent 615e7ce38b
commit e809c05099

@ -4998,7 +4998,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
CanRefitCargo(): false
GetCapacity(): 25
GetReliability(): 58
GetMaxSpeed(): 238
GetMaxSpeed(): 236
GetPrice(): 28710
GetMaxAge(): 7320
GetRunningCost(): 2390
@ -5016,7 +5016,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
CanRefitCargo(): false
GetCapacity(): 65
GetReliability(): 95
GetMaxSpeed(): 238
GetMaxSpeed(): 236
GetPrice(): 30761
GetMaxAge(): 8784
GetRunningCost(): 2812
@ -5070,7 +5070,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
CanRefitCargo(): false
GetCapacity(): 30
GetReliability(): 77
GetMaxSpeed(): 238
GetMaxSpeed(): 236
GetPrice(): 30761
GetMaxAge(): 10980
GetRunningCost(): 2756

@ -663,8 +663,8 @@ void UpdateAircraftCache(Aircraft *v)
{
uint max_speed = GetVehicleProperty(v, PROP_AIRCRAFT_SPEED, 0);
if (max_speed != 0) {
/* Convert from original units to (approx) km/h */
max_speed = (max_speed * 129) / 10;
/* Convert from original units to km-ish/h */
max_speed = (max_speed * 128) / 10;
v->acache.cached_max_speed = max_speed;
} else {

@ -1241,7 +1241,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
case VEH_TRAIN: t = Train::From(u)->tcache.cached_max_speed; break;
case VEH_ROAD: t = u->max_speed / 2; break;
case VEH_SHIP: t = u->max_speed; break;
case VEH_AIRCRAFT: t = u->max_speed * 10 / 129; break; // convert to old units
case VEH_AIRCRAFT: t = u->max_speed * 10 / 128; break; // convert to old units
default: NOT_REACHED();
}

@ -293,7 +293,7 @@ uint Engine::GetDisplayMaxSpeed() const
case VEH_AIRCRAFT: {
uint max_speed = GetEngineProperty(this->index, PROP_AIRCRAFT_SPEED, 0);
if (max_speed != 0) {
return (max_speed * 129) / 10;
return (max_speed * 128) / 10;
}
return this->u.air.max_speed;
}

@ -1034,12 +1034,12 @@ static ChangeInfoResult AircraftVehicleChangeInfo(uint engine, int numinfo, int
avi->cost_factor = buf->ReadByte();
break;
case PROP_AIRCRAFT_SPEED: // 0x0C Speed (1 unit is 8 mph, we translate to 1 unit is 1 km/h)
avi->max_speed = (buf->ReadByte() * 129) / 10;
case PROP_AIRCRAFT_SPEED: // 0x0C Speed (1 unit is 8 mph, we translate to 1 unit is 1 km-ish/h)
avi->max_speed = (buf->ReadByte() * 128) / 10;
break;
case 0x0D: // Acceleration
avi->acceleration = (buf->ReadByte() * 129) / 10;
avi->acceleration = (buf->ReadByte() * 128) / 10;
break;
case PROP_AIRCRAFT_RUNNING_COST_FACTOR: // 0x0E Running cost factor

@ -1322,11 +1322,11 @@ bool AfterLoadGame()
if (CheckSavegameVersion(50)) {
Aircraft *v;
/* Aircraft units changed from 8 mph to 1 km/h */
/* Aircraft units changed from 8 mph to 1 km-ish/h */
FOR_ALL_AIRCRAFT(v) {
if (v->subtype <= AIR_AIRCRAFT) {
const AircraftVehicleInfo *avi = AircraftVehInfo(v->engine_type);
v->cur_speed *= 129;
v->cur_speed *= 128;
v->cur_speed /= 10;
v->max_speed = avi->max_speed;
v->acceleration = avi->acceleration;

@ -565,7 +565,7 @@ static const ShipVehicleInfo _orig_ship_vehicle_info[] = {
* @param h mail_capacity (bags)
* @param i passenger_capacity (persons)
*/
#define AVI(a, b, c, d, e, f, g, h, i) { a, b, c, d, e, f, (g * 129) / 10, h, i }
#define AVI(a, b, c, d, e, f, g, h, i) { a, b, c, d, e, f, (g * 128) / 10, h, i }
#define H AIR_HELI
#define P AIR_CTOL
#define J AIR_CTOL | AIR_FAST

Loading…
Cancel
Save