(svn r21100) -Feature [NewGRF]: Add CB36 support for road vehicle property 0x15 (Speed).

This commit is contained in:
terkhen 2010-11-06 13:11:24 +00:00
parent 18e3a3ddfc
commit b65df93121
4 changed files with 8 additions and 4 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;
}
/**