#include <Autopilot/route_mgr.hxx>
#include <Navaids/procedure.hxx>
-static void sgrefGhostDestroy(void* g);
-naGhostType PositionedGhostType = { sgrefGhostDestroy, "positioned" };
-naGhostType WayptGhostType = { sgrefGhostDestroy, "waypoint" };
+static void positionedGhostDestroy(void* g);
+static void wayptGhostDestroy(void* g);
+naGhostType PositionedGhostType = { positionedGhostDestroy, "positioned" };
+naGhostType WayptGhostType = { wayptGhostDestroy, "waypoint" };
static void hashset(naContext c, naRef hash, const char* key, naRef val)
{
return 0;
}
+static void positionedGhostDestroy(void* g)
+{
+ FGPositioned* pos = (FGPositioned*)g;
+ if (!FGPositioned::put(pos)) // unref
+ delete pos;
+}
+
static flightgear::Waypt* wayptGhost(naRef r)
{
if (naGhost_type(r) == &WayptGhostType)
return 0;
}
-static void sgrefGhostDestroy(void* g)
+static void wayptGhostDestroy(void* g)
{
- SGReferenced* ref = (SGReferenced*)g;
- SGReferenced::put(ref); // unref
+ flightgear::Waypt* wpt = (flightgear::Waypt*)g;
+ if (!flightgear::Waypt::put(wpt)) // unref
+ delete wpt;
}
static naRef airportPrototype;
return naNil();
}
- SGReferenced::get(pos); // take a ref
+ FGPositioned::get(pos); // take a ref
return naNewGhost(c, &PositionedGhostType, (void*) pos);
}
return naNil();
}
- SGReferenced::get(wpt); // take a ref
+ flightgear::Waypt::get(wpt); // take a ref
return naNewGhost(c, &WayptGhostType, (void*) wpt);
}