static WayptFlag wayptFlagFromString(const char* s)
{
if (!strcmp(s, "sid")) return WPT_DEPARTURE;
static WayptFlag wayptFlagFromString(const char* s)
{
if (!strcmp(s, "sid")) return WPT_DEPARTURE;
naRef comms = naNewVector(c);
// if we have an explicit type, return a simple vector of frequencies
naRef comms = naNewVector(c);
// if we have an explicit type, return a simple vector of frequencies
std::string commName = naStr_data(args[0]);
FGPositioned::Type commType = FGPositioned::typeFromName(commName);
std::string commName = naStr_data(args[0]);
FGPositioned::Type commType = FGPositioned::typeFromName(commName);
// set waypt flags - approach, departure, pseudo, etc
if (argc > argOffset) {
WayptFlag f = wayptFlagFromString(naStr_data(args[argOffset++]));
// set waypt flags - approach, departure, pseudo, etc
if (argc > argOffset) {
WayptFlag f = wayptFlagFromString(naStr_data(args[argOffset++]));
// set waypt flags - approach, departure, pseudo, etc
if (argc > 1) {
WayptFlag f = wayptFlagFromString(naStr_data(args[1]));
// set waypt flags - approach, departure, pseudo, etc
if (argc > 1) {
WayptFlag f = wayptFlagFromString(naStr_data(args[1]));
-
- if (argc < 2) {
- naRuntimeError(c, "bad arguments to leg.setSpeed");
- }
-
+
+ double speed = 0.0;
+ if ((argc < 2) || !convertToNum(args[0], speed))
+ naRuntimeError(c, "bad arguments to setSpeed");
+
- if (argc < 2) {
- naRuntimeError(c, "bad arguments to leg.setAltitude");
- }
-
+ double alt = 0.0;
+ if ((argc < 2) || !convertToNum(args[0], alt))
+ naRuntimeError(c, "bad arguments to leg.setAltitude");
+
hashset(c, airportPrototype, "runway", naNewFunc(c, naNewCCode(c, f_airport_runway)));
hashset(c, airportPrototype, "runwaysWithoutReciprocals", naNewFunc(c, naNewCCode(c, f_airport_runwaysWithoutReciprocals)));
hashset(c, airportPrototype, "runway", naNewFunc(c, naNewCCode(c, f_airport_runway)));
hashset(c, airportPrototype, "runwaysWithoutReciprocals", naNewFunc(c, naNewCCode(c, f_airport_runwaysWithoutReciprocals)));
hashset(c, airportPrototype, "tostring", naNewFunc(c, naNewCCode(c, f_airport_toString)));
flightplanPrototype = naNewHash(c);
hashset(c, airportPrototype, "tostring", naNewFunc(c, naNewCCode(c, f_airport_toString)));
flightplanPrototype = naNewHash(c);
hashset(c, flightplanPrototype, "getWP", naNewFunc(c, naNewCCode(c, f_flightplan_getWP)));
hashset(c, flightplanPrototype, "currentWP", naNewFunc(c, naNewCCode(c, f_flightplan_currentWP)));
hashset(c, flightplanPrototype, "getWP", naNewFunc(c, naNewCCode(c, f_flightplan_getWP)));
hashset(c, flightplanPrototype, "currentWP", naNewFunc(c, naNewCCode(c, f_flightplan_currentWP)));
hashset(c, flightplanPrototype, "finish", naNewFunc(c, naNewCCode(c, f_flightplan_finish)));
waypointPrototype = naNewHash(c);
hashset(c, flightplanPrototype, "finish", naNewFunc(c, naNewCCode(c, f_flightplan_finish)));
waypointPrototype = naNewHash(c);
hashset(c, waypointPrototype, "navaid", naNewFunc(c, naNewCCode(c, f_waypoint_navaid)));
hashset(c, waypointPrototype, "runway", naNewFunc(c, naNewCCode(c, f_waypoint_runway)));
hashset(c, waypointPrototype, "airport", naNewFunc(c, naNewCCode(c, f_waypoint_airport)));
procedurePrototype = naNewHash(c);
hashset(c, waypointPrototype, "navaid", naNewFunc(c, naNewCCode(c, f_waypoint_navaid)));
hashset(c, waypointPrototype, "runway", naNewFunc(c, naNewCCode(c, f_waypoint_runway)));
hashset(c, waypointPrototype, "airport", naNewFunc(c, naNewCCode(c, f_waypoint_airport)));
procedurePrototype = naNewHash(c);
hashset(c, procedurePrototype, "transition", naNewFunc(c, naNewCCode(c, f_procedure_transition)));
hashset(c, procedurePrototype, "route", naNewFunc(c, naNewCCode(c, f_procedure_route)));
fpLegPrototype = naNewHash(c);
hashset(c, procedurePrototype, "transition", naNewFunc(c, naNewCCode(c, f_procedure_transition)));
hashset(c, procedurePrototype, "route", naNewFunc(c, naNewCCode(c, f_procedure_route)));
fpLegPrototype = naNewHash(c);
hashset(c, fpLegPrototype, "setSpeed", naNewFunc(c, naNewCCode(c, f_leg_setSpeed)));
hashset(c, fpLegPrototype, "setAltitude", naNewFunc(c, naNewCCode(c, f_leg_setAltitude)));
hashset(c, fpLegPrototype, "path", naNewFunc(c, naNewCCode(c, f_leg_path)));
hashset(c, fpLegPrototype, "setSpeed", naNewFunc(c, naNewCCode(c, f_leg_setSpeed)));
hashset(c, fpLegPrototype, "setAltitude", naNewFunc(c, naNewCCode(c, f_leg_setAltitude)));
hashset(c, fpLegPrototype, "path", naNewFunc(c, naNewCCode(c, f_leg_path)));