summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ai/api/ai_bridge.cpp2
-rw-r--r--src/ai/api/ai_engine.cpp2
-rw-r--r--src/ai/api/ai_event_types.cpp2
-rw-r--r--src/ai/api/ai_vehicle.cpp2
-rw-r--r--src/aircraft.h4
-rw-r--r--src/bridge_gui.cpp2
-rw-r--r--src/engine.cpp10
-rw-r--r--src/order_cmd.cpp2
-rw-r--r--src/roadveh.h4
-rw-r--r--src/ship.h4
-rw-r--r--src/strings.cpp2
-rw-r--r--src/train.h4
-rw-r--r--src/vehicle_base.h4
13 files changed, 22 insertions, 22 deletions
diff --git a/src/ai/api/ai_bridge.cpp b/src/ai/api/ai_bridge.cpp
index 310c23f25..f342404cf 100644
--- a/src/ai/api/ai_bridge.cpp
+++ b/src/ai/api/ai_bridge.cpp
@@ -133,7 +133,7 @@ static void _DoCommandReturnBuildBridge1(class AIInstance *instance)
{
if (!IsValidBridge(bridge_id)) return -1;
- return ::GetBridgeSpec(bridge_id)->speed;
+ return ::GetBridgeSpec(bridge_id)->speed; // km-ish/h
}
/* static */ Money AIBridge::GetPrice(BridgeID bridge_id, uint length)
diff --git a/src/ai/api/ai_engine.cpp b/src/ai/api/ai_engine.cpp
index 762da14b1..8c81862ad 100644
--- a/src/ai/api/ai_engine.cpp
+++ b/src/ai/api/ai_engine.cpp
@@ -119,7 +119,7 @@
if (!IsValidEngine(engine_id)) return -1;
const Engine *e = ::GetEngine(engine_id);
- int32 max_speed = e->GetDisplayMaxSpeed() * 16 / 10; // convert mph to km-ish/h
+ int32 max_speed = e->GetDisplayMaxSpeed(); // km-ish/h
if (e->type == VEH_AIRCRAFT) max_speed /= _settings_game.vehicle.plane_speed;
return max_speed;
}
diff --git a/src/ai/api/ai_event_types.cpp b/src/ai/api/ai_event_types.cpp
index c495e082e..abff79873 100644
--- a/src/ai/api/ai_event_types.cpp
+++ b/src/ai/api/ai_event_types.cpp
@@ -80,7 +80,7 @@ int32 AIEventEnginePreview::GetCapacity()
int32 AIEventEnginePreview::GetMaxSpeed()
{
const Engine *e = ::GetEngine(engine);
- int32 max_speed = e->GetDisplayMaxSpeed() * 16 / 10; // convert mph to km-ish/h
+ int32 max_speed = e->GetDisplayMaxSpeed(); // km-ish/h
if (e->type == VEH_AIRCRAFT) max_speed /= _settings_game.vehicle.plane_speed;
return max_speed;
}
diff --git a/src/ai/api/ai_vehicle.cpp b/src/ai/api/ai_vehicle.cpp
index 081b7b739..18e17221d 100644
--- a/src/ai/api/ai_vehicle.cpp
+++ b/src/ai/api/ai_vehicle.cpp
@@ -278,7 +278,7 @@
{
if (!IsValidVehicle(vehicle_id)) return -1;
- return ::GetVehicle(vehicle_id)->GetDisplaySpeed() * 16 / 10;
+ return ::GetVehicle(vehicle_id)->GetDisplaySpeed(); // km-ish/h
}
/* static */ AIVehicle::VehicleState AIVehicle::GetState(VehicleID vehicle_id)
diff --git a/src/aircraft.h b/src/aircraft.h
index 2f50517df..52b8c0252 100644
--- a/src/aircraft.h
+++ b/src/aircraft.h
@@ -102,8 +102,8 @@ struct Aircraft : public Vehicle {
ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_AIRCRAFT_INC : EXPENSES_AIRCRAFT_RUN; }
bool IsPrimaryVehicle() const { return IsNormalAircraft(this); }
SpriteID GetImage(Direction direction) const;
- int GetDisplaySpeed() const { return this->cur_speed * 10 / 16; }
- int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 16; }
+ int GetDisplaySpeed() const { return this->cur_speed; }
+ int GetDisplayMaxSpeed() const { return this->max_speed; }
Money GetRunningCost() const;
bool IsInDepot() const { return (this->vehstatus & VS_HIDDEN) != 0 && IsHangarTile(this->tile); }
void Tick();
diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp
index 21f3c5528..5ebc36f54 100644
--- a/src/bridge_gui.cpp
+++ b/src/bridge_gui.cpp
@@ -165,7 +165,7 @@ public:
const BridgeSpec *b = this->bridges->Get(i)->spec;
SetDParam(2, this->bridges->Get(i)->cost);
- SetDParam(1, b->speed * 10 / 16);
+ SetDParam(1, b->speed);
SetDParam(0, b->material);
DrawSprite(b->sprite, b->pal, 3, y);
diff --git a/src/engine.cpp b/src/engine.cpp
index 20be6ebd8..3ca62c400 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -156,22 +156,22 @@ Money Engine::GetCost() const
/**
* Returns max speed for display purposes
- * @return max speed in mph
+ * @return max speed in km-ish/h
*/
uint Engine::GetDisplayMaxSpeed() const
{
switch (this->type) {
case VEH_TRAIN:
- return GetEngineProperty(this->index, 0x09, this->u.rail.max_speed) * 10 / 16;
+ return GetEngineProperty(this->index, 0x09, this->u.rail.max_speed);
case VEH_ROAD:
- return this->u.road.max_speed * 10 / 32;
+ return this->u.road.max_speed / 2;
case VEH_SHIP:
- return GetEngineProperty(this->index, 0x0B, this->u.ship.max_speed) * 10 / 32;
+ return GetEngineProperty(this->index, 0x0B, this->u.ship.max_speed) / 2;
case VEH_AIRCRAFT:
- return this->u.air.max_speed * 10 / 16;
+ return this->u.air.max_speed;
default: NOT_REACHED();
}
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index 4eabc94c4..1fb267885 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -1590,7 +1590,7 @@ VehicleOrderID ProcessConditionalOrder(const Order *order, const Vehicle *v)
switch (order->GetConditionVariable()) {
case OCV_LOAD_PERCENTAGE: skip_order = OrderConditionCompare(occ, CalcPercentVehicleFilled(v, NULL), value); break;
case OCV_RELIABILITY: skip_order = OrderConditionCompare(occ, v->reliability * 100 >> 16, value); break;
- case OCV_MAX_SPEED: skip_order = OrderConditionCompare(occ, v->GetDisplayMaxSpeed(), value); break;
+ case OCV_MAX_SPEED: skip_order = OrderConditionCompare(occ, v->GetDisplayMaxSpeed() * 10 / 16, value); break;
case OCV_AGE: skip_order = OrderConditionCompare(occ, v->age / DAYS_IN_LEAP_YEAR, value); break;
case OCV_REQUIRES_SERVICE: skip_order = OrderConditionCompare(occ, v->NeedsServicing(), value); break;
case OCV_UNCONDITIONALLY: skip_order = true; break;
diff --git a/src/roadveh.h b/src/roadveh.h
index 305a76e9a..5e1b7f455 100644
--- a/src/roadveh.h
+++ b/src/roadveh.h
@@ -74,8 +74,8 @@ struct RoadVehicle : public Vehicle {
ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_ROADVEH_INC : EXPENSES_ROADVEH_RUN; }
bool IsPrimaryVehicle() const { return IsRoadVehFront(this); }
SpriteID GetImage(Direction direction) const;
- int GetDisplaySpeed() const { return this->cur_speed * 10 / 32; }
- int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 32; }
+ int GetDisplaySpeed() const { return this->cur_speed / 2; }
+ int GetDisplayMaxSpeed() const { return this->max_speed / 2; }
Money GetRunningCost() const { return RoadVehInfo(this->engine_type)->running_cost * GetPriceByIndex(RoadVehInfo(this->engine_type)->running_cost_class); }
bool IsInDepot() const { return this->u.road.state == RVSB_IN_DEPOT; }
bool IsStoppedInDepot() const;
diff --git a/src/ship.h b/src/ship.h
index 831a692dd..d826e1cbd 100644
--- a/src/ship.h
+++ b/src/ship.h
@@ -36,8 +36,8 @@ struct Ship: public Vehicle {
void PlayLeaveStationSound() const;
bool IsPrimaryVehicle() const { return true; }
SpriteID GetImage(Direction direction) const;
- int GetDisplaySpeed() const { return this->cur_speed * 10 / 32; }
- int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 32; }
+ int GetDisplaySpeed() const { return this->cur_speed / 2; }
+ int GetDisplayMaxSpeed() const { return this->max_speed / 2; }
Money GetRunningCost() const;
bool IsInDepot() const { return this->u.ship.state == TRACK_BIT_DEPOT; }
void Tick();
diff --git a/src/strings.cpp b/src/strings.cpp
index 83231b2ce..e6d10e092 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -596,7 +596,7 @@ static char *FormatString(char *buff, const char *str, const int64 *argv, uint c
case SCC_VELOCITY: {// {VELOCITY}
int64 args[1];
assert(_settings_game.locale.units < lengthof(units));
- args[0] = ConvertSpeedToDisplaySpeed(GetInt32(&argv));
+ args[0] = ConvertSpeedToDisplaySpeed(GetInt32(&argv) * 10 / 16);
buff = FormatString(buff, GetStringPtr(units[_settings_game.locale.units].velocity), args, modifier >> 24, last);
modifier = 0;
break;
diff --git a/src/train.h b/src/train.h
index 3a462438f..02125efc9 100644
--- a/src/train.h
+++ b/src/train.h
@@ -322,8 +322,8 @@ struct Train : public Vehicle {
void PlayLeaveStationSound() const;
bool IsPrimaryVehicle() const { return IsFrontEngine(this); }
SpriteID GetImage(Direction direction) const;
- int GetDisplaySpeed() const { return this->u.rail.last_speed * 10 / 16; }
- int GetDisplayMaxSpeed() const { return this->u.rail.cached_max_speed * 10 / 16; }
+ int GetDisplaySpeed() const { return this->u.rail.last_speed; }
+ int GetDisplayMaxSpeed() const { return this->u.rail.cached_max_speed; }
Money GetRunningCost() const;
bool IsInDepot() const { return CheckTrainInDepot(this, false) != -1; }
bool IsStoppedInDepot() const { return CheckTrainStoppedInDepot(this) >= 0; }
diff --git a/src/vehicle_base.h b/src/vehicle_base.h
index 3113658f3..cfda648ec 100644
--- a/src/vehicle_base.h
+++ b/src/vehicle_base.h
@@ -397,13 +397,13 @@ public:
virtual SpriteID GetImage(Direction direction) const { return 0; }
/**
- * Gets the speed in mph that can be sent into SetDParam for string processing.
+ * Gets the speed in km-ish/h that can be sent into SetDParam for string processing.
* @return the vehicle's speed
*/
virtual int GetDisplaySpeed() const { return 0; }
/**
- * Gets the maximum speed in mph that can be sent into SetDParam for string processing.
+ * Gets the maximum speed in km-ish/h that can be sent into SetDParam for string processing.
* @return the vehicle's maximum speed
*/
virtual int GetDisplayMaxSpeed() const { return 0; }