Go to the source code of this file.
|
static JSBool | ManifestComment (JSContext *context, uintN argc, jsval *vp) |
|
static JSBool | ManifestSetComment (JSContext *context, uintN argc, jsval *vp) |
|
static JSBool | ManifestShortComment (JSContext *context, uintN argc, jsval *vp) |
|
static JSBool | ManifestSetShortComment (JSContext *context, uintN argc, jsval *vp) |
|
static JSBool | ManifestDeleteProperty (JSContext *context, JSObject *this, jsid propID, jsval *value) |
|
static JSBool | ManifestGetProperty (JSContext *context, JSObject *this, jsid propID, jsval *value) |
|
static JSBool | ManifestSetProperty (JSContext *context, JSObject *this, jsid propID, JSBool strict, jsval *value) |
|
void | InitOOJSManifest (JSContext *context, JSObject *global) |
|
◆ anonymous enum
◆ InitOOJSManifest()
void InitOOJSManifest |
( |
JSContext * | context, |
|
|
JSObject * | global ) |
Definition at line 129 of file OOJSManifest.m.
130{
133
134
137
138
139
141
142}
static JSObject * sManifestPrototype
static JSFunctionSpec sManifestMethods[]
static JSObject * sManifestObject
static JSClass sManifestClass
static JSPropertySpec sManifestProperties[]
JSObject * JSPlayerShipObject(void)
void OOJSRegisterObjectConverter(JSClass *theClass, OOJSClassConverterCallback converter)
JSBool OOJSUnconstructableConstruct(JSContext *context, uintN argc, jsval *vp)
#define OOJS_PROP_READONLY
id OOJSBasicPrivateObjectConverter(JSContext *context, JSObject *object)
References JSPlayerShipObject(), OOJS_PROP_READONLY, OOJSBasicPrivateObjectConverter(), OOJSRegisterObjectConverter(), OOJSUnconstructableConstruct(), sManifestClass, sManifestMethods, sManifestObject, sManifestProperties, and sManifestPrototype.
◆ ManifestComment()
static JSBool ManifestComment |
( |
JSContext * | context, |
|
|
uintN | argc, |
|
|
jsval * | vp ) |
|
static |
Definition at line 232 of file OOJSManifest.m.
233{
235
237 NSString * information =
nil;
238
239 if (argc > 0)
240 {
242 }
244 {
246 return NO;
247 }
248
249 information = [[PLAYER shipCommodityData] commentForGood:good];
250
252
254}
#define OOJS_NATIVE_ENTER(cx)
#define OOJS_RETURN_OBJECT(o)
NSString * OOStringFromJSValue(JSContext *context, jsval value)
void OOJSReportBadArguments(JSContext *context, NSString *scriptClass, NSString *function, uintN argc, jsval *argv, NSString *message, NSString *expectedArgsDescription)
NSString * OOCommodityType
References MIN, nil, OOJS_ARGV, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJS_RETURN_OBJECT, OOJSReportBadArguments(), and OOStringFromJSValue().
◆ ManifestDeleteProperty()
static JSBool ManifestDeleteProperty |
( |
JSContext * | context, |
|
|
JSObject * | this, |
|
|
jsid | propID, |
|
|
jsval * | value ) |
|
static |
Definition at line 145 of file OOJSManifest.m.
146{
147 jsval v = JSVAL_VOID;
149}
static JSBool ManifestSetProperty(JSContext *context, JSObject *this, jsid propID, JSBool strict, jsval *value)
References ManifestSetProperty().
◆ ManifestGetProperty()
static JSBool ManifestGetProperty |
( |
JSContext * | context, |
|
|
JSObject * | this, |
|
|
jsid | propID, |
|
|
jsval * | value ) |
|
static |
Definition at line 152 of file OOJSManifest.m.
153{
155
158
159 if (JSID_IS_INT(propID))
160 {
161 switch (JSID_TO_INT(propID))
162 {
165 break;
166
167 default:
169 return NO;
170 }
171 }
172 else if (JSID_IS_STRING(propID))
173 {
174
175
176
177
179 if ([[
UNIVERSE commodities] goodDefined:key])
180 {
181 *value = INT_TO_JSVAL([entity cargoQuantityForType:key]);
182 return YES;
183 }
184 else
185 {
186 return YES;
187 }
188 }
189
191 return YES;
192
194}
PlayerEntity * OOPlayerForScripting(void)
OOINLINE jsval OOJSValueFromNativeObject(JSContext *context, id object)
void OOJSReportBadPropertySelector(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec)
NSString * OOStringFromJSString(JSContext *context, JSString *string)
NSArray * cargoListForScripting()
References PlayerEntity::cargoListForScripting, kManifest_list, nil, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJSReportBadPropertySelector(), OOJSValueFromNativeObject(), OOPlayerForScripting(), OOStringFromJSString(), sManifestProperties, and UNIVERSE.
◆ ManifestSetComment()
static JSBool ManifestSetComment |
( |
JSContext * | context, |
|
|
uintN | argc, |
|
|
jsval * | vp ) |
|
static |
◆ ManifestSetProperty()
static JSBool ManifestSetProperty |
( |
JSContext * | context, |
|
|
JSObject * | this, |
|
|
jsid | propID, |
|
|
JSBool | strict, |
|
|
jsval * | value ) |
|
static |
Definition at line 197 of file OOJSManifest.m.
198{
200
202 int32 iValue;
203
204 if (JSID_IS_STRING(propID))
205 {
207
208 OOMassUnit unit = [[UNIVERSE commodityMarket] massUnitForGood:key];
209
210 if (unit ==
UNITS_TONS && [entity specialCargo])
211 {
212 OOJSReportWarning(context,
@"PlayerShip.manifest['foo'] - cannot modify cargo tonnage when Special Cargo is in use.");
213 return YES;
214 }
215
216 if (JS_ValueToInt32(context, *value, &iValue))
217 {
218 if (iValue < 0) iValue = 0;
220 }
221 else
222 {
224 }
225 }
226 return YES;
227
229}
void OOJSReportWarning(JSContext *context, NSString *format,...)
void OOJSReportBadPropertyValue(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec, jsval value)
OOCargoQuantity setCargoQuantityForType:amount:(OOCommodityType type,[amount] OOCargoQuantity amount)
References OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJSReportBadPropertyValue(), OOJSReportWarning(), OOPlayerForScripting(), OOStringFromJSString(), PlayerEntity::setCargoQuantityForType:amount:, sManifestProperties, and UNITS_TONS.
Referenced by ManifestDeleteProperty().
◆ ManifestSetShortComment()
static JSBool ManifestSetShortComment |
( |
JSContext * | context, |
|
|
uintN | argc, |
|
|
jsval * | vp ) |
|
static |
Definition at line 309 of file OOJSManifest.m.
310{
312
313 BOOL OK;
315 NSString * information =
nil;
316
317 if (argc > 1)
318 {
321 }
322 if (good ==
nil || information ==
nil)
323 {
325 return NO;
326 }
327
328 OK = [[PLAYER shipCommodityData] setShortComment:information forGood:good];
329
331
333}
◆ ManifestShortComment()
static JSBool ManifestShortComment |
( |
JSContext * | context, |
|
|
uintN | argc, |
|
|
jsval * | vp ) |
|
static |
◆ sManifestClass
Initial value:=
{
"Manifest",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
JSCLASS_NO_OPTIONAL_MEMBERS
}
static JSBool ManifestDeleteProperty(JSContext *context, JSObject *this, jsid propID, jsval *value)
static JSBool ManifestGetProperty(JSContext *context, JSObject *this, jsid propID, jsval *value)
void OOJSObjectWrapperFinalize(JSContext *context, JSObject *this)
Definition at line 50 of file OOJSManifest.m.
51{
52 "Manifest",
53 JSCLASS_HAS_PRIVATE,
54
55 JS_PropertyStub,
59 JS_EnumerateStub,
60 JS_ResolveStub,
61 JS_ConvertStub,
63 JSCLASS_NO_OPTIONAL_MEMBERS
64};
Referenced by InitOOJSManifest().
◆ sManifestMethods
JSFunctionSpec sManifestMethods[] |
|
static |
Initial value:=
{
{ 0 }
}
static JSBool ManifestShortComment(JSContext *context, uintN argc, jsval *vp)
static JSBool ManifestSetShortComment(JSContext *context, uintN argc, jsval *vp)
static JSBool ManifestComment(JSContext *context, uintN argc, jsval *vp)
static JSBool ManifestSetComment(JSContext *context, uintN argc, jsval *vp)
Definition at line 81 of file OOJSManifest.m.
Referenced by InitOOJSManifest().
◆ sManifestObject
JSObject* sManifestObject |
|
static |
◆ sManifestProperties
JSPropertySpec sManifestProperties[] |
|
static |
◆ sManifestPrototype
JSObject* sManifestPrototype |
|
static |