]> git.mxchange.org Git - simgear.git/blobdiff - simgear/nasal/misc.c
Fix Windows build (hopefully)
[simgear.git] / simgear / nasal / misc.c
index 5a531d536d7d2a0cd0bccfb1c92a2323c8cbeb18..0a5c861597dfc85e08e1b3e2aaee40bc6a8e72ed 100644 (file)
@@ -143,10 +143,11 @@ naRef naNewGhost(naContext c, naGhostType* type, void* ptr)
     // ensure 'simple' ghost users don't see garbage for these fields
     type->get_member = 0;
     type->set_member = 0;
-    
+
     ghost = naNew(c, T_GHOST);
     PTR(ghost).ghost->gtype = type;
     PTR(ghost).ghost->ptr = ptr;
+    PTR(ghost).ghost->data = naNil();
     return ghost;
 }
 
@@ -155,6 +156,7 @@ naRef naNewGhost2(naContext c, naGhostType* t, void* ptr)
     naRef ghost = naNew(c, T_GHOST);
     PTR(ghost).ghost->gtype = t;
     PTR(ghost).ghost->ptr = ptr;
+    PTR(ghost).ghost->data = naNil();
     return ghost;
 }
 
@@ -170,9 +172,21 @@ void* naGhost_ptr(naRef ghost)
     return PTR(ghost).ghost->ptr;
 }
 
+void naGhost_setData(naRef ghost, naRef data)
+{
+    if(IS_GHOST(ghost))
+        PTR(ghost).ghost->data = data;
+}
+
+naRef naGhost_data(naRef ghost)
+{
+    if(!IS_GHOST(ghost)) return naNil();
+    return PTR(ghost).ghost->data;
+}
+
 naRef naNil()
 {
-    naRef r; 
+    naRef r;
     SETPTR(r, 0);
     return r;
 }