summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-07-16 17:45:34 +0000
committerrubidium <rubidium@openttd.org>2010-07-16 17:45:34 +0000
commite809c05099b09bab8f23a4307e0088247478770c (patch)
tree7d9440f06e05022e329571cb5e22d6294fab6da9 /src
parent615e7ce38b49d7b76067115ad8444a18a2c7ee20 (diff)
downloadopenttd-e809c05099b09bab8f23a4307e0088247478770c.tar.xz
(svn r20164) -Fix [FS#3870]: inconsistencies w.r.t. to km/h vs km-ish/h as "base" unit for aircraft speeds
Diffstat (limited to 'src')
-rw-r--r--src/aircraft_cmd.cpp4
-rw-r--r--src/economy.cpp2
-rw-r--r--src/engine.cpp2
-rw-r--r--src/newgrf.cpp6
-rw-r--r--src/saveload/afterload.cpp4
-rw-r--r--src/table/engines.h2
6 files changed, 10 insertions, 10 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index c1c78a88e..fcdc33f4e 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 308334b1c..305bbfa1e 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 e2faf7a42..a814613f1 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 3e4e95b5b..8c4fe36b0 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 dd25705ab..b768e33ef 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 f92e3e04b..8e7d9da85 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