Oolite
Loading...
Searching...
No Matches
OOShipLibraryDescriptions.h File Reference
import "ShipEntity.h"
Include dependency graph for OOShipLibraryDescriptions.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

NSString * OOShipLibraryCategorySingular (NSString *category)
NSString * OOShipLibraryCategoryPlural (NSString *category)
NSString * OOShipLibrarySpeed (ShipEntity *demo_ship)
NSString * OOShipLibraryTurnRate (ShipEntity *demo_ship)
NSString * OOShipLibraryCargo (ShipEntity *demo_ship)
NSString * OOShipLibraryGenerator (ShipEntity *demo_ship)
NSString * OOShipLibraryShields (ShipEntity *demo_ship)
NSString * OOShipLibraryWitchspace (ShipEntity *demo_ship)
NSString * OOShipLibraryWeapons (ShipEntity *demo_ship)
NSString * OOShipLibraryTurrets (ShipEntity *demo_ship)
NSString * OOShipLibrarySize (ShipEntity *demo_ship)

Variables

static NSString *const kOODemoShipKey = @"@"ship"
static NSString *const kOODemoShipName = @"@"name"
static NSString *const kOODemoShipClass = @"@"class"
static NSString *const kOODemoShipSummary = @"@"summary"
static NSString *const kOODemoShipDescription = @"@"description"
static NSString *const kOODemoShipShipData = @"@"ship_data"
static NSString *const kOODemoShipSpeed = @"@"speed"
static NSString *const kOODemoShipTurnRate = @"@"turn_rate"
static NSString *const kOODemoShipCargo = @"@"cargo"
static NSString *const kOODemoShipGenerator = @"@"generator"
static NSString *const kOODemoShipShields = @"@"shields"
static NSString *const kOODemoShipWitchspace = @"@"witchspace"
static NSString *const kOODemoShipWeapons = @"@"weapons"
static NSString *const kOODemoShipTurrets = @"@"turrets"
static NSString *const kOODemoShipSize = @"@"size"
static NSString *const kOODemoShipConditions = @"@"condition_script"

Function Documentation

◆ OOShipLibraryCargo()

NSString * OOShipLibraryCargo ( ShipEntity * demo_ship)

Definition at line 77 of file OOShipLibraryDescriptions.m.

78{
79 OOCargoQuantity param = [demo_ship maxAvailableCargoSpace];
80 NSString* result = nil;
81 if (param == 0) {
82 result = DESC(@"oolite-ship-library-cargo-none");
83 } else {
84 result = [NSString stringWithFormat:DESC(@"oolite-ship-library-cargo-carried-u"), param];
85 }
86 return result;
87}
return nil
uint32_t OOCargoQuantity
Definition OOTypes.h:155
#define DESC(key)
Definition Universe.h:832

References DESC, ShipEntity::maxAvailableCargoSpace, and nil.

Referenced by Universe(OOPrivate)::setLibraryTextForDemoShip.

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

◆ OOShipLibraryCategoryPlural()

NSString * OOShipLibraryCategoryPlural ( NSString * category)

Definition at line 34 of file OOShipLibraryDescriptions.m.

35{
36 return OOExpandKey(OOExpand(@"oolite-ship-library-category-plural-[category]", category));
37}
#define OOExpandKey(key,...)
#define OOExpand(string,...)

References OOExpand, and OOExpandKey.

Referenced by Universe(OOPrivate)::setLibraryTextForDemoShip.

Here is the caller graph for this function:

◆ OOShipLibraryCategorySingular()

NSString * OOShipLibraryCategorySingular ( NSString * category)

Definition at line 29 of file OOShipLibraryDescriptions.m.

30{
31 return OOExpandKey(OOExpand(@"oolite-ship-library-category-[category]", category));
32}

References OOExpand, and OOExpandKey.

Referenced by Universe(OOPrivate)::setLibraryTextForDemoShip.

Here is the caller graph for this function:

◆ OOShipLibraryGenerator()

NSString * OOShipLibraryGenerator ( ShipEntity * demo_ship)

Definition at line 89 of file OOShipLibraryDescriptions.m.

90{
91 float rate = [demo_ship energyRechargeRate];
92 NSString* result = nil;
93 if (rate < 2.5) {
94 result = DESC(@"oolite-ship-library-generator-weak");
95 } else if (rate < 3.75) {
96 result = DESC(@"oolite-ship-library-generator-average");
97 } else {
98 result = DESC(@"oolite-ship-library-generator-strong");
99 }
100 return result;
101}

References DESC, ShipEntity::energyRechargeRate, and nil.

Referenced by Universe(OOPrivate)::setLibraryTextForDemoShip.

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

◆ OOShipLibraryShields()

NSString * OOShipLibraryShields ( ShipEntity * demo_ship)

Definition at line 103 of file OOShipLibraryDescriptions.m.

104{
105 // when NPCs have actual shields, add those on as well
106 float shields = [demo_ship maxEnergy];
107 NSString* result = nil;
108 if (shields < 128) {
109 result = DESC(@"oolite-ship-library-shields-veryweak");
110 } else if (shields < 192) {
111 result = DESC(@"oolite-ship-library-shields-weak");
112 } else if (shields < 256) {
113 result = DESC(@"oolite-ship-library-shields-average");
114 } else if (shields < 320) {
115 result = DESC(@"oolite-ship-library-shields-strong");
116 } else {
117 result = DESC(@"oolite-ship-library-shields-verystrong");
118 }
119 return result;
120}

References DESC, Entity::maxEnergy, and nil.

Referenced by Universe(OOPrivate)::setLibraryTextForDemoShip.

Here is the caller graph for this function:

◆ OOShipLibrarySize()

NSString * OOShipLibrarySize ( ShipEntity * demo_ship)

Definition at line 152 of file OOShipLibraryDescriptions.m.

153{
154 BoundingBox bb = [demo_ship totalBoundingBox];
155 return [NSString stringWithFormat:DESC(@"oolite-ship-library-size-u-u-u"), (unsigned)(bb.max.x - bb.min.x), (unsigned)(bb.max.y - bb.min.y), (unsigned)(bb.max.z - bb.min.z)];
156}
OOScalar x
Definition OOVector.h:32
OOScalar y
Definition OOVector.h:33
OOScalar z
Definition OOVector.h:34

References ShipEntity::totalBoundingBox.

Referenced by Universe(OOPrivate)::setLibraryTextForDemoShip.

Here is the caller graph for this function:

◆ OOShipLibrarySpeed()

NSString * OOShipLibrarySpeed ( ShipEntity * demo_ship)

Definition at line 39 of file OOShipLibraryDescriptions.m.

40{
41 GLfloat param = [demo_ship maxFlightSpeed];
42 NSString* result = nil;
43 if (param <= 1) {
44 result = DESC(@"oolite-ship-library-speed-stationary");
45 } else if (param <= 150) {
46 result = DESC(@"oolite-ship-library-speed-veryslow");
47 } else if (param <= 250) {
48 result = DESC(@"oolite-ship-library-speed-slow");
49 } else if (param <= 325) {
50 result = DESC(@"oolite-ship-library-speed-average");
51 } else if (param <= 425) {
52 result = DESC(@"oolite-ship-library-speed-fast");
53 } else {
54 result = DESC(@"oolite-ship-library-speed-veryfast");
55 }
56 return result;
57}

References DESC, ShipEntity::maxFlightSpeed, and nil.

Referenced by Universe(OOPrivate)::setLibraryTextForDemoShip.

Here is the caller graph for this function:

◆ OOShipLibraryTurnRate()

NSString * OOShipLibraryTurnRate ( ShipEntity * demo_ship)

Definition at line 59 of file OOShipLibraryDescriptions.m.

60{
61 GLfloat param = [demo_ship maxFlightRoll] + (2 * [demo_ship maxFlightPitch]);
62 NSString* result = nil;
63 if (param <= 2) {
64 result = DESC(@"oolite-ship-library-turn-veryslow");
65 } else if (param <= 2.75) {
66 result = DESC(@"oolite-ship-library-turn-slow");
67 } else if (param <= 4.5) {
68 result = DESC(@"oolite-ship-library-turn-average");
69 } else if (param <= 6) {
70 result = DESC(@"oolite-ship-library-turn-fast");
71 } else {
72 result = DESC(@"oolite-ship-library-turn-veryfast");
73 }
74 return result;
75}

References DESC, ShipEntity::maxFlightPitch, ShipEntity::maxFlightRoll, and nil.

Referenced by Universe(OOPrivate)::setLibraryTextForDemoShip.

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

◆ OOShipLibraryTurrets()

NSString * OOShipLibraryTurrets ( ShipEntity * demo_ship)

Definition at line 142 of file OOShipLibraryDescriptions.m.

143{
144 NSUInteger turretCount = [demo_ship turretCount];
145 if (turretCount > 0) {
146 return [NSString stringWithFormat:DESC(@"oolite-ship-library-turrets-u"), turretCount];
147 } else {
148 return @"";
149 }
150}

References ShipEntity::turretCount.

Referenced by Universe(OOPrivate)::setLibraryTextForDemoShip.

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

◆ OOShipLibraryWeapons()

NSString * OOShipLibraryWeapons ( ShipEntity * demo_ship)

Definition at line 131 of file OOShipLibraryDescriptions.m.

132{
133 OOWeaponFacingSet facings = [demo_ship weaponFacings];
134 NSUInteger fixed = (facings & 1) + (facings & 2) / 2 + (facings & 4) / 4 + (facings & 8) / 8;
135 NSUInteger pylons = [demo_ship missileCapacity];
136 if (fixed == 0 && pylons == 0) {
137 return DESC(@"oolite-ship-library-weapons-none");
138 }
139 return [NSString stringWithFormat:DESC(@"oolite-ship-library-weapons-u-u"), fixed, pylons];
140}
uint8_t OOWeaponFacingSet
Definition OOTypes.h:204

References DESC, ShipEntity::missileCapacity, and ShipEntity::weaponFacings.

Referenced by Universe(OOPrivate)::setLibraryTextForDemoShip.

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

◆ OOShipLibraryWitchspace()

NSString * OOShipLibraryWitchspace ( ShipEntity * demo_ship)

Definition at line 122 of file OOShipLibraryDescriptions.m.

123{
124 if ([demo_ship hasHyperspaceMotor]) {
125 return DESC(@"oolite-ship-library-witchspace-yes");
126 } else {
127 return DESC(@"oolite-ship-library-witchspace-no");
128 }
129}

References DESC.

Referenced by Universe(OOPrivate)::setLibraryTextForDemoShip.

Here is the caller graph for this function:

Variable Documentation

◆ kOODemoShipCargo

NSString* const kOODemoShipCargo = @"@"cargo"
static

Definition at line 37 of file OOShipLibraryDescriptions.h.

◆ kOODemoShipClass

NSString* const kOODemoShipClass = @"@"class"
static

◆ kOODemoShipConditions

NSString* const kOODemoShipConditions = @"@"condition_script"
static

Definition at line 44 of file OOShipLibraryDescriptions.h.

◆ kOODemoShipDescription

NSString* const kOODemoShipDescription = @"@"description"
static

Definition at line 33 of file OOShipLibraryDescriptions.h.

◆ kOODemoShipGenerator

NSString* const kOODemoShipGenerator = @"@"generator"
static

Definition at line 38 of file OOShipLibraryDescriptions.h.

◆ kOODemoShipKey

NSString* const kOODemoShipKey = @"@"ship"
static

◆ kOODemoShipName

NSString* const kOODemoShipName = @"@"name"
static

Definition at line 30 of file OOShipLibraryDescriptions.h.

◆ kOODemoShipShields

NSString* const kOODemoShipShields = @"@"shields"
static

Definition at line 39 of file OOShipLibraryDescriptions.h.

◆ kOODemoShipShipData

NSString* const kOODemoShipShipData = @"@"ship_data"
static

◆ kOODemoShipSize

NSString* const kOODemoShipSize = @"@"size"
static

Definition at line 43 of file OOShipLibraryDescriptions.h.

◆ kOODemoShipSpeed

NSString* const kOODemoShipSpeed = @"@"speed"
static

Definition at line 35 of file OOShipLibraryDescriptions.h.

◆ kOODemoShipSummary

NSString* const kOODemoShipSummary = @"@"summary"
static

Definition at line 32 of file OOShipLibraryDescriptions.h.

◆ kOODemoShipTurnRate

NSString* const kOODemoShipTurnRate = @"@"turn_rate"
static

Definition at line 36 of file OOShipLibraryDescriptions.h.

◆ kOODemoShipTurrets

NSString* const kOODemoShipTurrets = @"@"turrets"
static

Definition at line 42 of file OOShipLibraryDescriptions.h.

◆ kOODemoShipWeapons

NSString* const kOODemoShipWeapons = @"@"weapons"
static

Definition at line 41 of file OOShipLibraryDescriptions.h.

◆ kOODemoShipWitchspace

NSString* const kOODemoShipWitchspace = @"@"witchspace"
static

Definition at line 40 of file OOShipLibraryDescriptions.h.