chiark / gitweb /
train direction command swap arguments
authorian <ian>
Sun, 20 Jul 2008 17:14:43 +0000 (17:14 +0000)
committerian <ian>
Sun, 20 Jul 2008 17:14:43 +0000 (17:14 +0000)
hostside/README.commands
hostside/commands.c

index 463dd534e5833e596505ecda9dcc729167781d32..758e1b4a388be80788a4e3b0de682462ab988ce2 100644 (file)
@@ -199,7 +199,7 @@ INCOMPLETE LIST OF OTHER COMMANDS
  movfeat++ <as above>                          } see route++
  !movfeat                                      } see !route
 
- direction forwards|backwards|change <train>
+ direction <train> forwards|backwards|change
 
 DIRECT NMRA AND PIC INSTRUCTIONS
 
index 52d28757ee2748aa5dedba656306abe5a88b408b..76be340d3598a76ab03b21fcfc435230c2997af1 100644 (file)
@@ -351,13 +351,14 @@ static int cmd_direction(ParseState *ps, const CmdInfo *ci) {
   Train *tra;
   int backwards;
 
+  MUSTECR( ps_needtrain(ps,&tra) );
+
   MUSTECR( ps_needword(ps) );
   if (!thiswordstrcmp(ps,"forwards")) backwards= 0;
   else if (!thiswordstrcmp(ps,"backwards")) backwards= 1;
   else if (!thiswordstrcmp(ps,"change")) backwards= !tra->backwards;
   else return badcmd(ps, "direction must be forwards|backwards|change");
 
-  MUSTECR( ps_needtrain(ps,&tra) );
   MUSTECR( ps_neednoargs(ps) );
   
   MUSTECRPREDICT( safety_setdirection(tra,backwards,CMDPPC) );