diff options
-rw-r--r-- | src/engine.cpp | 6 | ||||
-rw-r--r-- | src/newgrf.cpp | 2 | ||||
-rw-r--r-- | src/newgrf_properties.h | 1 | ||||
-rw-r--r-- | src/roadveh_cmd.cpp | 3 |
4 files changed, 8 insertions, 4 deletions
diff --git a/src/engine.cpp b/src/engine.cpp index 55358b63f..3c6ae964c 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -294,8 +294,10 @@ uint Engine::GetDisplayMaxSpeed() const case VEH_TRAIN: return GetEngineProperty(this->index, PROP_TRAIN_SPEED, this->u.rail.max_speed); - case VEH_ROAD: - return this->u.road.max_speed / 2; + case VEH_ROAD: { + uint max_speed = GetEngineProperty(this->index, PROP_ROADVEH_SPEED, 0); + return (max_speed != 0) ? max_speed * 2 : this->u.road.max_speed / 2; + } case VEH_SHIP: return GetEngineProperty(this->index, PROP_SHIP_SPEED, this->u.ship.max_speed) / 2; diff --git a/src/newgrf.cpp b/src/newgrf.cpp index d2db54e3d..cfec0dd8d 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -832,7 +832,7 @@ static ChangeInfoResult RoadVehicleChangeInfo(uint engine, int numinfo, int prop rvi->weight = buf->ReadByte(); break; - case 0x15: // Speed in mph/0.8 + case PROP_ROADVEH_SPEED: // Speed in mph/0.8 _gted[e->index].rv_max_speed = buf->ReadByte(); break; diff --git a/src/newgrf_properties.h b/src/newgrf_properties.h index fc46aea2e..900220f94 100644 --- a/src/newgrf_properties.h +++ b/src/newgrf_properties.h @@ -32,6 +32,7 @@ enum PropertyID { PROP_ROADVEH_COST_FACTOR = 0x11, ///< Purchase cost PROP_ROADVEH_POWER = 0x13, ///< Power in 10 HP PROP_ROADVEH_WEIGHT = 0x14, ///< Weight in 1/4 t + PROP_ROADVEH_SPEED = 0x15, ///< Max. speed: 1 unit = 1/0.8 mph = 2 km-ish/h PROP_ROADVEH_TRACTIVE_EFFORT = 0x18, ///< Tractive effort coefficient in 1/256 PROP_SHIP_COST_FACTOR = 0x0A, ///< Purchase cost diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index 1b9fef366..e6b575140 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -192,7 +192,8 @@ void RoadVehUpdateCache(RoadVehicle *v) u->colourmap = PAL_NONE; } - v->vcache.cached_max_speed = RoadVehInfo(v->engine_type)->max_speed; + uint max_speed = GetVehicleProperty(v, PROP_ROADVEH_SPEED, 0); + v->vcache.cached_max_speed = (max_speed != 0) ? max_speed * 4 : RoadVehInfo(v->engine_type)->max_speed; } /** |