Changeset - r16374:2d8508274da9
[Not reviewed]
master
0 4 0
terkhen - 14 years ago 2010-11-06 13:11:24
terkhen@openttd.org
(svn r21100) -Feature [NewGRF]: Add CB36 support for road vehicle property 0x15 (Speed).
4 files changed with 8 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/engine.cpp
Show inline comments
 
@@ -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;
src/newgrf.cpp
Show inline comments
 
@@ -832,7 +832,7 @@ static ChangeInfoResult RoadVehicleChang
 
				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;
 

	
src/newgrf_properties.h
Show inline comments
 
@@ -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
src/roadveh_cmd.cpp
Show inline comments
 
@@ -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;
 
}
 

	
 
/**
0 comments (0 inline, 0 general)