sigscr parser problem

Bug #1090744 reported by Carlo Santucci
6
This bug affects 1 person
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

Tags: signals
Revision history for this message
r.roeterdink (r-roeterdink) wrote :

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.

James Ross (twpol)
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
cjakeman (cjakeman)
Changed in or:
milestone: none → 1.0
James Ross (twpol)
Changed in or:
milestone: 1.0 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.