Initial implementation of two rail types per tile

This commit is contained in:
Jonathan G Rennison
2018-12-21 03:27:58 +00:00
parent 8128d027c0
commit 65b9a103ad
24 changed files with 768 additions and 225 deletions

View File

@@ -247,7 +247,7 @@ protected: // These functions should not be called outside acceleration code.
inline uint16 GetPower() const
{
/* Power is not added for articulated parts */
if (!this->IsArticulatedPart() && (this->IsVirtual() || HasPowerOnRail(this->railtype, GetRailType(this->tile)))) {
if (!this->IsArticulatedPart() && (this->IsVirtual() || HasPowerOnRail(this->railtype, GetRailTypeByTrackBit(this->tile, this->track)))) {
uint16 power = GetVehicleProperty(this, PROP_TRAIN_POWER, RailVehInfo(this->engine_type)->power);
/* Halve power for multiheaded parts */
if (this->IsMultiheaded()) power /= 2;
@@ -264,7 +264,7 @@ protected: // These functions should not be called outside acceleration code.
inline uint16 GetPoweredPartPower(const Train *head) const
{
/* For powered wagons the engine defines the type of engine (i.e. railtype) */
if (HasBit(this->flags, VRF_POWEREDWAGON) && (head->IsVirtual() || HasPowerOnRail(head->railtype, GetRailType(this->tile)))) {
if (HasBit(this->flags, VRF_POWEREDWAGON) && (head->IsVirtual() || HasPowerOnRail(head->railtype, GetRailTypeByTrackBit(this->tile, this->track)))) {
return RailVehInfo(this->gcache.first_engine)->pow_wag_power;
}
@@ -374,7 +374,7 @@ protected: // These functions should not be called outside acceleration code.
*/
inline uint16 GetMaxTrackSpeed() const
{
return GetRailTypeInfo(GetRailType(this->tile))->max_speed;
return GetRailTypeInfo(GetRailTypeByTrackBit(this->tile, this->track))->max_speed;
}
/**