Nasal: accept strings-containing-ints as
arguments to leg altitude/speed constraints.
This commit is contained in:
parent
0b17c68f59
commit
f0011bc759
1 changed files with 17 additions and 2 deletions
|
@ -2192,7 +2192,15 @@ static naRef f_leg_setSpeed(naContext c, naRef me, int argc, naRef* args)
|
|||
}
|
||||
|
||||
RouteRestriction rr = routeRestrictionFromString(naStr_data(args[1]));
|
||||
leg->setSpeed(rr, args[0].num);
|
||||
if (naIsNum(args[0])) {
|
||||
leg->setSpeed(rr, args[0].num);
|
||||
} else if (naIsString(args[0])) {
|
||||
leg->setSpeed(rr, simgear::strutils::to_int(naStr_data(args[0])));
|
||||
} else {
|
||||
naRuntimeError(c, "bad speed value for leg.setSpeed");
|
||||
}
|
||||
|
||||
|
||||
return naNil();
|
||||
}
|
||||
|
||||
|
@ -2208,7 +2216,14 @@ static naRef f_leg_setAltitude(naContext c, naRef me, int argc, naRef* args)
|
|||
}
|
||||
|
||||
RouteRestriction rr = routeRestrictionFromString(naStr_data(args[1]));
|
||||
leg->setAltitude(rr, args[0].num);
|
||||
if (naIsNum(args[0])) {
|
||||
leg->setAltitude(rr, args[0].num);
|
||||
} else if (naIsString(args[0])) {
|
||||
leg->setAltitude(rr, simgear::strutils::to_int(naStr_data(args[0])));
|
||||
} else {
|
||||
naRuntimeError(c, "bad value for setAltitude");
|
||||
}
|
||||
|
||||
return naNil();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue