Add implementation of multi-aspect signalling and GRF support

Requires realistic braking

See: #247
This commit is contained in:
Jonathan G Rennison
2021-08-28 12:51:06 +01:00
parent 6546f6deba
commit b2ef6c0de8
28 changed files with 917 additions and 35 deletions

View File

@@ -909,6 +909,20 @@ class NIHRailType : public NIHelper {
if (secondary != INVALID_RAILTYPE) {
writeRailType(secondary);
}
if (IsTileType(index, MP_RAILWAY) && HasSignals(index)) {
print("Signals:");
for (Trackdir td = TRACKDIR_BEGIN; td < TRACKDIR_END; td = (Trackdir)(td + 1)) {
if (!IsValidTrackdir(td)) continue;
if (HasTrack(index, TrackdirToTrack(td)) && HasSignalOnTrackdir(index, td)) {
char *b = buffer;
const SignalState state = GetSignalStateByTrackdir(index, td);
b += seprintf(b, lastof(buffer), " trackdir: %d, state: %d", td, state);
if (_extra_aspects > 0 && state == SIGNAL_STATE_GREEN) seprintf(b, lastof(buffer), ", aspect: %d", GetSignalAspect(index, TrackdirToTrack(td)));
print(buffer);
}
}
}
}
};

View File

@@ -83,6 +83,9 @@ static const RailtypeInfo _original_railtypes[] = {
/* control flags */
0,
/* signal extra aspects */
0,
/* cost multiplier */
8,
@@ -190,6 +193,9 @@ static const RailtypeInfo _original_railtypes[] = {
/* control flags */
0,
/* signal extra aspects */
0,
/* cost multiplier */
12,
@@ -293,6 +299,9 @@ static const RailtypeInfo _original_railtypes[] = {
/* control flags */
0,
/* signal extra aspects */
0,
/* cost multiplier */
16,
@@ -396,6 +405,9 @@ static const RailtypeInfo _original_railtypes[] = {
/* control flags */
0,
/* signal extra aspects */
0,
/* cost multiplier */
24,