39static JSBool
DockIsQueued(JSContext *context, uintN argc, jsval *vp);
42static JSBool
DockGetProperty(JSContext *context, JSObject *
this, jsid propID, jsval *value);
43static JSBool
DockSetProperty(JSContext *context, JSObject *
this, jsid propID, JSBool strict, jsval *value);
59 JSCLASS_NO_OPTIONAL_MEMBERS
109 if (outEntity == NULL)
return NO;
112 result = OOJSEntityGetEntity(context, dockObj, &entity);
113 if (!result)
return NO;
115 if (![entity isKindOfClass:[
DockEntity class]])
return NO;
131 if (outEntity == NULL)
return NO;
134 result = OOJSEntityGetEntity(context, shipObj, &entity);
135 if (!result)
return NO;
137 if (![entity isKindOfClass:[
ShipEntity class]])
return NO;
146@implementation DockEntity (OOJavaScriptExtensions)
148- (void)getJSClass:(JSClass **)outClass andPrototype:(JSObject **)outPrototype
163static JSBool
DockGetProperty(JSContext *context, JSObject *
this, jsid propID, jsval *value)
165 if (!JSID_IS_INT(propID))
return YES;
172 if (entity ==
nil) { *value = JSVAL_VOID;
return YES; }
174 switch (JSID_TO_INT(propID))
189 return JS_NewNumberValue(context, [entity countOfShipsInDockingQueue], value);
192 return JS_NewNumberValue(context, [entity countOfShipsInLaunchQueue], value);
203static JSBool
DockSetProperty(JSContext *context, JSObject *
this, jsid propID, JSBool strict, jsval *value)
205 if (!JSID_IS_INT(propID))
return YES;
214 if (entity ==
nil)
return YES;
216 switch (JSID_TO_INT(propID))
219 if (JS_ValueToBoolean(context, *value, &bValue))
227 if (JS_ValueToBoolean(context, *value, &bValue))
235 if (JS_ValueToBoolean(context, *value, &bValue))
static JSBool DockSetProperty(JSContext *context, JSObject *this, jsid propID, JSBool strict, jsval *value)
static JSClass sDockClass
static BOOL JSDockGetDockEntity(JSContext *context, JSObject *stationObj, DockEntity **outEntity)
void InitOOJSDock(JSContext *context, JSObject *global)
static JSPropertySpec sDockProperties[]
@ kDock_disallowedDockingCollides
@ kDock_launchingQueueLength
@ kDock_dockingQueueLength
static JSObject * sDockPrototype
static JSBool DockGetProperty(JSContext *context, JSObject *this, jsid propID, jsval *value)
static JSBool DockIsQueued(JSContext *context, uintN argc, jsval *vp)
static BOOL JSDockGetShipEntity(JSContext *context, JSObject *shipObj, ShipEntity **outEntity)
static JSFunctionSpec sDockMethods[]
#define OOJS_PROFILE_EXIT
#define OOJS_NATIVE_ENTER(cx)
#define OOJS_PROFILE_ENTER
JSObject * JSShipPrototype(void)
JSClass * JSShipClass(void)
#define OOJS_PROP_READWRITE_CB
void OOJSRegisterObjectConverter(JSClass *theClass, OOJSClassConverterCallback converter)
void OOJSObjectWrapperFinalize(JSContext *context, JSObject *this)
void OOJSReportBadPropertySelector(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec)
#define OOJS_RETURN_BOOL(v)
JSBool OOJSUnconstructableConstruct(JSContext *context, uintN argc, jsval *vp)
void OOJSRegisterSubclass(JSClass *subclass, JSClass *superclass)
OOINLINE jsval OOJSValueFromBOOL(int b) INLINE_CONST_FUNC
void OOJSReportBadPropertyValue(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec, jsval value)
id OOJSBasicPrivateObjectConverter(JSContext *context, JSObject *object)
void OOJSReportBadArguments(JSContext *context, NSString *scriptClass, NSString *function, uintN argc, jsval *argv, NSString *message, NSString *expectedArgsDescription)
#define OOJS_PROP_READONLY_CB
NSString * oo_jsClassName()
void setAllowsDocking:(BOOL allow)
void setDisallowedDockingCollides:(BOOL ddc)
BOOL shipIsInDockingQueue:(ShipEntity *ship)
void setAllowsLaunching:(BOOL allow)