Oolite
Loading...
Searching...
No Matches
ShipEntity.h File Reference
import "OOEntityWithDrawable.h"
import "OOJSPropID.h"
import "OOPlanetEntity.h"
#include "OOBehaviour.tbl"
#include "OOShipDamageType.tbl"
Include dependency graph for ShipEntity.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ShipEntity
category  Entity(SubEntityRelationship)

Macros

#define MAX_TARGETS   24
#define RAIDER_MAX_CARGO   5
#define MERCHANTMAN_MAX_CARGO   125
#define PIRATES_PREFER_PLAYER   YES
#define TURRET_MINIMUM_COS   0.20f
#define SHIP_THRUST_FACTOR   5.0f
#define AFTERBURNER_BURNRATE   0.25f
#define CLOAKING_DEVICE_ENERGY_RATE   12.8f
#define CLOAKING_DEVICE_MIN_ENERGY   128
#define CLOAKING_DEVICE_START_ENERGY   0.75f
#define MILITARY_JAMMER_ENERGY_RATE   3
#define MILITARY_JAMMER_MIN_ENERGY   128
#define COMBAT_IN_RANGE_FACTOR   0.035f
#define COMBAT_BROADSIDE_IN_RANGE_FACTOR   0.020f
#define COMBAT_OUT_RANGE_FACTOR   0.500f
#define COMBAT_BROADSIDE_RANGE_FACTOR   0.900f
#define COMBAT_WEAPON_RANGE_FACTOR   1.200f
#define COMBAT_JINK_OFFSET   500.0f
#define SHIP_COOLING_FACTOR   0.1f
#define SHIP_ENERGY_DAMAGE_TO_HEAT_FACTOR   (mass > 400000 ? 200000 / mass : 0.5)
#define SHIP_INSULATION_FACTOR   0.00175f
#define SHIP_MAX_CABIN_TEMP   256.0f
#define SHIP_MIN_CABIN_TEMP   60.0f
#define EJECTA_TEMP_FACTOR   0.85f
#define DEFAULT_HYPERSPACE_SPIN_TIME   15.0f
#define SUN_TEMPERATURE   1250.0f
#define MAX_ESCORTS   16
#define ESCORT_SPACING_FACTOR   3.0
#define SHIPENTITY_MAX_MISSILES   32
#define TURRET_TYPICAL_ENERGY   25.0f
#define TURRET_SHOT_SPEED   2000.0f
#define TURRET_SHOT_DURATION   3.0
#define TURRET_SHOT_RANGE   (TURRET_SHOT_SPEED * TURRET_SHOT_DURATION)
#define TURRET_SHOT_FREQUENCY   (TURRET_SHOT_DURATION * TURRET_SHOT_DURATION * TURRET_SHOT_DURATION / 100.0)
#define NPC_PLASMA_SPEED   1500.0f
#define MAIN_PLASMA_DURATION   5.0
#define NPC_PLASMA_RANGE   (MAIN_PLASMA_DURATION * NPC_PLASMA_SPEED)
#define PLAYER_PLASMA_SPEED   1000.0f
#define PLAYER_PLASMA_RANGE   (MAIN_PLASMA_DURATION * PLAYER_PLASMA_SPEED)
#define TRACTOR_FORCE   2500.0f
#define AIMS_AGGRESSOR_SWITCHED_TARGET   @"AGGRESSOR_SWITCHED_TARGET"
#define MAX_SCAN_NUMBER   32
#define BASELINE_SHIELD_LEVEL   128.0f
#define INITIAL_SHOT_TIME   100.0
#define MIN_FUEL   0
#define MAX_JUMP_RANGE   7.0
#define ENTITY_PERSONALITY_MAX   0x7FFFU
#define ENTITY_PERSONALITY_INVALID   0xFFFFU
#define WEAPON_COOLING_FACTOR   6.0f
#define NPC_MAX_WEAPON_TEMP   256.0f
#define WEAPON_COOLING_CUTOUT   0.85f
#define COMBAT_AI_WEAPON_TEMP_READY   0.25f * NPC_MAX_WEAPON_TEMP
#define COMBAT_AI_WEAPON_TEMP_USABLE   WEAPON_COOLING_CUTOUT* NPC_MAX_WEAPON_TEMP
#define COMBAT_AI_CONFIDENCE_FACTOR   1250000.0f
#define COMBAT_AI_ISNT_AWFUL   0.0f
#define COMBAT_AI_IS_SMART   5.0f
#define COMBAT_AI_FLEES_BETTER   6.0f
#define COMBAT_AI_DOGFIGHTER   6.5f
#define COMBAT_AI_TRACKS_CLOSER   7.5f
#define COMBAT_AI_USES_SNIPING   8.5f
#define COMBAT_AI_FLEES_BETTER_2   9.0f
#define COMBAT_AI_STANDARD_REACTION_TIME   1.5f
#define MAX_LANDING_SPEED   50.0
#define MAX_LANDING_SPEED2   (MAX_LANDING_SPEED * MAX_LANDING_SPEED)
#define MAX_COS   0.995
#define MAX_COS2   (MAX_COS * MAX_COS)
#define ENTRY(label, value)
#define DIFF_STRING_ENTRY(label, string)
#define ShipScriptEvent(context, ship, event, ...)
#define ShipScriptEventNoCx(ship, event, ...)

Typedefs

typedef enum OOBehaviour OOBehaviour
typedef OOEquipmentType * OOWeaponType

Enumerations

enum  OOBehaviour
enum  OOAlertCondition { ALERT_CONDITION_DOCKED = 0 , ALERT_CONDITION_GREEN = 1 , ALERT_CONDITION_YELLOW = 2 , ALERT_CONDITION_RED = 3 }
enum  OOShipDamageType { kOOShipDamageTypeDefault = kOODamageTypeEnergy }

Functions

NSDictionary * OODefaultShipShaderMacros (void)
GLfloat getWeaponRangeFromType (OOWeaponType weapon_type)
NSString * OOStringFromBehaviour (OOBehaviour behaviour) CONST_FUNC
NSString * OOEquipmentIdentifierFromWeaponType (OOWeaponType weapon) CONST_FUNC
OOWeaponType OOWeaponTypeFromEquipmentIdentifierSloppy (NSString *string) PURE_FUNC
OOWeaponType OOWeaponTypeFromEquipmentIdentifierStrict (NSString *string) PURE_FUNC
OOWeaponType OOWeaponTypeFromEquipmentIdentifierLegacy (NSString *string)
NSString * OOStringFromWeaponType (OOWeaponType weapon) CONST_FUNC
OOWeaponType OOWeaponTypeFromString (NSString *string) PURE_FUNC
BOOL isWeaponNone (OOWeaponType weapon)
NSString * OODisplayStringFromAlertCondition (OOAlertCondition alertCondition)
NSString * OOStringFromShipDamageType (OOShipDamageType type) CONST_FUNC

Macro Definition Documentation

◆ AFTERBURNER_BURNRATE

#define AFTERBURNER_BURNRATE   0.25f

Definition at line 47 of file ShipEntity.h.

◆ AIMS_AGGRESSOR_SWITCHED_TARGET

#define AIMS_AGGRESSOR_SWITCHED_TARGET   @"AGGRESSOR_SWITCHED_TARGET"

Definition at line 96 of file ShipEntity.h.

Referenced by ShipEntity::interpretAIMessage:.

◆ BASELINE_SHIELD_LEVEL

◆ CLOAKING_DEVICE_ENERGY_RATE

#define CLOAKING_DEVICE_ENERGY_RATE   12.8f

Definition at line 49 of file ShipEntity.h.

Referenced by PlayerEntity::doBookkeeping:, and ShipEntity::update:.

◆ CLOAKING_DEVICE_MIN_ENERGY

#define CLOAKING_DEVICE_MIN_ENERGY   128

Definition at line 50 of file ShipEntity.h.

Referenced by PlayerEntity::doBookkeeping:, and ShipEntity::update:.

◆ CLOAKING_DEVICE_START_ENERGY

#define CLOAKING_DEVICE_START_ENERGY   0.75f

Definition at line 51 of file ShipEntity.h.

Referenced by ShipEntity::activateCloakingDevice.

◆ COMBAT_AI_CONFIDENCE_FACTOR

#define COMBAT_AI_CONFIDENCE_FACTOR   1250000.0f

◆ COMBAT_AI_DOGFIGHTER

#define COMBAT_AI_DOGFIGHTER   6.5f

Definition at line 130 of file ShipEntity.h.

Referenced by ShipEntity::behaviour_attack_break_off_target:.

◆ COMBAT_AI_FLEES_BETTER

#define COMBAT_AI_FLEES_BETTER   6.0f

◆ COMBAT_AI_FLEES_BETTER_2

#define COMBAT_AI_FLEES_BETTER_2   9.0f

◆ COMBAT_AI_IS_SMART

#define COMBAT_AI_IS_SMART   5.0f

◆ COMBAT_AI_ISNT_AWFUL

◆ COMBAT_AI_STANDARD_REACTION_TIME

#define COMBAT_AI_STANDARD_REACTION_TIME   1.5f

Definition at line 137 of file ShipEntity.h.

◆ COMBAT_AI_TRACKS_CLOSER

#define COMBAT_AI_TRACKS_CLOSER   7.5f

◆ COMBAT_AI_USES_SNIPING

#define COMBAT_AI_USES_SNIPING   8.5f

Definition at line 133 of file ShipEntity.h.

◆ COMBAT_AI_WEAPON_TEMP_READY

#define COMBAT_AI_WEAPON_TEMP_READY   0.25f * NPC_MAX_WEAPON_TEMP

◆ COMBAT_AI_WEAPON_TEMP_USABLE

◆ COMBAT_BROADSIDE_IN_RANGE_FACTOR

#define COMBAT_BROADSIDE_IN_RANGE_FACTOR   0.020f

◆ COMBAT_BROADSIDE_RANGE_FACTOR

#define COMBAT_BROADSIDE_RANGE_FACTOR   0.900f

◆ COMBAT_IN_RANGE_FACTOR

◆ COMBAT_JINK_OFFSET

#define COMBAT_JINK_OFFSET   500.0f

Definition at line 61 of file ShipEntity.h.

◆ COMBAT_OUT_RANGE_FACTOR

◆ COMBAT_WEAPON_RANGE_FACTOR

◆ DEFAULT_HYPERSPACE_SPIN_TIME

#define DEFAULT_HYPERSPACE_SPIN_TIME   15.0f

Definition at line 72 of file ShipEntity.h.

Referenced by PlayerEntity(OOControlsPrivate)::pollFlightControls:.

◆ DIFF_STRING_ENTRY

#define DIFF_STRING_ENTRY ( label,
string )
Value:
label,

Definition at line 176 of file ShipEntity.h.

◆ EJECTA_TEMP_FACTOR

#define EJECTA_TEMP_FACTOR   0.85f

Definition at line 71 of file ShipEntity.h.

◆ ENTITY_PERSONALITY_INVALID

#define ENTITY_PERSONALITY_INVALID   0xFFFFU

◆ ENTITY_PERSONALITY_MAX

◆ ENTRY

#define ENTRY ( label,
value )
Value:
label = value,

Definition at line 145 of file ShipEntity.h.

◆ ESCORT_SPACING_FACTOR

#define ESCORT_SPACING_FACTOR   3.0

Definition at line 77 of file ShipEntity.h.

◆ INITIAL_SHOT_TIME

◆ MAIN_PLASMA_DURATION

#define MAIN_PLASMA_DURATION   5.0

Definition at line 88 of file ShipEntity.h.

◆ MAX_COS

◆ MAX_COS2

#define MAX_COS2   (MAX_COS * MAX_COS)

Definition at line 143 of file ShipEntity.h.

Referenced by ShipEntity::behaviour_land_on_planet:.

◆ MAX_ESCORTS

◆ MAX_JUMP_RANGE

◆ MAX_LANDING_SPEED

#define MAX_LANDING_SPEED   50.0

Definition at line 139 of file ShipEntity.h.

◆ MAX_LANDING_SPEED2

#define MAX_LANDING_SPEED2   (MAX_LANDING_SPEED * MAX_LANDING_SPEED)

Definition at line 140 of file ShipEntity.h.

Referenced by ShipEntity::behaviour_land_on_planet:.

◆ MAX_SCAN_NUMBER

#define MAX_SCAN_NUMBER   32

Definition at line 99 of file ShipEntity.h.

Referenced by ShipEntity::checkScanner, and ShipEntity::checkScannerIgnoringUnpowered.

◆ MAX_TARGETS

#define MAX_TARGETS   24

Definition at line 38 of file ShipEntity.h.

Referenced by ShipEntity::addDefenseTarget:.

◆ MERCHANTMAN_MAX_CARGO

#define MERCHANTMAN_MAX_CARGO   125

Definition at line 40 of file ShipEntity.h.

◆ MILITARY_JAMMER_ENERGY_RATE

#define MILITARY_JAMMER_ENERGY_RATE   3

Definition at line 53 of file ShipEntity.h.

Referenced by PlayerEntity::doBookkeeping:, and ShipEntity::update:.

◆ MILITARY_JAMMER_MIN_ENERGY

#define MILITARY_JAMMER_MIN_ENERGY   128

Definition at line 54 of file ShipEntity.h.

Referenced by PlayerEntity::doBookkeeping:, and ShipEntity::update:.

◆ MIN_FUEL

◆ NPC_MAX_WEAPON_TEMP

◆ NPC_PLASMA_RANGE

#define NPC_PLASMA_RANGE   (MAIN_PLASMA_DURATION * NPC_PLASMA_SPEED)

Definition at line 89 of file ShipEntity.h.

◆ NPC_PLASMA_SPEED

#define NPC_PLASMA_SPEED   1500.0f

Definition at line 87 of file ShipEntity.h.

◆ PIRATES_PREFER_PLAYER

#define PIRATES_PREFER_PLAYER   YES

Definition at line 42 of file ShipEntity.h.

Referenced by ShipEntity(PureAI)::scanForNearestMerchantman.

◆ PLAYER_PLASMA_RANGE

#define PLAYER_PLASMA_RANGE   (MAIN_PLASMA_DURATION * PLAYER_PLASMA_SPEED)

Definition at line 92 of file ShipEntity.h.

◆ PLAYER_PLASMA_SPEED

#define PLAYER_PLASMA_SPEED   1000.0f

Definition at line 91 of file ShipEntity.h.

◆ RAIDER_MAX_CARGO

#define RAIDER_MAX_CARGO   5

Definition at line 39 of file ShipEntity.h.

◆ SHIP_COOLING_FACTOR

#define SHIP_COOLING_FACTOR   0.1f

Definition at line 63 of file ShipEntity.h.

Referenced by PlayerEntity::doBookkeeping:, and ShipEntity::update:.

◆ SHIP_ENERGY_DAMAGE_TO_HEAT_FACTOR

#define SHIP_ENERGY_DAMAGE_TO_HEAT_FACTOR   (mass > 400000 ? 200000 / mass : 0.5)

◆ SHIP_INSULATION_FACTOR

#define SHIP_INSULATION_FACTOR   0.00175f

Definition at line 68 of file ShipEntity.h.

Referenced by PlayerEntity::doBookkeeping:, and ShipEntity::update:.

◆ SHIP_MAX_CABIN_TEMP

◆ SHIP_MIN_CABIN_TEMP

◆ SHIP_THRUST_FACTOR

◆ SHIPENTITY_MAX_MISSILES

#define SHIPENTITY_MAX_MISSILES   32

Definition at line 79 of file ShipEntity.h.

◆ ShipScriptEvent

#define ShipScriptEvent ( context,
ship,
event,
... )
Value:
do { \
OOJSVal argv[] = { __VA_ARGS__ }; \
int argc = sizeof argv / sizeof *argv; \
[ship doScriptEvent:OOJSID(event) inContext:context withArguments:argv count:argc]; \
for (int oojsArgIndex = 0; oojsArgIndex < argc; oojsArgIndex++) { \
OOJSFreeValue(context, argv[oojsArgIndex]); \
} \
} while (0)
#define OOJSID(str)
Definition OOJSPropID.h:42
jsval OOJSVal
unsigned count

Definition at line 1252 of file ShipEntity.h.

1252#define ShipScriptEvent(context, ship, event, ...) \
1253 do { \
1254 OOJSVal argv[] = { __VA_ARGS__ }; \
1255 int argc = sizeof argv / sizeof *argv; \
1256 [ship doScriptEvent:OOJSID(event) inContext:context withArguments:argv count:argc]; \
1257 for (int oojsArgIndex = 0; oojsArgIndex < argc; oojsArgIndex++) { \
1258 OOJSFreeValue(context, argv[oojsArgIndex]); \
1259 } \
1260 } while (0)

Referenced by Universe::carryPlayerOn:inWormhole:, PlayerEntity::cycleNextMultiFunctionDisplay:, PlayerEntity::cyclePreviousMultiFunctionDisplay:, PlayerEntity::enterGalacticWitchspace, Universe::enterGUIViewModeWithMouseInteraction:, PlayerEntity::enterWitchspace, PlayerEntity::enterWormhole:, PlayerEntity::markAsOffender:withReason:, ShipEntity::markAsOffender:withReason:, PlayerEntity(OOPrivate)::noteCompassLostTarget, PlayerEntity::noteGUIDidChangeFrom:to:refresh:, PlayerEntity::noteGUIWillChangeTo:, ShipEntity::noteKilledBy:damageType:, ShipEntity::noteTakingDamage:from:type:, PlayerEntity::selectNextMultiFunctionDisplay, PlayerEntity::selectPreviousMultiFunctionDisplay, PlayerEntity::setBounty:withReasonAsString:, ShipEntity::setBounty:withReasonAsString:, PlayerEntity::setInfoSystemID:moveChart:, PlayerEntity(OOControlsPrivate)::switchToThisView:fromView:andProcessWeaponFacing:justNotify:, and OOECMBlastEntity::update:.

◆ ShipScriptEventNoCx

#define ShipScriptEventNoCx ( ship,
event,
... )
Value:
do { \
JSContext* oojsEventContext = OOJSAcquireContext(); \
ShipScriptEvent(oojsEventContext, ship, event, ##__VA_ARGS__); \
OOJSRelinquishContext(oojsEventContext); \
} while (0)
OOINLINE JSContext * OOJSAcquireContext(void)

Definition at line 1262 of file ShipEntity.h.

1262#define ShipScriptEventNoCx(ship, event, ...) \
1263 do { \
1264 JSContext* oojsEventContext = OOJSAcquireContext(); \
1265 ShipScriptEvent(oojsEventContext, ship, event, ##__VA_ARGS__); \
1266 OOJSRelinquishContext(oojsEventContext); \
1267 } while (0)

◆ SUN_TEMPERATURE

#define SUN_TEMPERATURE   1250.0f

Definition at line 74 of file ShipEntity.h.

Referenced by PlayerEntity::doBookkeeping:, and ShipEntity::update:.

◆ TRACTOR_FORCE

#define TRACTOR_FORCE   2500.0f

Definition at line 94 of file ShipEntity.h.

Referenced by ShipEntity::behaviour_tractored:.

◆ TURRET_MINIMUM_COS

#define TURRET_MINIMUM_COS   0.20f

Definition at line 44 of file ShipEntity.h.

Referenced by ShipEntity::ballTrackLeadingTarget:atTarget:.

◆ TURRET_SHOT_DURATION

#define TURRET_SHOT_DURATION   3.0

Definition at line 83 of file ShipEntity.h.

◆ TURRET_SHOT_FREQUENCY

#define TURRET_SHOT_FREQUENCY   (TURRET_SHOT_DURATION * TURRET_SHOT_DURATION * TURRET_SHOT_DURATION / 100.0)

Definition at line 85 of file ShipEntity.h.

◆ TURRET_SHOT_RANGE

◆ TURRET_SHOT_SPEED

#define TURRET_SHOT_SPEED   2000.0f

◆ TURRET_TYPICAL_ENERGY

#define TURRET_TYPICAL_ENERGY   25.0f

Definition at line 81 of file ShipEntity.h.

◆ WEAPON_COOLING_CUTOUT

#define WEAPON_COOLING_CUTOUT   0.85f

◆ WEAPON_COOLING_FACTOR

#define WEAPON_COOLING_FACTOR   6.0f

Definition at line 115 of file ShipEntity.h.

Referenced by PlayerEntity::doBookkeeping:, and ShipEntity::update:.

Typedef Documentation

◆ OOBehaviour

typedef enum OOBehaviour OOBehaviour

◆ OOWeaponType

Definition at line 164 of file ShipEntity.h.

Enumeration Type Documentation

◆ OOAlertCondition

Enumerator
ALERT_CONDITION_DOCKED 
ALERT_CONDITION_GREEN 
ALERT_CONDITION_YELLOW 
ALERT_CONDITION_RED 

Definition at line 166 of file ShipEntity.h.

166 {
167 // Alert conditions are used by player and station entities.
168 // NOTE: numerical values are available to scripts and shaders.
OOAlertCondition
Definition ShipEntity.h:166
@ ALERT_CONDITION_GREEN
Definition ShipEntity.h:170
@ ALERT_CONDITION_RED
Definition ShipEntity.h:172
@ ALERT_CONDITION_YELLOW
Definition ShipEntity.h:171
@ ALERT_CONDITION_DOCKED
Definition ShipEntity.h:169

◆ OOBehaviour

Definition at line 147 of file ShipEntity.h.

147 {
148#include "OOBehaviour.tbl"
OOBehaviour
Definition ShipEntity.h:147

◆ OOShipDamageType

Enumerator
kOOShipDamageTypeDefault 

Definition at line 175 of file ShipEntity.h.

175 {
176#define DIFF_STRING_ENTRY(label, string) label,
177#include "OOShipDamageType.tbl"
178#undef DIFF_STRING_ENTRY
179
180 kOOShipDamageTypeDefault = kOODamageTypeEnergy
OOShipDamageType
Definition ShipEntity.h:175
@ kOOShipDamageTypeDefault
Definition ShipEntity.h:180

Function Documentation

◆ getWeaponRangeFromType()

GLfloat getWeaponRangeFromType ( OOWeaponType weapon_type)

Definition at line 13056 of file ShipEntity.m.

13057{
13058 return [weapon_type weaponRange];
13059}

References OOEquipmentType::weaponRange.

Referenced by ShipEntity::behaviour_attack_broadside_target:leftside:, ShipEntity::behaviour_attack_target:, and ShipEntity::setWeaponDataFromType:.

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

◆ isWeaponNone()

BOOL isWeaponNone ( OOWeaponType weapon)

◆ OODefaultShipShaderMacros()

NSDictionary * OODefaultShipShaderMacros ( void )

Definition at line 13009 of file ShipEntity.m.

13010{
13011 static NSDictionary* macros = nil;
13012
13013 if (macros == nil) {
13014 macros = [[[ResourceManager materialDefaults] oo_dictionaryForKey:@"ship-prefix-macros" defaultValue:[NSDictionary dictionary]] retain];
13015 }
13016
13017 return macros;
13018}

References ResourceManager::materialDefaults, and nil.

Here is the call graph for this function:

◆ OODisplayStringFromAlertCondition()

NSString * OODisplayStringFromAlertCondition ( OOAlertCondition alertCondition)

Definition at line 428 of file OOConstToString.m.

429{
430 NSArray* conditionNames = [[UNIVERSE descriptions] oo_arrayForKey:@"condition"];
431 return [conditionNames oo_stringAtIndex:alertCondition];
432}
#define UNIVERSE
Definition Universe.h:827

Referenced by PlayerEntity::setGuiToStatusScreen.

Here is the caller graph for this function:

◆ OOEquipmentIdentifierFromWeaponType()

NSString * OOEquipmentIdentifierFromWeaponType ( OOWeaponType weapon)

Definition at line 267 of file OOConstToString.m.

268{
269 return [weapon identifier];
270}

References OOEquipmentType::identifier.

Referenced by Universe::tradeInValueForCommanderDictionary:.

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

◆ OOStringFromBehaviour()

NSString * OOStringFromBehaviour ( OOBehaviour behaviour)

Definition at line 60 of file OOConstToString.m.

61{
62 switch (value) {
63#include "OOBehaviour.tbl"
64 }
65
66 return @"** BEHAVIOUR UNKNOWN **";
67}

Referenced by ShipEntity::update:.

Here is the caller graph for this function:

◆ OOStringFromShipDamageType()

NSString * OOStringFromShipDamageType ( OOShipDamageType type)

Definition at line 114 of file OOConstToString.m.

115{
116 switch (value) {
117#include "OOShipDamageType.tbl"
118 }
119
120 return @"UNDEFINED";
121}

Referenced by PlayerEntity::getDestroyedBy:damageType:.

Here is the caller graph for this function:

◆ OOStringFromWeaponType()

NSString * OOStringFromWeaponType ( OOWeaponType weapon)

Definition at line 253 of file OOConstToString.m.

254{
255 if (weapon == nil) {
256 return @"EQ_WEAPON_NONE";
257 } else {
258 return [weapon identifier];
259 }
260}

References OOEquipmentType::identifier, and nil.

Referenced by HeadUpDisplay(Private)::crosshairDefinitionForWeaponType:.

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

◆ OOWeaponTypeFromEquipmentIdentifierLegacy()

OOWeaponType OOWeaponTypeFromEquipmentIdentifierLegacy ( NSString * string)

Definition at line 289 of file OOConstToString.m.

290{
291 if ([string intValue] > 0) {
292 switch ([string intValue]) {
293 case 2:
294 return OOWeaponTypeFromEquipmentIdentifierSloppy(@"EQ_WEAPON_PULSE_LASER");
295 case 3:
296 return OOWeaponTypeFromEquipmentIdentifierSloppy(@"EQ_WEAPON_BEAM_LASER");
297 case 4:
298 return OOWeaponTypeFromEquipmentIdentifierSloppy(@"EQ_WEAPON_MINING_LASER");
299 case 5:
300 return OOWeaponTypeFromEquipmentIdentifierSloppy(@"EQ_WEAPON_MILITARY_LASER");
301 case 10:
302 return OOWeaponTypeFromEquipmentIdentifierSloppy(@"EQ_WEAPON_THARGOID_LASER");
303 default:
305 }
306 }
308}
OOWeaponType OOWeaponTypeFromEquipmentIdentifierSloppy(NSString *string)

References OOWeaponTypeFromEquipmentIdentifierSloppy().

Referenced by PlayerEntity::setCommanderDataFromDictionary:.

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

◆ OOWeaponTypeFromEquipmentIdentifierSloppy()

OOWeaponType OOWeaponTypeFromEquipmentIdentifierSloppy ( NSString * string)

Definition at line 272 of file OOConstToString.m.

273{
274 OOWeaponType w = [OOEquipmentType equipmentTypeWithIdentifier:string];
275 if (w == nil) {
276 if (![string hasPrefix:@"EQ_"]) {
277 w = [OOEquipmentType equipmentTypeWithIdentifier:[NSString stringWithFormat:@"EQ_%@", string]];
278 if (w != nil) {
279 return w;
280 }
281 }
282 return [OOEquipmentType equipmentTypeWithIdentifier:@"EQ_WEAPON_NONE"];
283 }
284 return w;
285}
OOEquipmentType * OOWeaponType
Definition ShipEntity.h:164

References OOEquipmentType::equipmentTypeWithIdentifier:, and nil.

Referenced by ShipEntity::behaviour_attack_target:, PlayerEntity(Contracts)::newShipCommonSetup:yardInfo:baseInfo:, OOWeaponTypeFromEquipmentIdentifierLegacy(), OOWeaponTypeFromEquipmentIdentifierStrict(), OOWeaponTypeFromString(), PlayerEntity(OOControlsPrivate)::pollGuiArrowKeyControls:, PlayerEntity::setCommanderDataFromDictionary:, Universe::shipsForSaleForSystem:withTL:atTime:, StationAddShipToShipyard(), and StationAddShipToShipyard().

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

◆ OOWeaponTypeFromEquipmentIdentifierStrict()

OOWeaponType OOWeaponTypeFromEquipmentIdentifierStrict ( NSString * string)

Definition at line 310 of file OOConstToString.m.

311{
312 // there is no difference between the two any more
314}

References OOWeaponTypeFromEquipmentIdentifierSloppy().

Referenced by ShipEntity::hasOneEquipmentItem:includeWeapons:whileLoading:, ShipEntity::setWeaponMount:toWeapon:, PlayerEntity::setWeaponMount:toWeapon:inContext:, and PlayerEntity(OOPrivate)::tryBuyingItem:.

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

◆ OOWeaponTypeFromString()

OOWeaponType OOWeaponTypeFromString ( NSString * string)

Definition at line 262 of file OOConstToString.m.

263{
265}

References OOWeaponTypeFromEquipmentIdentifierSloppy().

Here is the call graph for this function: