From 1b507dcf666f5e3e8369c64d56c249633b9b681e Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 16 Jul 2010 17:45:34 +0000 Subject: [PATCH] (svn r20164) -Fix [FS#3870]: inconsistencies w.r.t. to km/h vs km-ish/h as "base" unit for aircraft speeds --- bin/ai/regression/regression.txt | 6 +++--- src/aircraft_cmd.cpp | 4 ++-- src/economy.cpp | 2 +- src/engine.cpp | 2 +- src/newgrf.cpp | 6 +++--- src/saveload/afterload.cpp | 4 ++-- src/table/engines.h | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/bin/ai/regression/regression.txt b/bin/ai/regression/regression.txt index 524341fc84..bacb6f888c 100644 --- a/bin/ai/regression/regression.txt +++ b/bin/ai/regression/regression.txt @@ -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 diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index c1c78a88e3..fcdc33f4e8 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -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 { diff --git a/src/economy.cpp b/src/economy.cpp index 308334b1cd..305bbfa1e3 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -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(); } diff --git a/src/engine.cpp b/src/engine.cpp index e2faf7a426..a814613f11 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -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; } diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 3e4e95b5b9..8c4fe36b0c 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -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 diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index dd25705ab1..b768e33ef7 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -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; diff --git a/src/table/engines.h b/src/table/engines.h index f92e3e04bd..8e7d9da85e 100644 --- a/src/table/engines.h +++ b/src/table/engines.h @@ -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