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

This commit is contained in:
rubidium 2010-07-16 17:45:34 +00:00
parent ad1dde1bd9
commit 1b507dcf66
7 changed files with 13 additions and 13 deletions

View File

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

View File

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

View File

@ -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_TRAIN: t = Train::From(u)->tcache.cached_max_speed; break;
case VEH_ROAD: t = u->max_speed / 2; break; case VEH_ROAD: t = u->max_speed / 2; break;
case VEH_SHIP: t = u->max_speed; 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(); default: NOT_REACHED();
} }

View File

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

View File

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

View File

@ -1322,11 +1322,11 @@ bool AfterLoadGame()
if (CheckSavegameVersion(50)) { if (CheckSavegameVersion(50)) {
Aircraft *v; 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) { FOR_ALL_AIRCRAFT(v) {
if (v->subtype <= AIR_AIRCRAFT) { if (v->subtype <= AIR_AIRCRAFT) {
const AircraftVehicleInfo *avi = AircraftVehInfo(v->engine_type); const AircraftVehicleInfo *avi = AircraftVehInfo(v->engine_type);
v->cur_speed *= 129; v->cur_speed *= 128;
v->cur_speed /= 10; v->cur_speed /= 10;
v->max_speed = avi->max_speed; v->max_speed = avi->max_speed;
v->acceleration = avi->acceleration; v->acceleration = avi->acceleration;

View File

@ -565,7 +565,7 @@ static const ShipVehicleInfo _orig_ship_vehicle_info[] = {
* @param h mail_capacity (bags) * @param h mail_capacity (bags)
* @param i passenger_capacity (persons) * @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 H AIR_HELI
#define P AIR_CTOL #define P AIR_CTOL
#define J AIR_CTOL | AIR_FAST #define J AIR_CTOL | AIR_FAST