sigscr parser problem
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Open Rails |
Confirmed
|
Wishlist
|
Unassigned |
Bug Description
This script
SCRIPT AVV3610
extern float this_sig_lr ();
extern float draw_state;
extern float sig_feature ();
float this_dis;
this_dis = this_sig_lr (SIGFN_DISTANCE);
if ( this_dis ==# 6 )
if ( !sig_feature (SIGFEAT_USER2) )
draw_state = 0; // Giallo Verde Lampeggiante Alternato
else draw_state = 2; // Giallo Verde Lampeggiante Alternato/M
// Fine Giallo Verde Lampeggiante Alternato
else if ( this_dis ==# 4 )
if ( !sig_feature (SIGFEAT_USER2) )
draw_state = 1; // Giallo Verde Lampeggiante
else draw_state = 3; // Giallo Verde Lampeggiante/M
// Fine Giallo Verde Lampeggiante
else draw_state = 4; // Nothing
isn't interpreted correctly.
To make it working well four braces have to be added like this
SCRIPT AVV3610
extern float this_sig_lr ();
extern float draw_state;
extern float sig_feature ();
float this_dis;
this_dis = this_sig_lr (SIGFN_DISTANCE);
if ( this_dis ==# 6 )
{
if ( !sig_feature (SIGFEAT_USER2) )
draw_state = 0; // Giallo Verde Lampeggiante Alternato
else draw_state = 2; // Giallo Verde Lampeggiante Alternato/M
// Fine Giallo Verde Lampeggiante Alternato
}
else if ( this_dis ==# 4 )
{
if ( !sig_feature (SIGFEAT_USER2) )
draw_state = 1; // Giallo Verde Lampeggiante
else draw_state = 3; // Giallo Verde Lampeggiante/M
// Fine Giallo Verde Lampeggiante
}
else draw_state = 4; // Nothing
Changed in or: | |
importance: | Undecided → Wishlist |
status: | New → Confirmed |
tags: | added: signals |
Changed in or: | |
status: | Confirmed → Won't Fix |
status: | Won't Fix → Confirmed |
Changed in or: | |
milestone: | none → 1.0 |
Changed in or: | |
milestone: | 1.0 → none |
There is no definitive syntax definition for sigscr.dat files.
For OR, it has been decided to follow standard practice and make it compulsory to use braces on nested if-statements.
This is a necessity when the number of 'else' statements does not match the number of 'if' statements - otherwise it is then not clear to which 'if' a certain 'else' relates.
It does not violate any MSTS rules, so this rule does not compromise the use of scripts in MSTS.