Oolite
Loading...
Searching...
No Matches
OOEquipmentType Class Reference

#include <OOEquipmentType.h>

Inheritance diagram for OOEquipmentType:
Collaboration diagram for OOEquipmentType:

Instance Methods

(NSString *) - identifier
(NSString *) - damagedIdentifier
(NSString *) - name
(NSString *) - descriptiveText
(OOTechLevelID) - techLevel
(OOCreditsQuantity) - price
(BOOL) - isAvailableToAll
(BOOL) - requiresEmptyPylon
(BOOL) - requiresMountedPylon
(BOOL) - requiresCleanLegalRecord
(BOOL) - requiresNonCleanLegalRecord
(BOOL) - requiresFreePassengerBerth
(BOOL) - requiresFullFuel
(BOOL) - requiresNonFullFuel
(BOOL) - isPrimaryWeapon
(BOOL) - isMissileOrMine
(BOOL) - isPortableBetweenShips
(BOOL) - canCarryMultiple
(GLfloat) - damageProbability
(BOOL) - canBeDamaged
(BOOL) - isVisible
(BOOL) - hideValues
(OOColor *) - displayColor
(void) - setDisplayColor:
(BOOL) - isAvailableToPlayer
(BOOL) - isAvailableToNPCs
(OOCargoQuantity) - requiredCargoSpace
(NSSet *) - requiresEquipment
(NSSet *) - requiresAnyEquipment
(NSSet *) - incompatibleEquipment
(NSArray *) - conditions
(NSString *) - conditionScript
(NSDictionary *) - scriptInfo
(NSString *) - scriptName
(BOOL) - fastAffinityDefensive
(BOOL) - fastAffinityOffensive
(NSArray *) - defaultActivateKey
(NSArray *) - defaultModeKey
(NSUInteger) - installTime
(NSUInteger) - repairTime
(NSArray *) - providesForScripting
(BOOL) - provides:
(BOOL) - isTurretLaser
(BOOL) - isMiningLaser
(NSDictionary *) - weaponInfo
(GLfloat) - weaponRange
(GLfloat) - weaponEnergyUse
(GLfloat) - weaponDamage
(GLfloat) - weaponRechargeRate
(GLfloat) - weaponShotTemperature
(GLfloat) - weaponThreatAssessment
(OOColor *) - weaponColor
(NSString *) - fxShotMissName
(NSString *) - fxShotHitName
(NSString *) - fxShieldHitName
(NSString *) - fxUnshieldedHitName
(NSString *) - fxWeaponLaunchedName
(id) - initWithInfo: [implementation]
(void) - dealloc [implementation]
(id) - copyWithZone: [implementation]
(NSString *) - descriptionComponents [implementation]
(BOOL) - suppressClangStuff [implementation]
(OOTechLevelID) - effectiveTechLevel
(jsval) - oo_jsValueInContext: [implementation]
(NSString *) - oo_jsClassName [implementation]
(void) - oo_clearJSSelf: [implementation]
(void) - oo_clearJSSelf: [implementation]

Class Methods

(void) + loadEquipment
(void) + addEquipmentWithInfo:
(NSString *) + getMissileRegistryRoleForShip:
(void) + setMissileRegistryRole:forShip:
(NSArray *) + allEquipmentTypes
(NSEnumerator *) + equipmentEnumerator
(NSEnumerator *) + reverseEquipmentEnumerator
(NSEnumerator *) + equipmentEnumeratorOutfitting
(OOEquipmentType *) + equipmentTypeWithIdentifier:

Private Attributes

OOTechLevelID _techLevel
OOCreditsQuantity _price
NSString * _name
NSString * _identifier
NSString * _description
unsigned _isAvailableToAll: 1
unsigned _requiresEmptyPylon: 1
unsigned _requiresMountedPylon: 1
unsigned _requiresClean: 1
unsigned _requiresNotClean: 1
unsigned _portableBetweenShips: 1
unsigned _requiresFreePassengerBerth: 1
unsigned _requiresFullFuel: 1
unsigned _requiresNonFullFuel: 1
unsigned _isMissileOrMine: 1
unsigned _isVisible: 1
unsigned _isAvailableToPlayer: 1
unsigned _isAvailableToNPCs: 1
unsigned _fastAffinityA: 1
unsigned _fastAffinityB: 1
unsigned _canCarryMultiple: 1
unsigned _hideValues: 1
OOColor * _displayColor
NSUInteger _installTime
NSUInteger _repairTime
GLfloat _damageProbability
OOCargoQuantity _requiredCargoSpace
NSSet * _requiresEquipment
NSSet * _requiresAnyEquipment
NSSet * _incompatibleEquipment
NSArray * _conditions
NSArray * _provides
NSArray * _defaultActivateKey
NSArray * _defaultModeKey
NSDictionary * _scriptInfo
NSDictionary * _weaponInfo
NSString * _script
NSString * _condition_script
struct JSObject * _jsSelf

Detailed Description

Definition at line 42 of file OOEquipmentType.h.

Method Documentation

◆ addEquipmentWithInfo:

+ (void) addEquipmentWithInfo: (NSArray*) itemInfo

Definition at line 104 of file OOEquipmentType.m.

104 :(NSArray*)itemInfo
105{
106 NSMutableArray* equipmentTypes = [NSMutableArray arrayWithArray:sEquipmentTypes];
107 NSMutableArray* equipmentTypesOutfitting = [NSMutableArray arrayWithArray:sEquipmentTypesOutfitting];
108 NSMutableDictionary* equipmentTypesByIdentifier = [[NSMutableDictionary alloc] initWithDictionary:sEquipmentTypesByIdentifier];
109 OOEquipmentType* item = [[[OOEquipmentType alloc] initWithInfo:itemInfo] autorelease];
110 if (item != nil) {
111 [equipmentTypes addObject:item];
112 [equipmentTypesOutfitting addObject:item];
113 [equipmentTypesByIdentifier setObject:item forKey:[item identifier]];
114
115 [sEquipmentTypes release];
117 [sEquipmentTypesOutfitting release];
120 sEquipmentTypes = [equipmentTypes copy];
121 sEquipmentTypesOutfitting = [equipmentTypesOutfitting copy];
122 sEquipmentTypesByIdentifier = [[NSDictionary alloc] initWithDictionary:equipmentTypesByIdentifier];
123 }
124 DESTROY(equipmentTypesByIdentifier);
125}
static NSDictionary * sEquipmentTypesByIdentifier
static NSArray * sEquipmentTypes
static NSArray * sEquipmentTypesOutfitting
#define DESTROY(x)
return nil
NSString * identifier()

References DESTROY, identifier, nil, sEquipmentTypes, sEquipmentTypesByIdentifier, and sEquipmentTypesOutfitting.

Referenced by ShipEntity(Private)::generateMissileEquipmentTypeFrom:.

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

◆ allEquipmentTypes

+ (NSArray *) allEquipmentTypes

Definition at line 143 of file OOEquipmentType.m.

144{
145 return sEquipmentTypes;
146}

References allEquipmentTypes, and sEquipmentTypes.

Referenced by allEquipmentTypes, ShipEntity::equipmentListForScripting, and PlayerEntity(Sound)::setUpWeaponSounds.

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

◆ canBeDamaged

- (BOOL) canBeDamaged

Definition at line 512 of file OOEquipmentType.m.

513{
514 if ([self isMissileOrMine])
515 return NO;
516
517 if ([self damageProbability] > 0.0) {
518 return YES;
519 }
520
521 return NO;
522}
GLfloat damageProbability()

References canBeDamaged, damageProbability, and isMissileOrMine.

Referenced by canBeDamaged.

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

◆ canCarryMultiple

- (BOOL) canCarryMultiple

Definition at line 487 of file OOEquipmentType.m.

488{
489 if ([self isMissileOrMine])
490 return YES;
491 // technically multiple can be fitted, but not to the same mount.
492 if ([self isPrimaryWeapon])
493 return NO;
494
495 // hard-coded as special items
496 if ([_identifier isEqualToString:@"EQ_PASSENGER_BERTH"] ||
497 [_identifier isEqualToString:@"EQ_TRUMBLE"]) {
498 return YES;
499 }
500
501 return _canCarryMultiple;
502}
NSString * _identifier
unsigned _canCarryMultiple

References _canCarryMultiple, _identifier, canCarryMultiple, isMissileOrMine, and isPrimaryWeapon.

Referenced by canCarryMultiple, ShipAwardEquipment(), and ShipAwardEquipment().

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

◆ conditions

- (NSArray *) conditions

Definition at line 575 of file OOEquipmentType.m.

576{
577 return _conditions;
578}
NSArray * _conditions

References _conditions, and conditions.

Referenced by PlayerEntity::canAddEquipment:inContext:, and conditions.

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

◆ conditionScript

- (NSString *) conditionScript

Definition at line 580 of file OOEquipmentType.m.

581{
582 return _condition_script;
583}
NSString * _condition_script

References _condition_script, and conditionScript.

Referenced by PlayerEntity::adjustPriceByScriptForEqKey:withCurrent:, conditionScript, ShipEntity::equipmentValidToAdd:whileLoading:inContext:, loadEquipment, and Universe::shipsForSaleForSystem:withTL:atTime:.

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

◆ copyWithZone:

- (id) copyWithZone: (NSZone*) zone
implementation

Definition at line 391 of file OOEquipmentType.m.

391 :(NSZone*)zone
392{
393 // OOEquipmentTypes are immutable.
394 return [self retain];
395}

◆ damagedIdentifier

- (NSString *) damagedIdentifier

Definition at line 407 of file OOEquipmentType.m.

408{
409 return [_identifier stringByAppendingString:@"_DAMAGED"];
410}

References damagedIdentifier.

Referenced by PlayerEntity::buySelectedItem, damagedIdentifier, PlayerEntity::setGuiToEquipShipScreen:selectingFacingFor:, and PlayerEntity(OOPrivate)::tryBuyingItem:.

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

◆ damageProbability

- (GLfloat) damageProbability

Definition at line 504 of file OOEquipmentType.m.

505{
506 if ([self isMissileOrMine])
507 return 0.0;
508
509 return _damageProbability;
510}
GLfloat _damageProbability

References _damageProbability, damageProbability, and isMissileOrMine.

Referenced by canBeDamaged, damageProbability, and PlayerEntity::takeInternalDamage.

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

◆ dealloc

- (void) dealloc
implementation

Definition at line 370 of file OOEquipmentType.m.

371{
372 DESTROY(_name);
387
388 [super dealloc];
389}
NSArray * _defaultActivateKey
NSArray * _defaultModeKey
NSString * _description
NSDictionary * _scriptInfo
NSSet * _requiresEquipment
NSSet * _requiresAnyEquipment
NSSet * _incompatibleEquipment
OOColor * _displayColor
NSDictionary * _weaponInfo

References _condition_script, _conditions, _defaultActivateKey, _defaultModeKey, _description, _displayColor, _identifier, _incompatibleEquipment, _name, _provides, _requiresAnyEquipment, _requiresEquipment, _script, _scriptInfo, _weaponInfo, dealloc, and DESTROY.

Referenced by dealloc.

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

◆ defaultActivateKey

- (NSArray *) defaultActivateKey

Definition at line 605 of file OOEquipmentType.m.

606{
607 return _defaultActivateKey;
608}

References _defaultActivateKey, and defaultActivateKey.

Referenced by PlayerEntity::addEquipmentWithScriptToCustomKeyArray:, defaultActivateKey, PlayerEntity(KeyMapperInternal)::deleteAllKeySettings, PlayerEntity(KeyMapperInternal)::displayKeyFunctionList:skip:, EquipmentInfoGetProperty(), EquipmentInfoGetProperty(), and PlayerEntity(KeyMapper)::keyMapperInputHandler:view:.

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

◆ defaultModeKey

- (NSArray *) defaultModeKey

Definition at line 610 of file OOEquipmentType.m.

611{
612 return _defaultModeKey;
613}

References _defaultModeKey, and defaultModeKey.

Referenced by PlayerEntity::addEquipmentWithScriptToCustomKeyArray:, defaultModeKey, PlayerEntity(KeyMapperInternal)::deleteAllKeySettings, PlayerEntity(KeyMapperInternal)::displayKeyFunctionList:skip:, EquipmentInfoGetProperty(), EquipmentInfoGetProperty(), and PlayerEntity(KeyMapper)::keyMapperInputHandler:view:.

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

◆ descriptionComponents

- (NSString *) descriptionComponents
implementation

Definition at line 397 of file OOEquipmentType.m.

398{
399 return [NSString stringWithFormat:@"%@ \"%@\"", _identifier, _name];
400}

References descriptionComponents.

Referenced by descriptionComponents.

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

◆ descriptiveText

- (NSString *) descriptiveText

Definition at line 417 of file OOEquipmentType.m.

418{
419 return _description;
420}

References _description, and descriptiveText.

Referenced by descriptiveText, EquipmentInfoGetProperty(), EquipmentInfoGetProperty(), and PlayerEntity::showInformationForSelectedUpgradeWithFormatString:.

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

◆ displayColor

- (OOColor *) displayColor

Definition at line 564 of file OOEquipmentType.m.

565{
566 return _displayColor;
567}

References _displayColor, and displayColor.

Referenced by displayColor, EquipmentInfoGetProperty(), EquipmentInfoGetProperty(), PlayerEntity::equipmentList, and PlayerEntity::setGuiToEquipShipScreen:selectingFacingFor:.

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

◆ effectiveTechLevel

- (OOTechLevelID) effectiveTechLevel

Provided by category OOEquipmentType(Conveniences).

Definition at line 735 of file OOEquipmentType.m.

736{
737 OOTechLevelID tl;
738 id missionVar = nil;
739
740 tl = [self techLevel];
741 if (tl == kOOVariableTechLevel) {
742 OOStandardsDeprecated([NSString stringWithFormat:@"TL99 is deprecated for %@", [self identifier]]);
743 if (!OOEnforceStandards()) {
744 missionVar = [PLAYER missionVariableForKey:[@"mission_TL_FOR_" stringByAppendingString:[self identifier]]];
745 tl = OOUIntegerFromObject(missionVar, tl);
746 }
747 }
748
749 return tl;
750}
OOINLINE NSInteger OOUIntegerFromObject(id object, NSUInteger defaultValue)
void OOStandardsDeprecated(NSString *message)
BOOL OOEnforceStandards(void)
NSUInteger OOTechLevelID
Definition OOTypes.h:177
@ kOOVariableTechLevel
Definition OOTypes.h:175

Referenced by PlayerEntity::setGuiToEquipShipScreen:selectingFacingFor:.

Here is the caller graph for this function:

◆ equipmentEnumerator

+ (NSEnumerator *) equipmentEnumerator

Definition at line 148 of file OOEquipmentType.m.

149{
150 return [sEquipmentTypes objectEnumerator];
151}

References equipmentEnumerator.

Referenced by equipmentEnumerator.

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

◆ equipmentEnumeratorOutfitting

+ (NSEnumerator *) equipmentEnumeratorOutfitting

Definition at line 158 of file OOEquipmentType.m.

159{
160 return [sEquipmentTypesOutfitting objectEnumerator];
161}

References equipmentEnumeratorOutfitting.

Referenced by equipmentEnumeratorOutfitting.

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

◆ equipmentTypeWithIdentifier:

+ (OOEquipmentType *) equipmentTypeWithIdentifier: (NSString*) identifier

Definition at line 163 of file OOEquipmentType.m.

163 :(NSString*)identifier
164{
165 return [sEquipmentTypesByIdentifier objectForKey:identifier];
166}

Referenced by PlayerEntity(Scripting)::addEqScriptForKey:, ShipEntity::addEquipmentItem:withValidation:inContext:, PlayerEntity::addEquipmentWithScriptToCustomKeyArray:, PlayerEntity::adjustPriceByScriptForEqKey:withCurrent:, PlayerEntity::assignToActivePylon:, PlayerEntity(Scripting)::awardEquipment:, PlayerEntity::buySelectedItem, PlayerEntity::canAddEquipment:inContext:, ShipEntity::canAddEquipment:inContext:, PlayerEntity(KeyMapperInternal)::deleteAllKeySettings, PlayerEntity(KeyMapperInternal)::displayKeyFunctionList:skip:, ShipEntity::equipmentItemProviding:, PlayerEntity::equipmentList, ShipEntity::equipmentListForScripting, ShipEntity::equipmentValidToAdd:whileLoading:inContext:, ShipEntity(Private)::generateMissileEquipmentTypeFrom:, ShipEntity::hasEquipmentItemProviding:, JSValueToEquipmentKeyRelaxed(), JSValueToEquipmentKeyRelaxed(), JSValueToEquipmentType(), JSValueToEquipmentType(), PlayerEntity(KeyMapper)::keyMapperInputHandler:view:, PlayerEntity::mountMissile:, PlayerEntity(Contracts)::newShipCommonSetup:yardInfo:baseInfo:, OOWeaponTypeFromEquipmentIdentifierSloppy(), PlayerShipAwardEquipmentToCurrentPylon(), PlayerShipAwardEquipmentToCurrentPylon(), PlayerEntity(OOControlsPrivate)::pollFlightControls:, PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, PlayerEntity::primedEquipmentName:, ShipEntity::removeEquipmentItem:, PlayerEntity::removeFromPylon:, PlayerEntity::setCommanderDataFromDictionary:, PlayerEntity::setGuiToEquipShipScreen:selectingFacingFor:, PlayerEntity::setPrimedEquipment:showMessage:, PlayerEntity::setUpShipFromDictionary:, Universe::shipsForSaleForSystem:withTL:atTime:, PlayerEntity::showInformationForSelectedUpgradeWithFormatString:, PlayerEntity::takeInternalDamage, PlayerEntity::tidyMissilePylons, Universe::tradeInValueForCommanderDictionary:, PlayerEntity(OOPrivate)::tryBuyingItem:, PlayerEntity::validateCustomEquipActivationArray, and ShipEntity::verifiedMissileTypeFromRole:.

Here is the caller graph for this function:

◆ fastAffinityDefensive

- (BOOL) fastAffinityDefensive

Definition at line 595 of file OOEquipmentType.m.

596{
597 return _fastAffinityA;
598}
unsigned _fastAffinityA

References _fastAffinityA, and fastAffinityDefensive.

Referenced by fastAffinityDefensive.

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

◆ fastAffinityOffensive

- (BOOL) fastAffinityOffensive

Definition at line 600 of file OOEquipmentType.m.

601{
602 return _fastAffinityB;
603}
unsigned _fastAffinityB

References _fastAffinityB, and fastAffinityOffensive.

Referenced by fastAffinityOffensive.

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

◆ fxShieldHitName

- (NSString *) fxShieldHitName

Definition at line 700 of file OOEquipmentType.m.

701{
702 return [_weaponInfo oo_stringForKey:@"fx_hitplayer_shielded_name" defaultValue:@"[player-hit-by-weapon]"];
703}

References fxShieldHitName.

Referenced by fxShieldHitName.

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

◆ fxShotHitName

- (NSString *) fxShotHitName

Definition at line 695 of file OOEquipmentType.m.

696{
697 return [_weaponInfo oo_stringForKey:@"fx_shot_hit_name" defaultValue:@"[player-laser-hit]"];
698}

References fxShotHitName.

Referenced by fxShotHitName.

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

◆ fxShotMissName

- (NSString *) fxShotMissName

Definition at line 690 of file OOEquipmentType.m.

691{
692 return [_weaponInfo oo_stringForKey:@"fx_shot_miss_name" defaultValue:@"[player-laser-miss]"];
693}

References fxShotMissName.

Referenced by fxShotMissName.

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

◆ fxUnshieldedHitName

- (NSString *) fxUnshieldedHitName

Definition at line 705 of file OOEquipmentType.m.

706{
707 return [_weaponInfo oo_stringForKey:@"fx_hitplayer_unshielded_name" defaultValue:@"[player-direct-hit]"];
708}

References fxUnshieldedHitName.

Referenced by fxUnshieldedHitName.

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

◆ fxWeaponLaunchedName

- (NSString *) fxWeaponLaunchedName

Definition at line 710 of file OOEquipmentType.m.

711{
712 return [_weaponInfo oo_stringForKey:@"fx_weapon_launch_name" defaultValue:([[self identifier] hasSuffix:@"_MINE"] ? @"[mine-launched]" : @"[missile-launched]")];
713}

References fxWeaponLaunchedName, and identifier.

Referenced by fxWeaponLaunchedName.

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

◆ getMissileRegistryRoleForShip:

+ (NSString *) getMissileRegistryRoleForShip: (NSString*) shipKey

Definition at line 127 of file OOEquipmentType.m.

127 :(NSString*)shipKey
128{
129 return [sMissilesRegistry oo_stringForKey:shipKey];
130}

Referenced by ShipEntity::verifiedMissileTypeFromRole:.

Here is the caller graph for this function:

◆ hideValues

- (BOOL) hideValues

Definition at line 529 of file OOEquipmentType.m.

530{
531 return _hideValues;
532}

References _hideValues, and hideValues.

Referenced by hideValues.

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

◆ identifier

- (NSString *) identifier

◆ incompatibleEquipment

- (NSSet *) incompatibleEquipment

Definition at line 559 of file OOEquipmentType.m.

560{
562}

References _incompatibleEquipment, and incompatibleEquipment.

Referenced by EquipmentInfoGetProperty(), EquipmentInfoGetProperty(), and incompatibleEquipment.

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

◆ initWithInfo:

- (id) initWithInfo: (NSArray*) info
implementation

Provided by category OOEquipmentType(Private).

Definition at line 168 of file OOEquipmentType.m.

168 :(NSArray*)info
169{
170 BOOL OK = YES;
171 NSDictionary* extra = nil;
172 NSArray* conditions = nil;
173 NSString* condition_script = nil;
174 NSArray* keydef = nil;
175
176 self = [super init];
177 if (self == nil)
178 OK = NO;
179
180 if (OK && [info count] <= EQUIPMENT_LONG_DESC_INDEX)
181 OK = NO;
182
183 if (OK) {
184 // Read required attributes
185 _techLevel = [info oo_unsignedIntAtIndex:EQUIPMENT_TECH_LEVEL_INDEX];
186 _price = [info oo_unsignedIntAtIndex:EQUIPMENT_PRICE_INDEX];
187 _name = [[info oo_stringAtIndex:EQUIPMENT_SHORT_DESC_INDEX] retain];
188 _identifier = [[info oo_stringAtIndex:EQUIPMENT_KEY_INDEX] retain];
189 _description = [[info oo_stringAtIndex:EQUIPMENT_LONG_DESC_INDEX] retain];
190
191 if (_name == nil || _identifier == nil || _description == nil) {
192 OOLog(@"equipment.load", @"***** ERROR: Invalid equipment.plist entry - missing name, identifier or description (\"%@\", %@, \"%@\")", _name, _identifier, _description);
193 OK = NO;
194 }
195 }
196
197 if (OK) {
198 // Implied attributes for backwards-compatibility
199 if ([_identifier hasSuffix:@"_MISSILE"] || [_identifier hasSuffix:@"_MINE"]) {
200 _isMissileOrMine = YES;
202 } else if ([_identifier isEqualToString:@"EQ_PASSENGER_BERTH_REMOVAL"]) {
204 } else if ([_identifier isEqualToString:@"EQ_FUEL"]) {
206 }
207 _isVisible = YES;
209 _isAvailableToNPCs = YES;
210 _damageProbability = 1.0;
211 _hideValues = NO;
212 }
213
214 if (OK && [info count] > EQUIPMENT_EXTRA_INFO_INDEX) {
215 // Read extra info dictionary
216 extra = [info oo_dictionaryAtIndex:EQUIPMENT_EXTRA_INFO_INDEX];
217 if (extra != nil) {
218
219 _isAvailableToAll = [extra oo_boolForKey:@"available_to_all" defaultValue:_isAvailableToAll];
220 _isAvailableToPlayer = [extra oo_boolForKey:@"available_to_player" defaultValue:_isAvailableToPlayer];
221 _isAvailableToNPCs = [extra oo_boolForKey:@"available_to_NPCs" defaultValue:_isAvailableToNPCs];
222
223 _isMissileOrMine = [extra oo_boolForKey:@"is_external_store" defaultValue:_isMissileOrMine];
224 _requiresEmptyPylon = [extra oo_boolForKey:@"requires_empty_pylon" defaultValue:_requiresEmptyPylon];
225 _requiresMountedPylon = [extra oo_boolForKey:@"requires_mounted_pylon" defaultValue:_requiresMountedPylon];
226 _requiresClean = [extra oo_boolForKey:@"requires_clean" defaultValue:_requiresClean];
227 _requiresNotClean = [extra oo_boolForKey:@"requires_not_clean" defaultValue:_requiresNotClean];
228 _portableBetweenShips = [extra oo_boolForKey:@"portable_between_ships" defaultValue:_portableBetweenShips];
229 _requiresFreePassengerBerth = [extra oo_boolForKey:@"requires_free_passenger_berth" defaultValue:_requiresFreePassengerBerth];
230 _requiresFullFuel = [extra oo_boolForKey:@"requires_full_fuel" defaultValue:_requiresFullFuel];
231 _requiresNonFullFuel = [extra oo_boolForKey:@"requires_non_full_fuel" defaultValue:_requiresNonFullFuel];
232 _isVisible = [extra oo_boolForKey:@"visible" defaultValue:_isVisible];
233 _canCarryMultiple = [extra oo_boolForKey:@"can_carry_multiple" defaultValue:NO];
234 _hideValues = [extra oo_boolForKey:@"hide_values" defaultValue:NO];
235
236 _requiredCargoSpace = [extra oo_unsignedIntForKey:@"requires_cargo_space" defaultValue:_requiredCargoSpace];
237
238 _installTime = [extra oo_unsignedIntForKey:@"installation_time" defaultValue:0];
239 _repairTime = [extra oo_unsignedIntForKey:@"repair_time" defaultValue:0];
240 _provides = [[extra oo_arrayForKey:@"provides" defaultValue:[NSArray array]] retain];
241
242 id dispColor = [extra oo_objectForKey:@"display_color" defaultValue:nil];
243 _displayColor = [[OOColor colorWithDescription:dispColor] retain];
244
245 _weaponInfo = [[extra oo_dictionaryForKey:@"weapon_info" defaultValue:[NSDictionary dictionary]] retain];
246
247 _damageProbability = [extra oo_floatForKey:@"damage_probability" defaultValue:(_isMissileOrMine ? 0.0 : 1.0)];
248
249 id object = [extra objectForKey:@"requires_equipment"];
250 if ([object isKindOfClass:[NSString class]])
251 _requiresEquipment = [[NSSet setWithObject:object] retain];
252 else if ([object isKindOfClass:[NSArray class]])
253 _requiresEquipment = [[NSSet setWithArray:object] retain];
254 else if (object != nil) {
255 OOLog(@"equipment.load", @"***** ERROR: %@ for equipment item %@ is not a string or an array.", @"requires_equipment", _identifier);
256 }
257
258 object = [extra objectForKey:@"requires_any_equipment"];
259 if ([object isKindOfClass:[NSString class]])
260 _requiresAnyEquipment = [[NSSet setWithObject:object] retain];
261 else if ([object isKindOfClass:[NSArray class]])
262 _requiresAnyEquipment = [[NSSet setWithArray:object] retain];
263 else if (object != nil) {
264 OOLog(@"equipment.load", @"***** ERROR: %@ for equipment item %@ is not a string or an array.", @"requires_any_equipment", _identifier);
265 }
266
267 object = [extra objectForKey:@"incompatible_with_equipment"];
268 if ([object isKindOfClass:[NSString class]])
269 _incompatibleEquipment = [[NSSet setWithObject:object] retain];
270 else if ([object isKindOfClass:[NSArray class]])
271 _incompatibleEquipment = [[NSSet setWithArray:object] retain];
272 else if (object != nil) {
273 OOLog(@"equipment.load", @"***** ERROR: %@ for equipment item %@ is not a string or an array.", @"incompatible_with_equipment", _identifier);
274 }
275
276 object = [extra objectForKey:@"conditions"];
277 if ([object isKindOfClass:[NSString class]])
278 conditions = [NSArray arrayWithObject:object];
279 else if ([object isKindOfClass:[NSArray class]])
280 conditions = object;
281 else if (object != nil) {
282 OOLog(@"equipment.load", @"***** ERROR: %@ for equipment item %@ is not a string or an array.", @"conditions", _identifier);
283 }
284 if (conditions != nil) {
285 OOStandardsDeprecated([NSString stringWithFormat:@"The conditions key is deprecated for equipment %@", _name]);
286 if (!OOEnforceStandards()) {
287 _conditions = OOSanitizeLegacyScriptConditions(conditions, [NSString stringWithFormat:@"<equipment type \"%@\">", _name]);
288 [_conditions retain];
289 }
290 }
291
292 object = [extra objectForKey:@"condition_script"];
293 if ([object isKindOfClass:[NSString class]]) {
294 condition_script = object;
295 } else if (object != nil) {
296 OOLog(@"equipment.load", @"***** ERROR: %@ for equipment item %@ is not a string.", @"condition_script", _identifier);
297 }
298 if (condition_script != nil) {
299 _condition_script = [condition_script retain];
300 }
301 /* Condition scripts are shared: all equipment/ships using the
302 * same condition script use one shared instance. Equipment
303 * scripts and ship scripts are not shared and get one instance
304 * per item. */
305
306 _scriptInfo = [extra oo_dictionaryForKey:@"script_info"];
307 [_scriptInfo retain];
308
309 _script = [extra oo_stringForKey:@"script"];
310 if (_script != nil && ![OOScript jsScriptFromFileNamed:_script properties:nil])
311 _script = nil;
312 [_script retain];
313 if (_script != nil) {
314 _fastAffinityA = !![extra oo_boolForKey:@"fast_affinity_defensive"];
315 _fastAffinityB = !![extra oo_boolForKey:@"fast_affinity_offensive"];
316
317 // look for default activate and mode key settings
318 // note: the customEquipmentActivation array is only populated when starting a game
319 // so the application of any default key settings on equipment will only happen then
320 NSString* checking;
321
322 object = [extra objectForKey:@"default_activate_key"];
323 if ([object isKindOfClass:[NSArray class]])
324 keydef = object;
325 else if (object != nil) {
326 OOLog(@"equipment.load", @"***** ERROR: %@ for equipment item %@ is not an array.", @"default_activate_key", _identifier);
327 object = nil;
328 }
329
330 if (object != nil) {
331 // do processing for key
332 _defaultActivateKey = [PLAYER processKeyCode:keydef];
333 checking = [PLAYER validateKey:[NSString stringWithFormat:@"activate_%@", _identifier] checkKeys:_defaultActivateKey];
334
335 if (checking != nil) {
336 OOLog(@"equipment.load", @"***** Error: %@ for equipment item %@ is already in use for %@. Default not applied", @"default_activate_key", _identifier, checking);
338 }
339 }
340
341 object = [extra objectForKey:@"default_mode_key"];
342 if ([object isKindOfClass:[NSArray class]])
343 keydef = object;
344 else if (object != nil) {
345 OOLog(@"equipment.load", @"***** ERROR: %@ for equipment item %@ is not an array.", @"default_mode_key", _identifier);
346 object = nil;
347 }
348
349 if (object != nil) {
350 // do processing for key
351 _defaultModeKey = [PLAYER processKeyCode:keydef];
352 checking = [PLAYER validateKey:[NSString stringWithFormat:@"mode_%@", _identifier] checkKeys:_defaultModeKey];
353
354 if (checking != nil) {
355 OOLog(@"equipment.load", @"***** Error: %@ for equipment item %@ is already in use for %@. Default not applied.", @"default_mode_key", _identifier, checking);
357 }
358 }
359 }
360 }
361 }
362
363 if (!OK) {
364 [self release];
365 self = nil;
366 }
367 return self;
368}
NSArray * OOSanitizeLegacyScriptConditions(NSArray *conditions, NSString *context)
#define OOLog(class, format,...)
Definition OOLogging.h:84
unsigned count
@ EQUIPMENT_LONG_DESC_INDEX
Definition Universe.h:78
@ EQUIPMENT_EXTRA_INFO_INDEX
Definition Universe.h:79
OOColor * colorWithDescription:(id description)
Definition OOColor.m:135
OOCargoQuantity _requiredCargoSpace
unsigned _isMissileOrMine
unsigned _requiresFullFuel
NSUInteger _repairTime
NSUInteger _installTime
unsigned _portableBetweenShips
unsigned _requiresMountedPylon
unsigned _isAvailableToAll
unsigned _isAvailableToNPCs
OOTechLevelID _techLevel
unsigned _requiresNotClean
unsigned _requiresClean
OOCreditsQuantity _price
unsigned _requiresFreePassengerBerth
unsigned _requiresNonFullFuel
unsigned _isAvailableToPlayer
unsigned _requiresEmptyPylon

References OOColor::colorWithDescription:, count, EQUIPMENT_EXTRA_INFO_INDEX, EQUIPMENT_LONG_DESC_INDEX, nil, OOEnforceStandards(), OOLog, OOSanitizeLegacyScriptConditions(), and OOStandardsDeprecated().

Here is the call graph for this function:

◆ installTime

- (NSUInteger) installTime

Definition at line 615 of file OOEquipmentType.m.

616{
617 return _installTime;
618}

References _installTime, and installTime.

Referenced by PlayerEntity::buySelectedItem, EquipmentInfoGetProperty(), EquipmentInfoGetProperty(), installTime, and PlayerEntity::setGuiToEquipShipScreen:selectingFacingFor:.

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

◆ isAvailableToAll

- (BOOL) isAvailableToAll

Definition at line 432 of file OOEquipmentType.m.

433{
434 return _isAvailableToAll;
435}

References _isAvailableToAll, and isAvailableToAll.

Referenced by isAvailableToAll.

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

◆ isAvailableToNPCs

- (BOOL) isAvailableToNPCs

Definition at line 539 of file OOEquipmentType.m.

540{
541 return _isAvailableToNPCs;
542}

References _isAvailableToNPCs, and isAvailableToNPCs.

Referenced by isAvailableToNPCs.

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

◆ isAvailableToPlayer

- (BOOL) isAvailableToPlayer

Definition at line 534 of file OOEquipmentType.m.

535{
537}

References _isAvailableToPlayer, and isAvailableToPlayer.

Referenced by isAvailableToPlayer.

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

◆ isMiningLaser

- (BOOL) isMiningLaser

Definition at line 645 of file OOEquipmentType.m.

646{
647 return [_weaponInfo oo_boolForKey:@"is_mining_laser" defaultValue:NO];
648}

References isMiningLaser.

Referenced by PlayerEntity::fireMainWeapon, and isMiningLaser.

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

◆ isMissileOrMine

- (BOOL) isMissileOrMine

Definition at line 477 of file OOEquipmentType.m.

478{
479 return _isMissileOrMine;
480}

References _isMissileOrMine, and isMissileOrMine.

Referenced by canBeDamaged, canCarryMultiple, damageProbability, and isMissileOrMine.

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

◆ isPortableBetweenShips

- (BOOL) isPortableBetweenShips

Definition at line 482 of file OOEquipmentType.m.

483{
485}

References _portableBetweenShips, and isPortableBetweenShips.

Referenced by isPortableBetweenShips.

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

◆ isPrimaryWeapon

- (BOOL) isPrimaryWeapon

Definition at line 472 of file OOEquipmentType.m.

473{
474 return [[self identifier] hasPrefix:@"EQ_WEAPON"];
475}

References identifier, and isPrimaryWeapon.

Referenced by canCarryMultiple, and isPrimaryWeapon.

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

◆ isTurretLaser

- (BOOL) isTurretLaser

Definition at line 640 of file OOEquipmentType.m.

641{
642 return [_weaponInfo oo_boolForKey:@"is_turret_laser" defaultValue:NO];
643}

References isTurretLaser.

Referenced by isTurretLaser.

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

◆ isVisible

- (BOOL) isVisible

Definition at line 524 of file OOEquipmentType.m.

525{
526 return _isVisible;
527}

References _isVisible, and isVisible.

Referenced by isVisible.

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

◆ loadEquipment

+ (void) loadEquipment

Definition at line 50 of file OOEquipmentType.m.

51{
52 NSArray* equipmentData = nil;
53 NSMutableArray* equipmentTypes = nil;
54 NSMutableDictionary* equipmentTypesByIdentifier = nil;
55 NSArray* itemInfo = nil;
56 OOEquipmentType* item = nil;
57 NSMutableArray* conditionScripts = nil;
58
59 equipmentData = [UNIVERSE equipmentData];
60
61 [sEquipmentTypes release];
63 equipmentTypes = [NSMutableArray arrayWithCapacity:[equipmentData count]];
64 conditionScripts = [NSMutableArray arrayWithCapacity:[equipmentData count]];
66 equipmentTypesByIdentifier = [NSMutableDictionary dictionaryWithCapacity:[equipmentData count]];
67
68 foreach (itemInfo, equipmentData) {
69 item = [[[OOEquipmentType alloc] initWithInfo:itemInfo] autorelease];
70 if (item != nil) {
71 [equipmentTypes addObject:item];
72 [equipmentTypesByIdentifier setObject:item forKey:[item identifier]];
73 }
74 NSString* condition_script = [item conditionScript];
75 if (condition_script != nil) {
76 if (![conditionScripts containsObject:condition_script]) {
77 [conditionScripts addObject:condition_script];
78 }
79 }
80 }
81
82 [[OOCacheManager sharedCache] setObject:conditionScripts forKey:@"equipment conditions" inCache:@"condition scripts"];
83
84 sEquipmentTypes = [equipmentTypes copy];
85 sEquipmentTypesByIdentifier = [[NSDictionary alloc] initWithDictionary:equipmentTypesByIdentifier];
86
87 // same for the outfitting dataset
88 equipmentData = [UNIVERSE equipmentDataOutfitting];
89
90 [sEquipmentTypesOutfitting release];
92
93 equipmentTypes = [NSMutableArray arrayWithCapacity:[equipmentData count]];
94 foreach (itemInfo, equipmentData) {
95 item = [[[OOEquipmentType alloc] initWithInfo:itemInfo] autorelease];
96 if (item != nil) {
97 [equipmentTypes addObject:item];
98 [equipmentTypesByIdentifier setObject:item forKey:[item identifier]];
99 }
100 }
101 sEquipmentTypesOutfitting = [equipmentTypes copy];
102}
void setObject:forKey:inCache:(id inElement,[forKey] NSString *inKey,[inCache] NSString *inCacheKey)
OOCacheManager * sharedCache()
NSString * conditionScript()

References conditionScript, DESTROY, identifier, loadEquipment, nil, sEquipmentTypes, sEquipmentTypesByIdentifier, sEquipmentTypesOutfitting, OOCacheManager::setObject:forKey:inCache:, and OOCacheManager::sharedCache.

Referenced by loadEquipment, and Universe::setUpSettings.

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

◆ name

- (NSString *) name

Definition at line 412 of file OOEquipmentType.m.

413{
414 return _name;
415}

References _name, and name.

Referenced by PlayerEntity::addEquipmentWithScriptToCustomKeyArray:, EquipmentInfoGetProperty(), EquipmentInfoGetProperty(), PlayerEntity::equipmentList, name, PlayerEntity(OOControlsPrivate)::pollFlightControls:, PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, PlayerEntity::primedEquipmentName:, PlayerEntity::setGuiToEquipShipScreen:selectingFacingFor:, PlayerEntity::setPrimedEquipment:showMessage:, Universe::shipsForSaleForSystem:withTL:atTime:, and PlayerEntity::takeInternalDamage.

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

◆ oo_clearJSSelf: [1/2]

- (void) oo_clearJSSelf: (JSObject*) selfVal
implementation

Provided by category OOEquipmentType(OOJavaScriptExtensions).

Definition at line 501 of file OOJSEquipmentInfo.m.

501 :(JSObject*)selfVal
502{
503 if (_jsSelf == selfVal)
504 _jsSelf = NULL;
505}
struct JSObject * _jsSelf

◆ oo_clearJSSelf: [2/2]

- (void) oo_clearJSSelf: (JSValueConst) selfVal
implementation

Provided by category OOEquipmentType(OOJavaScriptExtensions).

Definition at line 468 of file OOJSEquipmentInfo.m.

468 :(JSValueConst)selfVal
469{
470 if (JS_IsObject(_jsSelf) && JS_VALUE_GET_PTR(_jsSelf) == JS_VALUE_GET_PTR(selfVal))
471 _jsSelf = JS_UNDEFINED;
472}

◆ oo_jsClassName

- (NSString *) oo_jsClassName
implementation

Provided by category OOEquipmentType(OOJavaScriptExtensions).

Definition at line 496 of file OOJSEquipmentInfo.m.

497{
498 return @"EquipmentInfo";
499}

◆ oo_jsValueInContext:

- (JSValue) oo_jsValueInContext: (JSContext*) context
implementation

Provided by category OOEquipmentType(OOJavaScriptExtensions).

Definition at line 483 of file OOJSEquipmentInfo.m.

483 :(JSContext*)context
484{
485 if (_jsSelf == NULL) {
486 _jsSelf = JS_NewObject(context, &sEquipmentInfoClass, sEquipmentInfoPrototype, NULL);
487 if (_jsSelf != NULL) {
488 if (!JS_SetPrivate(context, _jsSelf, [self retain]))
489 _jsSelf = NULL;
490 }
491 }
492
493 return OBJECT_TO_JSVAL(_jsSelf);
494}
static JSObject * sEquipmentInfoPrototype
static JSClass sEquipmentInfoClass

◆ price

- (OOCreditsQuantity) price

Definition at line 427 of file OOEquipmentType.m.

428{
429 return _price;
430}

References _price, and price.

Referenced by EquipmentInfoGetProperty(), EquipmentInfoGetProperty(), price, PlayerEntity::setGuiToEquipShipScreen:selectingFacingFor:, Universe::shipsForSaleForSystem:withTL:atTime:, and PlayerEntity(OOPrivate)::tryBuyingItem:.

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

◆ provides:

- (BOOL) provides: (NSString*) key

Definition at line 634 of file OOEquipmentType.m.

634 :(NSString*)key
635{
636 return [_provides containsObject:key];
637}

◆ providesForScripting

- (NSArray *) providesForScripting

Definition at line 629 of file OOEquipmentType.m.

630{
631 return [[_provides copy] autorelease];
632}

References providesForScripting.

Referenced by EquipmentInfoGetProperty(), EquipmentInfoGetProperty(), and providesForScripting.

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

◆ repairTime

- (NSUInteger) repairTime

Definition at line 620 of file OOEquipmentType.m.

621{
622 if (_repairTime > 0) {
623 return _repairTime;
624 } else {
625 return _installTime / 2;
626 }
627}

References _installTime, _repairTime, and repairTime.

Referenced by PlayerEntity::buySelectedItem, repairTime, and PlayerEntity::setGuiToEquipShipScreen:selectingFacingFor:.

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

◆ requiredCargoSpace

- (OOCargoQuantity) requiredCargoSpace

Definition at line 544 of file OOEquipmentType.m.

545{
546 return _requiredCargoSpace;
547}

References _requiredCargoSpace, and requiredCargoSpace.

Referenced by ShipEntity::addEquipmentItem:withValidation:inContext:, ShipEntity::removeEquipmentItem:, requiredCargoSpace, ShipAwardEquipment(), ShipAwardEquipment(), and PlayerEntity::showInformationForSelectedUpgradeWithFormatString:.

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

◆ requiresAnyEquipment

- (NSSet *) requiresAnyEquipment

Definition at line 554 of file OOEquipmentType.m.

555{
557}

References _requiresAnyEquipment, and requiresAnyEquipment.

Referenced by EquipmentInfoGetProperty(), EquipmentInfoGetProperty(), and requiresAnyEquipment.

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

◆ requiresCleanLegalRecord

- (BOOL) requiresCleanLegalRecord

Definition at line 447 of file OOEquipmentType.m.

448{
449 return _requiresClean;
450}

References _requiresClean, and requiresCleanLegalRecord.

Referenced by requiresCleanLegalRecord.

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

◆ requiresEmptyPylon

- (BOOL) requiresEmptyPylon

Definition at line 437 of file OOEquipmentType.m.

438{
439 return _requiresEmptyPylon;
440}

References _requiresEmptyPylon, and requiresEmptyPylon.

Referenced by requiresEmptyPylon.

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

◆ requiresEquipment

- (NSSet *) requiresEquipment

Definition at line 549 of file OOEquipmentType.m.

550{
551 return _requiresEquipment;
552}

References _requiresEquipment, and requiresEquipment.

Referenced by EquipmentInfoGetProperty(), EquipmentInfoGetProperty(), and requiresEquipment.

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

◆ requiresFreePassengerBerth

- (BOOL) requiresFreePassengerBerth

Definition at line 457 of file OOEquipmentType.m.

458{
460}

References _requiresFreePassengerBerth, and requiresFreePassengerBerth.

Referenced by requiresFreePassengerBerth.

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

◆ requiresFullFuel

- (BOOL) requiresFullFuel

Definition at line 462 of file OOEquipmentType.m.

463{
464 return _requiresFullFuel;
465}

References _requiresFullFuel, and requiresFullFuel.

Referenced by requiresFullFuel.

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

◆ requiresMountedPylon

- (BOOL) requiresMountedPylon

Definition at line 442 of file OOEquipmentType.m.

443{
445}

References _requiresMountedPylon, and requiresMountedPylon.

Referenced by requiresMountedPylon.

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

◆ requiresNonCleanLegalRecord

- (BOOL) requiresNonCleanLegalRecord

Definition at line 452 of file OOEquipmentType.m.

453{
454 return _requiresNotClean;
455}

References _requiresNotClean, and requiresNonCleanLegalRecord.

Referenced by requiresNonCleanLegalRecord.

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

◆ requiresNonFullFuel

- (BOOL) requiresNonFullFuel

Definition at line 467 of file OOEquipmentType.m.

468{
470}

References _requiresNonFullFuel, and requiresNonFullFuel.

Referenced by requiresNonFullFuel.

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

◆ reverseEquipmentEnumerator

+ (NSEnumerator *) reverseEquipmentEnumerator

Definition at line 153 of file OOEquipmentType.m.

154{
155 return [sEquipmentTypes reverseObjectEnumerator];
156}

References reverseEquipmentEnumerator.

Referenced by reverseEquipmentEnumerator.

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

◆ scriptInfo

- (NSDictionary *) scriptInfo

Definition at line 585 of file OOEquipmentType.m.

586{
587 return _scriptInfo;
588}

References _scriptInfo, and scriptInfo.

Referenced by EquipmentInfoGetProperty(), EquipmentInfoGetProperty(), and scriptInfo.

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

◆ scriptName

- (NSString *) scriptName

Definition at line 590 of file OOEquipmentType.m.

591{
592 return _script;
593}

References _script, and scriptName.

Referenced by PlayerEntity(Scripting)::addEqScriptForKey:, EquipmentInfoGetProperty(), EquipmentInfoGetProperty(), and scriptName.

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

◆ setDisplayColor:

- (void) setDisplayColor: (OOColor*) newColor

Definition at line 569 of file OOEquipmentType.m.

569 :(OOColor*)color
570{
571 [_displayColor release];
572 _displayColor = [color retain];
573}

References _displayColor.

Referenced by EquipmentInfoSetProperty(), and EquipmentInfoSetProperty().

Here is the caller graph for this function:

◆ setMissileRegistryRole:forShip:

+ (void) setMissileRegistryRole: (NSString*) roles
forShip: (NSString*) shipKey 

Definition at line 132 of file OOEquipmentType.m.

132 :(NSString*)role forShip:(NSString*)shipKey
133{
134 NSMutableDictionary* missilesRegistry = [[NSMutableDictionary alloc] initWithDictionary:sMissilesRegistry];
135 if (role != nil && shipKey != nil && ![shipKey isEqualToString:@""]) {
136 [missilesRegistry setValue:role forKey:shipKey];
138 sMissilesRegistry = [[NSDictionary alloc] initWithDictionary:missilesRegistry];
139 }
140 DESTROY(missilesRegistry);
141}
static NSDictionary * sMissilesRegistry

References DESTROY, nil, and sMissilesRegistry.

Referenced by ShipEntity::verifiedMissileTypeFromRole:.

Here is the caller graph for this function:

◆ suppressClangStuff

- (BOOL) suppressClangStuff
implementation

Definition at line 720 of file OOEquipmentType.m.

721{
722#if OOJS_QUICKJS
723 return !JS_IsObject(_jsSelf);
724#else
725 return !_jsSelf;
726#endif
727}

References _jsSelf, and suppressClangStuff.

Referenced by suppressClangStuff.

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

◆ techLevel

- (OOTechLevelID) techLevel

Definition at line 422 of file OOEquipmentType.m.

423{
424 return _techLevel;
425}

References _techLevel, and techLevel.

Referenced by OOEquipmentType(Conveniences)::effectiveTechLevel, Universe::shipsForSaleForSystem:withTL:atTime:, and techLevel.

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

◆ weaponColor

- (OOColor *) weaponColor

Definition at line 685 of file OOEquipmentType.m.

686{
687 return [OOColor brightColorWithDescription:[_weaponInfo objectForKey:@"color"]];
688}
OOColor * brightColorWithDescription:(id description)
Definition OOColor.m:202

References OOColor::brightColorWithDescription:, and weaponColor.

Referenced by ShipEntity::setWeaponDataFromType:, and weaponColor.

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

◆ weaponDamage

- (GLfloat) weaponDamage

Definition at line 665 of file OOEquipmentType.m.

666{
667 return [_weaponInfo oo_floatForKey:@"damage" defaultValue:15.0];
668}

References weaponDamage.

Referenced by ShipEntity::setWeaponDataFromType:, and weaponDamage.

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

◆ weaponEnergyUse

- (GLfloat) weaponEnergyUse

Definition at line 660 of file OOEquipmentType.m.

661{
662 return [_weaponInfo oo_floatForKey:@"energy" defaultValue:0.8];
663}

References weaponEnergyUse.

Referenced by ShipEntity::setWeaponDataFromType:, and weaponEnergyUse.

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

◆ weaponInfo

- (NSDictionary *) weaponInfo

Definition at line 650 of file OOEquipmentType.m.

651{
652 return _weaponInfo;
653}

References _weaponInfo, and weaponInfo.

Referenced by EquipmentInfoGetProperty(), EquipmentInfoGetProperty(), and weaponInfo.

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

◆ weaponRange

- (GLfloat) weaponRange

Definition at line 655 of file OOEquipmentType.m.

656{
657 return [_weaponInfo oo_floatForKey:@"range" defaultValue:12500.0];
658}

References weaponRange.

Referenced by getWeaponRangeFromType(), and weaponRange.

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

◆ weaponRechargeRate

- (GLfloat) weaponRechargeRate

Definition at line 670 of file OOEquipmentType.m.

671{
672 return [_weaponInfo oo_floatForKey:@"recharge_rate" defaultValue:0.5];
673}

References weaponRechargeRate.

Referenced by ShipEntity::setWeaponDataFromType:, and weaponRechargeRate.

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

◆ weaponShotTemperature

- (GLfloat) weaponShotTemperature

Definition at line 675 of file OOEquipmentType.m.

676{
677 return [_weaponInfo oo_floatForKey:@"shot_temperature" defaultValue:7.0];
678}

References weaponShotTemperature.

Referenced by ShipEntity::setWeaponDataFromType:, and weaponShotTemperature.

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

◆ weaponThreatAssessment

- (GLfloat) weaponThreatAssessment

Definition at line 680 of file OOEquipmentType.m.

681{
682 return [_weaponInfo oo_floatForKey:@"threat_assessment" defaultValue:1.0];
683}

References weaponThreatAssessment.

Referenced by ShipThreatAssessmentWeapon(), and weaponThreatAssessment.

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

Member Data Documentation

◆ _canCarryMultiple

- (unsigned) _canCarryMultiple
private

Definition at line 64 of file OOEquipmentType.h.

Referenced by canCarryMultiple.

◆ _condition_script

- (NSString*) _condition_script
private

Definition at line 81 of file OOEquipmentType.h.

Referenced by conditionScript, and dealloc.

◆ _conditions

- (NSArray*) _conditions
private

Definition at line 74 of file OOEquipmentType.h.

Referenced by conditions, and dealloc.

◆ _damageProbability

- (GLfloat) _damageProbability
private

Definition at line 69 of file OOEquipmentType.h.

Referenced by damageProbability.

◆ _defaultActivateKey

- (NSArray*) _defaultActivateKey
private

Definition at line 76 of file OOEquipmentType.h.

Referenced by dealloc, and defaultActivateKey.

◆ _defaultModeKey

- (NSArray*) _defaultModeKey
private

Definition at line 77 of file OOEquipmentType.h.

Referenced by dealloc, and defaultModeKey.

◆ _description

- (NSString*) _description
private

Definition at line 48 of file OOEquipmentType.h.

Referenced by dealloc, and descriptiveText.

◆ _displayColor

- (OOColor*) _displayColor
private

Definition at line 66 of file OOEquipmentType.h.

Referenced by dealloc, displayColor, and setDisplayColor:.

◆ _fastAffinityA

- (unsigned) _fastAffinityA
private

Definition at line 62 of file OOEquipmentType.h.

Referenced by fastAffinityDefensive.

◆ _fastAffinityB

- (unsigned) _fastAffinityB
private

Definition at line 63 of file OOEquipmentType.h.

Referenced by fastAffinityOffensive.

◆ _hideValues

- (unsigned) _hideValues
private

Definition at line 65 of file OOEquipmentType.h.

Referenced by hideValues.

◆ _identifier

- (NSString*) _identifier
private

Definition at line 47 of file OOEquipmentType.h.

Referenced by canCarryMultiple, dealloc, and identifier.

◆ _incompatibleEquipment

- (NSSet*) _incompatibleEquipment
private

Definition at line 73 of file OOEquipmentType.h.

Referenced by dealloc, and incompatibleEquipment.

◆ _installTime

- (NSUInteger) _installTime
private

Definition at line 67 of file OOEquipmentType.h.

Referenced by installTime, and repairTime.

◆ _isAvailableToAll

- (unsigned) _isAvailableToAll
private

Definition at line 49 of file OOEquipmentType.h.

Referenced by isAvailableToAll.

◆ _isAvailableToNPCs

- (unsigned) _isAvailableToNPCs
private

Definition at line 61 of file OOEquipmentType.h.

Referenced by isAvailableToNPCs.

◆ _isAvailableToPlayer

- (unsigned) _isAvailableToPlayer
private

Definition at line 60 of file OOEquipmentType.h.

Referenced by isAvailableToPlayer.

◆ _isMissileOrMine

- (unsigned) _isMissileOrMine
private

Definition at line 58 of file OOEquipmentType.h.

Referenced by isMissileOrMine.

◆ _isVisible

- (unsigned) _isVisible
private

Definition at line 59 of file OOEquipmentType.h.

Referenced by isVisible.

◆ _jsSelf

- (struct JSObject*) _jsSelf
private

Definition at line 86 of file OOEquipmentType.h.

Referenced by suppressClangStuff.

◆ _name

- (NSString*) _name
private

Definition at line 46 of file OOEquipmentType.h.

Referenced by dealloc, and name.

◆ _portableBetweenShips

- (unsigned) _portableBetweenShips
private

Definition at line 54 of file OOEquipmentType.h.

Referenced by isPortableBetweenShips.

◆ _price

- (OOCreditsQuantity) _price
private

Definition at line 45 of file OOEquipmentType.h.

Referenced by price.

◆ _provides

- (NSArray*) _provides
private

Definition at line 75 of file OOEquipmentType.h.

Referenced by dealloc.

◆ _repairTime

- (NSUInteger) _repairTime
private

Definition at line 68 of file OOEquipmentType.h.

Referenced by repairTime.

◆ _requiredCargoSpace

- (OOCargoQuantity) _requiredCargoSpace
private

Definition at line 70 of file OOEquipmentType.h.

Referenced by requiredCargoSpace.

◆ _requiresAnyEquipment

- (NSSet*) _requiresAnyEquipment
private

Definition at line 72 of file OOEquipmentType.h.

Referenced by dealloc, and requiresAnyEquipment.

◆ _requiresClean

- (unsigned) _requiresClean
private

Definition at line 52 of file OOEquipmentType.h.

Referenced by requiresCleanLegalRecord.

◆ _requiresEmptyPylon

- (unsigned) _requiresEmptyPylon
private

Definition at line 50 of file OOEquipmentType.h.

Referenced by requiresEmptyPylon.

◆ _requiresEquipment

- (NSSet*) _requiresEquipment
private

Definition at line 71 of file OOEquipmentType.h.

Referenced by dealloc, and requiresEquipment.

◆ _requiresFreePassengerBerth

- (unsigned) _requiresFreePassengerBerth
private

Definition at line 55 of file OOEquipmentType.h.

Referenced by requiresFreePassengerBerth.

◆ _requiresFullFuel

- (unsigned) _requiresFullFuel
private

Definition at line 56 of file OOEquipmentType.h.

Referenced by requiresFullFuel.

◆ _requiresMountedPylon

- (unsigned) _requiresMountedPylon
private

Definition at line 51 of file OOEquipmentType.h.

Referenced by requiresMountedPylon.

◆ _requiresNonFullFuel

- (unsigned) _requiresNonFullFuel
private

Definition at line 57 of file OOEquipmentType.h.

Referenced by requiresNonFullFuel.

◆ _requiresNotClean

- (unsigned) _requiresNotClean
private

Definition at line 53 of file OOEquipmentType.h.

Referenced by requiresNonCleanLegalRecord.

◆ _script

- (NSString*) _script
private

Definition at line 80 of file OOEquipmentType.h.

Referenced by dealloc, and scriptName.

◆ _scriptInfo

- (NSDictionary*) _scriptInfo
private

Definition at line 78 of file OOEquipmentType.h.

Referenced by dealloc, and scriptInfo.

◆ _techLevel

- (OOTechLevelID) _techLevel
private

Definition at line 44 of file OOEquipmentType.h.

Referenced by techLevel.

◆ _weaponInfo

- (NSDictionary*) _weaponInfo
private

Definition at line 79 of file OOEquipmentType.h.

Referenced by dealloc, and weaponInfo.


The documentation for this class was generated from the following files: