Add feature: realistic train braking

Add setting to select train braking model.
This commit is contained in:
Jonathan G Rennison
2021-01-25 02:33:14 +00:00
parent 2b02318c7e
commit ed0ffb6220
37 changed files with 2556 additions and 291 deletions

View File

@@ -16,6 +16,8 @@
#include "direction_type.h"
#include "company_type.h"
#include "debug.h"
#include "settings_type.h"
#include "vehicle_type.h"
/**
* Maps a trackdir to the bit that stores its status in the map arrays, in the
@@ -67,6 +69,12 @@ static inline bool IsComboSignal(SignalType type)
/// Is a given signal type a PBS signal?
static inline bool IsPbsSignal(SignalType type)
{
return _settings_game.vehicle.train_braking_model == TBM_REALISTIC || type == SIGTYPE_PBS || type == SIGTYPE_PBS_ONEWAY;
}
/// Is a given signal type a PBS signal?
static inline bool IsPbsSignalNonExtended(SignalType type)
{
return type == SIGTYPE_PBS || type == SIGTYPE_PBS_ONEWAY;
}
@@ -77,6 +85,12 @@ static inline bool IsProgrammableSignal(SignalType type)
return type == SIGTYPE_PROG;
}
/// Is this signal type unsuitable for realistic braking?
static inline bool IsSignalTypeUnsuitableForRealisticBraking(SignalType type)
{
return type == SIGTYPE_ENTRY || type == SIGTYPE_EXIT || type == SIGTYPE_COMBO || type == SIGTYPE_PROG;
}
/// Does a given signal have a PBS sprite?
static inline bool IsSignalSpritePBS(SignalType type)
{