From: ian Date: Sun, 20 Jul 2008 17:14:43 +0000 (+0000) Subject: train direction command swap arguments X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=e9b6fb97d5ee38c75f7e023e79a642d057ff99cd;p=trains.git train direction command swap arguments --- diff --git a/hostside/README.commands b/hostside/README.commands index 463dd53..758e1b4 100644 --- a/hostside/README.commands +++ b/hostside/README.commands @@ -199,7 +199,7 @@ INCOMPLETE LIST OF OTHER COMMANDS movfeat++ } see route++ !movfeat } see !route - direction forwards|backwards|change + direction forwards|backwards|change DIRECT NMRA AND PIC INSTRUCTIONS diff --git a/hostside/commands.c b/hostside/commands.c index 52d2875..76be340 100644 --- a/hostside/commands.c +++ b/hostside/commands.c @@ -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) );