Oolite 1.91.0.7604-240417-a536cbe
Loading...
Searching...
No Matches
Enumerations | Functions | Variables
OOJSEquipmentInfo.m File Reference
import "OOJSEquipmentInfo.h"
import "OOJavaScriptEngine.h"
import "OOEquipmentType.h"
import "OOJSPlayer.h"
import "OODebugStandards.h"
+ Include dependency graph for OOJSEquipmentInfo.m:

Go to the source code of this file.

Enumerations

enum  {
  kEquipmentInfo_calculatedPrice , kEquipmentInfo_canBeDamaged , kEquipmentInfo_canCarryMultiple , kEquipmentInfo_damageProbability ,
  kEquipmentInfo_description , kEquipmentInfo_displayColor , kEquipmentInfo_effectiveTechLevel , kEquipmentInfo_equipmentKey ,
  kEquipmentInfo_fastAffinityDefensive , kEquipmentInfo_fastAffinityOffensive , kEquipmentInfo_defaultActivateKey , kEquipmentInfo_defaultModeKey ,
  kEquipmentInfo_incompatibleEquipment , kEquipmentInfo_isAvailableToAll , kEquipmentInfo_isAvailableToNPCs , kEquipmentInfo_isAvailableToPlayer ,
  kEquipmentInfo_isExternalStore , kEquipmentInfo_isPortableBetweenShips , kEquipmentInfo_isVisible , kEquipmentInfo_name ,
  kEquipmentInfo_price , kEquipmentInfo_provides , kEquipmentInfo_requiredCargoSpace , kEquipmentInfo_requiresAnyEquipment ,
  kEquipmentInfo_requiresCleanLegalRecord , kEquipmentInfo_requiresEmptyPylon , kEquipmentInfo_requiresEquipment , kEquipmentInfo_requiresFreePassengerBerth ,
  kEquipmentInfo_requiresFullFuel , kEquipmentInfo_requiresMountedPylon , kEquipmentInfo_requiresNonCleanLegalRecord , kEquipmentInfo_requiresNonFullFuel ,
  kEquipmentInfo_scriptInfo , kEquipmentInfo_scriptName , kEquipmentInfo_techLevel , kEquipmentInfo_weaponInfo
}
 

Functions

static JSBool EquipmentInfoGetProperty (JSContext *context, JSObject *this, jsid propID, jsval *value)
 
static JSBool EquipmentInfoSetProperty (JSContext *context, JSObject *this, jsid propID, JSBool strict, jsval *value)
 
static JSBool EquipmentInfoGetAllEqipment (JSContext *context, JSObject *this, jsid propID, jsval *value)
 
static JSBool EquipmentInfoStaticInfoForKey (JSContext *context, uintN argc, jsval *vp)
 
 DEFINE_JS_OBJECT_GETTER (JSEquipmentInfoGetEquipmentType, &sEquipmentInfoClass, sEquipmentInfoPrototype, OOEquipmentType)
 
void InitOOJSEquipmentInfo (JSContext *context, JSObject *global)
 
OOEquipmentTypeJSValueToEquipmentType (JSContext *context, jsval value)
 
NSString * JSValueToEquipmentKey (JSContext *context, jsval value)
 
NSString * JSValueToEquipmentKeyRelaxed (JSContext *context, jsval value, BOOL *outExists)
 

Variables

static JSObject * sEquipmentInfoPrototype
 
static JSPropertySpec sEquipmentInfoProperties []
 
static JSPropertySpec sEquipmentInfoStaticProperties []
 
static JSFunctionSpec sEquipmentInfoMethods []
 
static JSFunctionSpec sEquipmentInfoStaticMethods []
 
static JSClass sEquipmentInfoClass
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kEquipmentInfo_calculatedPrice 
kEquipmentInfo_canBeDamaged 
kEquipmentInfo_canCarryMultiple 
kEquipmentInfo_damageProbability 
kEquipmentInfo_description 
kEquipmentInfo_displayColor 
kEquipmentInfo_effectiveTechLevel 
kEquipmentInfo_equipmentKey 
kEquipmentInfo_fastAffinityDefensive 
kEquipmentInfo_fastAffinityOffensive 
kEquipmentInfo_defaultActivateKey 
kEquipmentInfo_defaultModeKey 
kEquipmentInfo_incompatibleEquipment 
kEquipmentInfo_isAvailableToAll 
kEquipmentInfo_isAvailableToNPCs 
kEquipmentInfo_isAvailableToPlayer 
kEquipmentInfo_isExternalStore 
kEquipmentInfo_isPortableBetweenShips 
kEquipmentInfo_isVisible 
kEquipmentInfo_name 
kEquipmentInfo_price 
kEquipmentInfo_provides 
kEquipmentInfo_requiredCargoSpace 
kEquipmentInfo_requiresAnyEquipment 
kEquipmentInfo_requiresCleanLegalRecord 
kEquipmentInfo_requiresEmptyPylon 
kEquipmentInfo_requiresEquipment 
kEquipmentInfo_requiresFreePassengerBerth 
kEquipmentInfo_requiresFullFuel 
kEquipmentInfo_requiresMountedPylon 
kEquipmentInfo_requiresNonCleanLegalRecord 
kEquipmentInfo_requiresNonFullFuel 
kEquipmentInfo_scriptInfo 
kEquipmentInfo_scriptName 
kEquipmentInfo_techLevel 
kEquipmentInfo_weaponInfo 

Definition at line 45 of file OOJSEquipmentInfo.m.

46{
47 // Property IDs
64 kEquipmentInfo_isExternalStore, // is missile or mine
80 kEquipmentInfo_scriptInfo, // arbitrary data for scripts, dictionary, read-only
84};
@ kEquipmentInfo_defaultActivateKey
@ kEquipmentInfo_requiresAnyEquipment
@ kEquipmentInfo_canCarryMultiple
@ kEquipmentInfo_calculatedPrice
@ kEquipmentInfo_weaponInfo
@ kEquipmentInfo_effectiveTechLevel
@ kEquipmentInfo_requiresEquipment
@ kEquipmentInfo_equipmentKey
@ kEquipmentInfo_displayColor
@ kEquipmentInfo_isAvailableToAll
@ kEquipmentInfo_requiresFreePassengerBerth
@ kEquipmentInfo_damageProbability
@ kEquipmentInfo_requiresCleanLegalRecord
@ kEquipmentInfo_isVisible
@ kEquipmentInfo_isPortableBetweenShips
@ kEquipmentInfo_defaultModeKey
@ kEquipmentInfo_name
@ kEquipmentInfo_price
@ kEquipmentInfo_fastAffinityDefensive
@ kEquipmentInfo_isExternalStore
@ kEquipmentInfo_isAvailableToPlayer
@ kEquipmentInfo_canBeDamaged
@ kEquipmentInfo_description
@ kEquipmentInfo_techLevel
@ kEquipmentInfo_scriptName
@ kEquipmentInfo_scriptInfo
@ kEquipmentInfo_provides
@ kEquipmentInfo_requiresFullFuel
@ kEquipmentInfo_requiresNonFullFuel
@ kEquipmentInfo_requiredCargoSpace
@ kEquipmentInfo_isAvailableToNPCs
@ kEquipmentInfo_incompatibleEquipment
@ kEquipmentInfo_requiresNonCleanLegalRecord
@ kEquipmentInfo_requiresMountedPylon
@ kEquipmentInfo_requiresEmptyPylon
@ kEquipmentInfo_fastAffinityOffensive

Function Documentation

◆ DEFINE_JS_OBJECT_GETTER()

DEFINE_JS_OBJECT_GETTER ( JSEquipmentInfoGetEquipmentType ,
& sEquipmentInfoClass,
sEquipmentInfoPrototype ,
OOEquipmentType  )

◆ EquipmentInfoGetAllEqipment()

static JSBool EquipmentInfoGetAllEqipment ( JSContext * context,
JSObject * this,
jsid propID,
jsval * value )
static

Definition at line 485 of file OOJSEquipmentInfo.m.

486{
487 OOJS_NATIVE_ENTER(context)
488
489 *value = OOJSValueFromNativeObject(context, [OOEquipmentType allEquipmentTypes]);
490 return YES;
491
493}
#define OOJS_NATIVE_ENTER(cx)
#define OOJS_NATIVE_EXIT
OOINLINE jsval OOJSValueFromNativeObject(JSContext *context, id object)

References OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, and OOJSValueFromNativeObject().

+ Here is the call graph for this function:

◆ EquipmentInfoGetProperty()

static JSBool EquipmentInfoGetProperty ( JSContext * context,
JSObject * this,
jsid propID,
jsval * value )
static

Definition at line 245 of file OOJSEquipmentInfo.m.

246{
247 if (!JSID_IS_INT(propID)) return YES;
248
249 OOJS_NATIVE_ENTER(context)
250
251 OOEquipmentType *eqType = nil;
252 id result = nil;
253
254 if (EXPECT_NOT(!JSEquipmentInfoGetEquipmentType(context, this, &eqType))) return NO;
255
256 switch (JSID_TO_INT(propID))
257 {
259 result = [eqType identifier];
260 break;
261
263 result = [eqType name];
264 break;
265
267 if ([[eqType identifier] isEqual:@"EQ_FUEL"])
268 {
269 return JS_NewNumberValue(context, (PLAYER_MAX_FUEL - [OOPlayerForScripting() fuel]) * [eqType price] * [OOPlayerForScripting() fuelChargeRate], value);
270 }
271 else if ([[eqType identifier] isEqual:@"EQ_RENOVATION"])
272 {
273 return JS_NewNumberValue(context, [OOPlayerForScripting() renovationCosts], value);
274 }
275 else
276 {
277 return JS_NewNumberValue(context, [OOPlayerForScripting() adjustPriceByScriptForEqKey:[eqType identifier] withCurrent:[eqType price]], value);
278 }
280 *value = OOJSValueFromBOOL([eqType canCarryMultiple]);
281 return YES;
282
284 *value = OOJSValueFromBOOL([eqType canBeDamaged]);
285 return YES;
286
288 result = [eqType descriptiveText];
289 break;
290
292 return JS_NewNumberValue(context, [eqType damageProbability], value);
293
295 result = [[eqType displayColor] normalizedArray];
296 break;
297
299 *value = OOJSValueFromBOOL([eqType fastAffinityDefensive]);
300 return YES;
301
303 *value = OOJSValueFromBOOL([eqType fastAffinityOffensive]);
304 return YES;
305
307 result = [eqType defaultActivateKey];
308 break;
309
311 result = [eqType defaultModeKey];
312 break;
313
315 *value = INT_TO_JSVAL((int32_t)[eqType techLevel]);
316 return YES;
317
319 *value = INT_TO_JSVAL((int32_t)[eqType effectiveTechLevel]);
320 return YES;
321
323 return JS_NewNumberValue(context, [eqType price], value);
324
326 result = [eqType providesForScripting];
327 break;
328
330 *value = OOJSValueFromBOOL([eqType isAvailableToAll]);
331 return YES;
332
334 *value = OOJSValueFromBOOL([eqType isAvailableToNPCs]);
335 return YES;
336
338 *value = OOJSValueFromBOOL([eqType isAvailableToPlayer]);
339 return YES;
340
342 *value = OOJSValueFromBOOL([eqType requiresEmptyPylon]);
343 return YES;
344
346 *value = OOJSValueFromBOOL([eqType requiresMountedPylon]);
347 return YES;
348
350 *value = OOJSValueFromBOOL([eqType requiresCleanLegalRecord]);
351 return YES;
352
354 *value = OOJSValueFromBOOL([eqType requiresNonCleanLegalRecord]);
355 return YES;
356
358 *value = OOJSValueFromBOOL([eqType requiresFreePassengerBerth]);
359 return YES;
360
362 *value = OOJSValueFromBOOL([eqType requiresFullFuel]);
363 return YES;
364
366 *value = OOJSValueFromBOOL([eqType requiresNonFullFuel]);
367 return YES;
368
370 *value = OOJSValueFromBOOL([eqType isMissileOrMine]);
371 return YES;
372
374 *value = OOJSValueFromBOOL([eqType isPortableBetweenShips]);
375 return YES;
376
378 *value = OOJSValueFromBOOL([eqType isVisible]);
379 return YES;
380
382 *value = INT_TO_JSVAL((int32_t)[eqType requiredCargoSpace]);
383 return YES;
384
386 result = [[eqType requiresEquipment] allObjects];
387 break;
388
390 result = [[eqType requiresAnyEquipment] allObjects];
391 break;
392
394 result = [[eqType incompatibleEquipment] allObjects];
395 break;
396
398 result = [eqType scriptInfo];
399 if (result == nil) result = [NSDictionary dictionary]; // empty rather than null
400 break;
401
403 result = [eqType scriptName];
404 if (result == nil) result = @"";
405 break;
406
408 result = [eqType weaponInfo];
409 if (result == nil) result = [NSDictionary dictionary]; // empty rather than null
410 break;
411
412 default:
414 return NO;
415 }
416
417 *value = OOJSValueFromNativeObject(context, result);
418 return YES;
419
421}
#define EXPECT_NOT(x)
static JSPropertySpec sEquipmentInfoProperties[]
PlayerEntity * OOPlayerForScripting(void)
Definition OOJSPlayer.m:191
void OOJSReportBadPropertySelector(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec)
OOINLINE jsval OOJSValueFromBOOL(int b) INLINE_CONST_FUNC
return nil
#define PLAYER_MAX_FUEL
NSArray * normalizedArray()
Definition OOColor.m:511
NSDictionary * weaponInfo()
NSString * scriptName()
NSSet * incompatibleEquipment()
NSDictionary * scriptInfo()
OOColor * displayColor()
NSArray * defaultActivateKey()
NSArray * defaultModeKey()
NSSet * requiresEquipment()
NSSet * requiresAnyEquipment()
NSArray * providesForScripting()
NSString * identifier()
NSString * descriptiveText()

References OOEquipmentType::defaultActivateKey, OOEquipmentType::defaultModeKey, OOEquipmentType::descriptiveText, OOEquipmentType::displayColor, EXPECT_NOT, OOEquipmentType::identifier, OOEquipmentType::incompatibleEquipment, kEquipmentInfo_calculatedPrice, kEquipmentInfo_canBeDamaged, kEquipmentInfo_canCarryMultiple, kEquipmentInfo_damageProbability, kEquipmentInfo_defaultActivateKey, kEquipmentInfo_defaultModeKey, kEquipmentInfo_description, kEquipmentInfo_displayColor, kEquipmentInfo_effectiveTechLevel, kEquipmentInfo_equipmentKey, kEquipmentInfo_fastAffinityDefensive, kEquipmentInfo_fastAffinityOffensive, kEquipmentInfo_incompatibleEquipment, kEquipmentInfo_isAvailableToAll, kEquipmentInfo_isAvailableToNPCs, kEquipmentInfo_isAvailableToPlayer, kEquipmentInfo_isExternalStore, kEquipmentInfo_isPortableBetweenShips, kEquipmentInfo_isVisible, kEquipmentInfo_name, kEquipmentInfo_price, kEquipmentInfo_provides, kEquipmentInfo_requiredCargoSpace, kEquipmentInfo_requiresAnyEquipment, kEquipmentInfo_requiresCleanLegalRecord, kEquipmentInfo_requiresEmptyPylon, kEquipmentInfo_requiresEquipment, kEquipmentInfo_requiresFreePassengerBerth, kEquipmentInfo_requiresFullFuel, kEquipmentInfo_requiresMountedPylon, kEquipmentInfo_requiresNonCleanLegalRecord, kEquipmentInfo_requiresNonFullFuel, kEquipmentInfo_scriptInfo, kEquipmentInfo_scriptName, kEquipmentInfo_techLevel, kEquipmentInfo_weaponInfo, OOEquipmentType::name, nil, OOColor::normalizedArray, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJSReportBadPropertySelector(), OOJSValueFromBOOL(), OOJSValueFromNativeObject(), OOPlayerForScripting(), PLAYER_MAX_FUEL, OOEquipmentType::price, OOEquipmentType::providesForScripting, OOEquipmentType::requiresAnyEquipment, OOEquipmentType::requiresEquipment, OOEquipmentType::scriptInfo, OOEquipmentType::scriptName, sEquipmentInfoProperties, and OOEquipmentType::weaponInfo.

+ Here is the call graph for this function:

◆ EquipmentInfoSetProperty()

static JSBool EquipmentInfoSetProperty ( JSContext * context,
JSObject * this,
jsid propID,
JSBool strict,
jsval * value )
static

Definition at line 424 of file OOJSEquipmentInfo.m.

425{
426 if (!JSID_IS_INT(propID)) return YES;
427
428 OOJS_NATIVE_ENTER(context)
429
430 OOEquipmentType *eqType = nil;
431 int32 iValue;
432 OOColor *colorForScript = nil;
433
434 if (EXPECT_NOT(!JSEquipmentInfoGetEquipmentType(context, this, &eqType))) return NO;
435
436 switch (JSID_TO_INT(propID))
437 {
439 colorForScript = [OOColor colorWithDescription:OOJSNativeObjectFromJSValue(context, *value)];
440 if (colorForScript != nil || JSVAL_IS_NULL(*value))
441 {
442 [eqType setDisplayColor:colorForScript];
443 return YES;
444 }
445 break;
447 OOStandardsDeprecated([NSString stringWithFormat:@"TL99 for variable tech level is deprecated for %@",[eqType identifier]]);
448 if (!OOEnforceStandards() && [eqType techLevel] == kOOVariableTechLevel)
449 {
450 if (JSVAL_IS_NULL(*value))
451 {
452 // reset mission variable
453 [OOPlayerForScripting() setMissionVariable:nil
454 forKey:[@"mission_TL_FOR_" stringByAppendingString:[eqType identifier]]];
455 return YES;
456 }
457 if (JS_ValueToInt32(context, *value, &iValue))
458 {
459 if (iValue < 0) iValue = 0;
460 if (15 < iValue && iValue != kOOVariableTechLevel) iValue = 15;
461 [OOPlayerForScripting() setMissionVariable:[NSString stringWithFormat:@"%u", iValue]
462 forKey:[@"mission_TL_FOR_" stringByAppendingString:[eqType identifier]]];
463 return YES;
464 }
465 }
466 else
467 {
468 OOJSReportWarning(context, @"Cannot modify effective tech level for %@, because its base tech level is not 99.", [eqType identifier]);
469 return YES;
470 }
471 break;
472
473 default:
475 return NO;
476 }
477
478 OOJSReportBadPropertyValue(context, this, propID, sEquipmentInfoProperties, *value);
479 return NO;
480
482}
void OOStandardsDeprecated(NSString *message)
BOOL OOEnforceStandards(void)
void OOJSReportWarning(JSContext *context, NSString *format,...)
void OOJSReportBadPropertyValue(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec, jsval value)
@ kOOVariableTechLevel
Definition OOTypes.h:202
OOColor * colorWithDescription:(id description)
Definition OOColor.m:127
void setDisplayColor:(OOColor *newColor)

References OOColor::colorWithDescription:, EXPECT_NOT, OOEquipmentType::identifier, kEquipmentInfo_displayColor, kEquipmentInfo_effectiveTechLevel, kOOVariableTechLevel, nil, OOEnforceStandards(), OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJSReportBadPropertySelector(), OOJSReportBadPropertyValue(), OOJSReportWarning(), OOStandardsDeprecated(), sEquipmentInfoProperties, OOEquipmentType::setDisplayColor:, and OOEquipmentType::techLevel.

+ Here is the call graph for this function:

◆ EquipmentInfoStaticInfoForKey()

static JSBool EquipmentInfoStaticInfoForKey ( JSContext * context,
uintN argc,
jsval * vp )
static

Definition at line 530 of file OOJSEquipmentInfo.m.

531{
532 OOJS_NATIVE_ENTER(context)
533
534 NSString *key = nil;
535
536 if (argc > 0) key = OOStringFromJSValue(context, OOJS_ARGV[0]);
537 if (key == nil)
538 {
539 OOJSReportBadArguments(context, @"EquipmentInfo", @"infoForKey", MIN(argc, 1U), OOJS_ARGV, nil, @"string");
540 return NO;
541 }
542
543 OOJS_RETURN_OBJECT([OOEquipmentType equipmentTypeWithIdentifier:key]);
544
546}
#define OOJS_RETURN_OBJECT(o)
NSString * OOStringFromJSValue(JSContext *context, jsval value)
#define OOJS_ARGV
void OOJSReportBadArguments(JSContext *context, NSString *scriptClass, NSString *function, uintN argc, jsval *argv, NSString *message, NSString *expectedArgsDescription)
#define MIN(A, B)
Definition OOMaths.h:111

◆ InitOOJSEquipmentInfo()

void InitOOJSEquipmentInfo ( JSContext * context,
JSObject * global )

Definition at line 175 of file OOJSEquipmentInfo.m.

176{
178
180}
static JSObject * sEquipmentInfoPrototype
static JSClass sEquipmentInfoClass
static JSFunctionSpec sEquipmentInfoMethods[]
static JSFunctionSpec sEquipmentInfoStaticMethods[]
static JSPropertySpec sEquipmentInfoStaticProperties[]
void OOJSRegisterObjectConverter(JSClass *theClass, OOJSClassConverterCallback converter)
JSBool OOJSUnconstructableConstruct(JSContext *context, uintN argc, jsval *vp)
id OOJSBasicPrivateObjectConverter(JSContext *context, JSObject *object)

References OOJSBasicPrivateObjectConverter(), OOJSRegisterObjectConverter(), OOJSUnconstructableConstruct(), sEquipmentInfoClass, sEquipmentInfoMethods, sEquipmentInfoProperties, sEquipmentInfoPrototype, sEquipmentInfoStaticMethods, and sEquipmentInfoStaticProperties.

+ Here is the call graph for this function:

◆ JSValueToEquipmentKey()

NSString * JSValueToEquipmentKey ( JSContext * context,
jsval value )

Definition at line 204 of file OOJSEquipmentInfo.m.

205{
206 return [JSValueToEquipmentType(context, value) identifier];
207}

Referenced by PlayerShipAwardEquipmentToCurrentPylon(), ShipEquipmentStatus(), and ShipRemoveEquipment().

+ Here is the caller graph for this function:

◆ JSValueToEquipmentKeyRelaxed()

NSString * JSValueToEquipmentKeyRelaxed ( JSContext * context,
jsval value,
BOOL * outExists )

Definition at line 210 of file OOJSEquipmentInfo.m.

211{
213
214 NSString *result = nil;
215 BOOL exists = NO;
216 id objValue = OOJSNativeObjectFromJSValue(context, value);
217
218 if ([objValue isKindOfClass:[OOEquipmentType class]])
219 {
220 result = [objValue identifier];
221 exists = YES;
222 }
223 else if ([objValue isKindOfClass:[NSString class]])
224 {
225 /* To enforce deliberate backwards incompatibility, reject strings
226 ending with _DAMAGED unless someone actually named an equip that
227 way.
228 */
229 exists = [OOEquipmentType equipmentTypeWithIdentifier:objValue] != nil;
230 if (exists || ![objValue hasSuffix:@"_DAMAGED"])
231 {
232 result = objValue;
233 }
234 }
235
236 if (outExists != NULL) *outExists = exists;
237 return result;
238
240}
#define OOJS_PROFILE_EXIT
#define OOJS_PROFILE_ENTER
id OOJSNativeObjectFromJSValue(JSContext *context, jsval value)
OOEquipmentType * equipmentTypeWithIdentifier:(NSString *identifier)

References OOEquipmentType::equipmentTypeWithIdentifier:, nil, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, and OOJSNativeObjectFromJSValue().

Referenced by PlayerShipSetProperty(), ShipCanAwardEquipment(), and ShipSetProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ JSValueToEquipmentType()

OOEquipmentType * JSValueToEquipmentType ( JSContext * context,
jsval value )

Definition at line 183 of file OOJSEquipmentInfo.m.

184{
186
187 if (JSVAL_IS_OBJECT(value))
188 {
189 JSObject *object = JSVAL_TO_OBJECT(value);
190 if (JS_InstanceOf(context, JSVAL_TO_OBJECT(value), &sEquipmentInfoClass, NULL))
191 {
192 return (OOEquipmentType *)JS_GetPrivate(context, object);
193 }
194 }
195
196 NSString *string = OOStringFromJSValue(context, value);
197 if (string != nil) return [OOEquipmentType equipmentTypeWithIdentifier:string];
198 return nil;
199
201}

References OOEquipmentType::equipmentTypeWithIdentifier:, nil, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOStringFromJSValue(), and sEquipmentInfoClass.

Referenced by ShipAwardEquipment(), and ShipSetEquipmentStatus().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ sEquipmentInfoClass

JSClass sEquipmentInfoClass
static
Initial value:
=
{
"EquipmentInfo",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
JSCLASS_NO_OPTIONAL_MEMBERS
}
static JSBool EquipmentInfoGetProperty(JSContext *context, JSObject *this, jsid propID, jsval *value)
static JSBool EquipmentInfoSetProperty(JSContext *context, JSObject *this, jsid propID, JSBool strict, jsval *value)
void OOJSObjectWrapperFinalize(JSContext *context, JSObject *this)

Definition at line 153 of file OOJSEquipmentInfo.m.

154{
155 "EquipmentInfo",
156 JSCLASS_HAS_PRIVATE,
157
158 JS_PropertyStub, // addProperty
159 JS_PropertyStub, // delProperty
160 EquipmentInfoGetProperty, // getProperty
161 EquipmentInfoSetProperty, // setProperty
162 JS_EnumerateStub, // enumerate
163 JS_ResolveStub, // resolve
164 JS_ConvertStub, // convert
165 OOJSObjectWrapperFinalize, // finalize
166 JSCLASS_NO_OPTIONAL_MEMBERS
167};

Referenced by InitOOJSEquipmentInfo(), and JSValueToEquipmentType().

◆ sEquipmentInfoMethods

JSFunctionSpec sEquipmentInfoMethods[]
static
Initial value:
=
{
{ "toString", OOJSObjectWrapperToString, 0 },
{ 0 }
}
JSBool OOJSObjectWrapperToString(JSContext *context, uintN argc, jsval *vp)

Definition at line 137 of file OOJSEquipmentInfo.m.

138{
139 // JS name Function min args
140 { "toString", OOJSObjectWrapperToString, 0 },
141 { 0 }
142};

Referenced by InitOOJSEquipmentInfo().

◆ sEquipmentInfoProperties

JSPropertySpec sEquipmentInfoProperties[]
static

Definition at line 87 of file OOJSEquipmentInfo.m.

88{
89 // JS name ID flags
114 { "requiresCleanLegalRecord", kEquipmentInfo_requiresCleanLegalRecord, OOJS_PROP_READONLY_CB },
117 { "requiresFreePassengerBerth", kEquipmentInfo_requiresFreePassengerBerth, OOJS_PROP_READONLY_CB },
120 { "requiresNonCleanLegalRecord", kEquipmentInfo_requiresNonCleanLegalRecord, OOJS_PROP_READONLY_CB },
126 { 0 }
127};
#define OOJS_PROP_READWRITE_CB
#define OOJS_PROP_READONLY_CB

Referenced by EquipmentInfoGetProperty(), EquipmentInfoSetProperty(), and InitOOJSEquipmentInfo().

◆ sEquipmentInfoPrototype

JSObject* sEquipmentInfoPrototype
static

Definition at line 32 of file OOJSEquipmentInfo.m.

Referenced by InitOOJSEquipmentInfo().

◆ sEquipmentInfoStaticMethods

JSFunctionSpec sEquipmentInfoStaticMethods[]
static
Initial value:
=
{
{ "infoForKey", EquipmentInfoStaticInfoForKey, 0 },
{ 0 }
}
static JSBool EquipmentInfoStaticInfoForKey(JSContext *context, uintN argc, jsval *vp)

Definition at line 145 of file OOJSEquipmentInfo.m.

146{
147 // JS name Function min args
148 { "infoForKey", EquipmentInfoStaticInfoForKey, 0 },
149 { 0 }
150};

Referenced by InitOOJSEquipmentInfo().

◆ sEquipmentInfoStaticProperties

JSPropertySpec sEquipmentInfoStaticProperties[]
static
Initial value:
=
{
{ 0 }
}
static JSBool EquipmentInfoGetAllEqipment(JSContext *context, JSObject *this, jsid propID, jsval *value)

Definition at line 130 of file OOJSEquipmentInfo.m.

131{
133 { 0 }
134};

Referenced by InitOOJSEquipmentInfo().