|
@@ -136,24 +136,26 @@ struct Train : public GroundVehicle<Trai
|
|
|
void OnNewDay();
|
|
|
uint Crash(bool flooded = false);
|
|
|
Trackdir GetVehicleTrackdir() const;
|
|
|
TileIndex GetOrderStationLocation(StationID station);
|
|
|
bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse);
|
|
|
|
|
|
void ReserveTrackUnderConsist() const;
|
|
|
|
|
|
int GetCurveSpeedLimit() const;
|
|
|
|
|
|
void ConsistChanged(bool same_length);
|
|
|
|
|
|
void RailtypeChanged();
|
|
|
|
|
|
int UpdateSpeed();
|
|
|
|
|
|
void UpdateAcceleration();
|
|
|
|
|
|
int GetCurrentMaxSpeed() const;
|
|
|
|
|
|
/**
|
|
|
* enum to handle train subtypes
|
|
|
* Do not access it directly unless you have to. Use the access functions below
|
|
|
* This is an enum to tell what bit to access as it is a bitmask
|
|
|
*/
|
|
|
enum TrainSubtype {
|
|
@@ -363,25 +365,25 @@ struct Train : public GroundVehicle<Trai
|
|
|
*/
|
|
|
FORCEINLINE Train *GetPrevUnit()
|
|
|
{
|
|
|
Train *v = this->GetPrevVehicle();
|
|
|
if (v != NULL && v->IsRearDualheaded()) v = v->GetPrevVehicle();
|
|
|
|
|
|
return v;
|
|
|
}
|
|
|
|
|
|
|
|
|
protected: // These functions should not be called outside acceleration code.
|
|
|
|
|
|
void UpdateVisualEffect();
|
|
|
void UpdateVisualEffect(bool allow_power_change);
|
|
|
|
|
|
/**
|
|
|
* Allows to know the power value that this vehicle will use.
|
|
|
* @return Power value from the engine in HP, or zero if the vehicle is not powered.
|
|
|
*/
|
|
|
FORCEINLINE uint16 GetPower() const
|
|
|
{
|
|
|
/* Power is not added for articulated parts */
|
|
|
if (!this->IsArticulatedPart() && HasPowerOnRail(this->railtype, GetRailType(this->tile))) {
|
|
|
uint16 power = GetVehicleProperty(this, PROP_TRAIN_POWER, RailVehInfo(this->engine_type)->power);
|
|
|
/* Halve power for multiheaded parts */
|
|
|
if (this->IsMultiheaded()) power /= 2;
|