(svn r14869) -Feature: Allow road vehicles to move multiple steps in a tick (code based on train movement code) and add support for RV prop 15. This gives RVs a maximum speed of 318mph instead 79mph. This only implements higher speeds, not 'realistic acceleration'.

This commit is contained in:
2009-01-06 14:45:38 +00:00
parent 680175fea0
commit c0efc759ef
3 changed files with 59 additions and 27 deletions

View File

@@ -104,6 +104,7 @@ enum {
struct GRFTempEngineData {
uint16 cargo_allowed;
uint16 cargo_disallowed;
uint8 rv_max_speed; ///< Temporary storage of RV prop 15, maximum speed in mph/0.8
};
static GRFTempEngineData *_gted;
@@ -790,7 +791,6 @@ static ChangeInfoResult RoadVehicleChangeInfo(uint engine, int numinfo, int prop
case 0x13: // Power in 10hp
case 0x14: // Weight in 1/4 tons
case 0x15: // Speed in mph*0.8
/** @todo Support for road vehicles realistic power
* computations (called rvpower in TTDPatch) is just
* missing in OTTD yet. --pasky */
@@ -798,6 +798,10 @@ static ChangeInfoResult RoadVehicleChangeInfo(uint engine, int numinfo, int prop
ret = CIR_UNHANDLED;
break;
case 0x15: // Speed in mph/0.8
_gted[e->index].rv_max_speed = grf_load_byte(&buf);
break;
case 0x16: // Cargos available for refitting
ei->refit_mask = grf_load_dword(&buf);
break;
@@ -6027,6 +6031,14 @@ static void AfterLoadGRFs()
/* Load old shore sprites in new position, if they were replaced by ActionA */
ActivateOldShore();
Engine *e;
FOR_ALL_ENGINES_OF_TYPE(e, VEH_ROAD) {
if (_gted[e->index].rv_max_speed != 0) {
/* Set RV maximum speed from the mph/0.8 unit value */
e->u.road.max_speed = _gted[e->index].rv_max_speed * 4;
}
}
/* Deallocate temporary loading data */
free(_gted);
_grm_sprites.clear();