(svn r21058) -Feature [NewGRF]: Add CB36 support for road vehicle properties 0x13 (Power), 0x14 (Weight) and 0x18 (Tractive effort).

This commit is contained in:
terkhen
2010-10-30 14:31:49 +00:00
parent 0baf335be3
commit c87e023d7a
4 changed files with 17 additions and 9 deletions

View File

@@ -17,6 +17,8 @@
#include "cargotype.h"
#include "track_func.h"
#include "road_type.h"
#include "newgrf_properties.h"
#include "newgrf_engine.h"
struct RoadVehicle;
@@ -171,7 +173,8 @@ protected: // These functions should not be called outside acceleration code.
{
/* Power is not added for articulated parts */
if (!this->IsArticulatedPart()) {
return 10 * RoadVehInfo(this->engine_type)->power; // Road vehicle power is in units of 10 HP.
/* Road vehicle power is in units of 10 HP. */
return 10 * GetVehicleProperty(this, PROP_ROADVEH_POWER, RoadVehInfo(this->engine_type)->power);
}
return 0;
}
@@ -195,7 +198,8 @@ protected: // These functions should not be called outside acceleration code.
/* Vehicle weight is not added for articulated parts. */
if (!this->IsArticulatedPart()) {
weight += RoadVehInfo(this->engine_type)->weight / 4; // Road vehicle weight is in units of 1/4 t.
/* Road vehicle weight is in units of 1/4 t. */
weight += GetVehicleProperty(this, PROP_ROADVEH_WEIGHT, RoadVehInfo(this->engine_type)->weight) / 4;
}
return weight;
@@ -207,7 +211,8 @@ protected: // These functions should not be called outside acceleration code.
*/
FORCEINLINE byte GetTractiveEffort() const
{
return RoadVehInfo(this->engine_type)->tractive_effort;
/* The tractive effort coefficient is in units of 1/256. */
return GetVehicleProperty(this, PROP_ROADVEH_TRACTIVE_EFFORT, RoadVehInfo(this->engine_type)->tractive_effort);
}
/**