Skip to content

Commit 678a674

Browse files
authored
Merge pull request #537 from Sharpe49/csharp-script-extensions
C# signal script extensions
2 parents 5b753d0 + 939b2b2 commit 678a674

38 files changed

+13574
-13913
lines changed

Source/ContentChecker/SignalScriptLoader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public override void TryLoading(string file)
6969
// we want to load the signal scripts one by one, not as a group
7070
var scriptFiles = new List<string>() { Path.GetFileName(file) };
7171
var scrfile = new SIGSCRfile(new SignalScripts(_sigcfg.ScriptPath, scriptFiles,
72-
_sigcfg.SignalTypes, _sigcfg.ORTSFunctionTypes, _sigcfg.ORTSNormalSubtypes));
72+
_sigcfg.SignalTypes, _sigcfg.SignalFunctions, _sigcfg.ORTSNormalSubtypes));
7373
}
7474
}
7575
}

Source/Contrib/TrackViewer/Drawing/DrawableTrackItem.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,14 @@ public void FindAngle(TrackSectionsFile tsectionDat, TrackDB trackDB, TrackNode
147147
/// <param name="sigcfgFile">The signal configuration file</param>
148148
public void DetermineIfNormal(SignalConfigurationFile sigcfgFile)
149149
{
150-
this.isNormal = true; //default
150+
isNormal = true; //default
151151
if (sigcfgFile == null)
152152
{ // if no sigcfgFile is available, just keep default
153153
return;
154154
}
155-
if (sigcfgFile.SignalTypes.ContainsKey(this.signalType))
155+
if (sigcfgFile.SignalTypes.ContainsKey(signalType))
156156
{
157-
this.isNormal = (sigcfgFile.SignalTypes[this.signalType].FnType == MstsSignalFunction.NORMAL);
157+
isNormal = sigcfgFile.SignalTypes[signalType].Function == SignalFunction.NORMAL;
158158
}
159159
}
160160

Source/Documentation/Manual/appendices.rst

Lines changed: 66 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -490,28 +490,45 @@ immediately following the lighttextures and lightstab definitions.
490490

491491
ORTSSignalFunctions
492492
-------------------
493+
494+
.. index::
495+
single: ORTSSignalFunctions
496+
single: ORTSSignalFunctionType
497+
493498
Additional signal types can be defined in OR, over and above the standard MSTS signal types.
494499
The additional types must be predefined in the sigcfg.dat file using the ORTSSignalFunctions definition.
495500

496501
The defined ORTS signal types can be set in the signal type definition and used in signal script functions
497502
in the same way as the default MSTS types.
498503

504+
By default, a custom signal function will have the same behaviour as an INFO signal function: it will have no impact on the
505+
block sections and will not be able to set a speed limit. You can tell the simulator to consider a custom function to have the
506+
same behaviour as one of the MSTS signal functions. You can add a MSTS function as a second parameter to the ORTSSignalFunctionType
507+
parameter. The use of the NORMAL signal function is currently forbidden. To define several types of NORMAL signals, please use
508+
the ORTSNormalSubtypes parameter.
509+
499510
Note that SPEED is a fixed signal type which is available in OR without explicit definition (see below for
500-
details on SPEED type signals). Also note that any type definition starting with "OR\_" is not valid, these
511+
details on SPEED type signals). Also note that any type definition starting with "OR\_" or "ORTS" is not valid, these
501512
names are reserved for future default types in OR.
502513

503-
Syntax:
514+
Syntax::
504515

505-
| ORTSSignalFunctions ( n
506-
| ORTSSignalFunctionType ( “signaltype” )
507-
| . . .
508-
| )
509-
|
510-
| The value **n** indicates the total number of definitions.
511-
| The value **signaltype** is the name of the additional type.
516+
ORTSSignalFunctions ( n
517+
ORTSSignalFunctionType ( "CUSTOM_SIGNAL_FUNCTION" )
518+
ORTSSignalFunctionType ( "CUSTOM_SPEED_SIGNAL_FUNCTION" "SPEED" )
519+
. . .
520+
)
521+
522+
The value **n** indicates the total number of definitions.
523+
The value **CUSTOM_SIGNAL_FUNCTION** is the name of the additional type.
512524

513525
ORTSNormalSubtypes
514526
------------------
527+
528+
.. index::
529+
single: ORTSNormalSubtypes
530+
single: ORTSNormalSubtype
531+
515532
As detailed above, subtypes can be defined for NORMAL type signals which allows to distinguish
516533
different use of NORMAL type signals.
517534

@@ -522,22 +539,28 @@ statement, see below.
522539

523540
The subtype can be used in specific signal script functions as detailed above.
524541

525-
Syntax:
542+
Syntax::
543+
544+
ORTSNormalSubtypes ( n
545+
ORTSNormalSubtype ( "subtype" )
546+
. . .
547+
)
526548

527-
| ORTSNormalSubtypes ( n
528-
| ORTSNormalSubtype ( " subtype " )
529-
| . . .
530-
| )
531-
|
532-
| The value **n** indicates the total number of definitions.
533-
| The value **subtype** is the name of the subtype.
549+
The value **n** indicates the total number of definitions.
550+
The value **subtype** is the name of the subtype.
534551

535552
Signal Type definitions
536553
-----------------------
537554
The following section details OR specific additions to the signal type definition.
538555

539556
Glow settings
540557
'''''''''''''
558+
559+
.. index::
560+
single: ORTSDayGlow
561+
single: ORTSNightGlow
562+
single: ORTSDayLight
563+
541564
Signal Glow is a feature in OR to improve the visibility of signals at larger distances.
542565
The required glow setting can de set per signal type in the signal definition.
543566
The value is a real number, and sets the intensity of the glow. Value 0.0 defines that there is no glow
@@ -553,10 +576,10 @@ Notes :
553576
- For signal types which have “Semaphore” flag set, the Day value = 0.0.
554577
- For signals of type INFO and SHUNTING, both Day and Night value are set to 0.0 (no glow).
555578

556-
Syntax:
579+
Syntax::
557580

558-
| ORTSDayGlow ( d )
559-
| ORTSNightGlow ( n )
581+
ORTSDayGlow ( d )
582+
ORTSNightGlow ( n )
560583

561584
The values d and n are the day and night glow values, as real numbers.
562585

@@ -565,14 +588,18 @@ Light switch
565588
There were many signalling systems where semaphore signals did not show lights during daytime. This
566589
effect can be simulated using the ORTSDayLight setting.
567590

568-
Syntax:
591+
Syntax::
569592

570-
| ORTSDayLight( l )
593+
ORTSDayLight( l )
571594

572595
The value l is a logical value, if set to false, the signal will not show lights during daytime.
573596

574597
Script Function
575598
---------------
599+
600+
.. index::
601+
single: ORTSScript
602+
576603
Normally, each signal type must have a linked signal script, with the same name as defined for the signal
577604
type. However, often there are a series of signal types which may differ in definition, e.g. due to
578605
differences in the position of the lights, but which have the same logic scripts.
@@ -582,36 +609,43 @@ use. Different signal types which have the same logic can therefore all use the
582609
This script may be defined using the name of one of these signal types, or it may have a generic name
583610
not linked to any existing signal type.
584611

585-
Syntax:
612+
Syntax::
586613

587-
588-
| ORTSScript( name )
614+
ORTSScript( name )
589615

590616
The value **name** is the name of the signal script as defined in the sigscr.dat file.
591617

592618
Normal Subtype
593619
--------------
620+
621+
.. index::
622+
single: ORTSNormalSubtype
623+
594624
As detailed above, a signal type of type NORMAL may have an additional subtype definition.
595625

596-
Syntax:
626+
Syntax::
597627

598-
| ORTSNormalSubtype( subtype )
628+
ORTSNormalSubtype( subtype )
599629

600630
The value **subtype** is the subtype name and must match one of the names defined in
601631
ORTSNormalSubtypes.
602632

603633
Approach Control Settings
604634
-------------------------
635+
636+
.. index::
637+
single: ApproachControlSettings
638+
605639
The required values for approach control functions for a particular signal type can be defined in the
606640
signal type definition. These values can be referenced in the signal script as defined for the approach
607641
control functions.
608642

609-
Syntax:
643+
Syntax::
610644

611-
| ApproachControlSettings (
612-
| PositionDefinition ( position )
613-
| SpeedDefinition ( speed )
614-
| )
645+
ApproachControlSettings (
646+
PositionDefinition ( position )
647+
SpeedDefinition ( speed )
648+
)
615649

616650
Possible position definitions
617651
'''''''''''''''''''''''''''''

0 commit comments

Comments
 (0)