Action-funtiction f0

Bug #672195 reported by blackhorse on 2010-11-07
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Rocrail
Fix Released
Wishlist
Unassigned

Bug Description

Loco Function
Revision 1859+
The function number must be between 1 and 28, and works only with locoID “*”.
Format:

fon,#function
foff,#function
Example:
Loco function 3 must be turned on:

fon,3

Why only from f1 to f28 ???

Why not f0 ???

Rocrail (r.j.versluis) wrote :

F0 stands for loco lights and must be always turned on by law.

Changed in rocrail:
status: New → Won't Fix
blackhorse (markus-schimke-web) wrote :

When i create a rule with the lights (f0) can't i choose the f0-fuction. it is important.

ron&bram (ronaldestherbram) wrote :

It is true that the action condition that the lights of loc must be on or off does not exists. I did some work on the code in action.c and came up with the code below. I tested it with all possible combinations of fon/foff and functions f0 and f1 and it all worked.

Commit?

                  if( fonoff != NULL && fnumber != NULL ) {
                    int nr = atoi(fnumber);
                    int fx = wLoc.getfx(LocOp.base.properties(lc));
                    Boolean lights = wLoc.isfn(LocOp.base.properties(lc));
                    rc = False;
                    if( StrOp.equals( "fon", fonoff ) && nr == 0 )
                      rc = lights;
                    else if( StrOp.equals( "foff", fonoff ) && nr == 0 )
                      rc = !lights;
                    else if( StrOp.equals( "fon", fonoff ) && nr != 0 )
                      rc = ( fx & (1 << (nr-1)) );
                    else if( StrOp.equals( "foff", fonoff ) && nr != 0 )
                      rc = ( !(fx & (1 << (nr-1)) ) );

Rocrail (r.j.versluis) wrote :

Hi Ronald,
just commit it.

ron&bram (ronaldestherbram) wrote :

In revision 2112 fon,0 and foff,0 are added.

Changed in rocrail:
status: Won't Fix → Fix Committed
Rocrail (r.j.versluis) on 2010-11-09
Changed in rocrail:
importance: Undecided → Wishlist
Changed in rocrail:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers