Oolite 1.91.0.7644-241112-7f5034b
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 101 of file OOShipLibraryDescriptions.m.

102{
103 OOCargoQuantity param = [demo_ship maxAvailableCargoSpace];
104 NSString *result = nil;
105 if (param == 0)
106 {
107 result = DESC(@"oolite-ship-library-cargo-none");
108 }
109 else
110 {
111 result = [NSString stringWithFormat:DESC(@"oolite-ship-library-cargo-carried-u"),param];
112 }
113 return result;
114}
return nil
uint32_t OOCargoQuantity
Definition OOTypes.h:176
#define DESC(key)
Definition Universe.h:839

References DESC, ShipEntity::maxAvailableCargoSpace, and nil.

+ Here is the call graph for this function:

◆ OOShipLibraryCategoryPlural()

NSString * OOShipLibraryCategoryPlural ( NSString * category)

Definition at line 35 of file OOShipLibraryDescriptions.m.

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

References OOExpand, and OOExpandKey.

◆ 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.

◆ OOShipLibraryGenerator()

NSString * OOShipLibraryGenerator ( ShipEntity * demo_ship)

Definition at line 117 of file OOShipLibraryDescriptions.m.

118{
119 float rate = [demo_ship energyRechargeRate];
120 NSString *result = nil;
121 if (rate < 2.5)
122 {
123 result = DESC(@"oolite-ship-library-generator-weak");
124 }
125 else if (rate < 3.75)
126 {
127 result = DESC(@"oolite-ship-library-generator-average");
128 }
129 else
130 {
131 result = DESC(@"oolite-ship-library-generator-strong");
132 }
133 return result;
134}

References DESC, ShipEntity::energyRechargeRate, and nil.

+ Here is the call graph for this function:

◆ OOShipLibraryShields()

NSString * OOShipLibraryShields ( ShipEntity * demo_ship)

Definition at line 137 of file OOShipLibraryDescriptions.m.

138{
139 // when NPCs have actual shields, add those on as well
140 float shields = [demo_ship maxEnergy];
141 NSString *result = nil;
142 if (shields < 128)
143 {
144 result = DESC(@"oolite-ship-library-shields-veryweak");
145 }
146 else if (shields < 192)
147 {
148 result = DESC(@"oolite-ship-library-shields-weak");
149 }
150 else if (shields < 256)
151 {
152 result = DESC(@"oolite-ship-library-shields-average");
153 }
154 else if (shields < 320)
155 {
156 result = DESC(@"oolite-ship-library-shields-strong");
157 }
158 else
159 {
160 result = DESC(@"oolite-ship-library-shields-verystrong");
161 }
162 return result;
163}

References DESC, Entity::maxEnergy, and nil.

◆ OOShipLibrarySize()

NSString * OOShipLibrarySize ( ShipEntity * demo_ship)

Definition at line 206 of file OOShipLibraryDescriptions.m.

207{
208 BoundingBox bb = [demo_ship totalBoundingBox];
209 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)];
210}

References ShipEntity::totalBoundingBox.

◆ OOShipLibrarySpeed()

NSString * OOShipLibrarySpeed ( ShipEntity * demo_ship)

Definition at line 41 of file OOShipLibraryDescriptions.m.

42{
43 GLfloat param = [demo_ship maxFlightSpeed];
44 NSString *result = nil;
45 if (param <= 1)
46 {
47 result = DESC(@"oolite-ship-library-speed-stationary");
48 }
49 else if (param <= 150)
50 {
51 result = DESC(@"oolite-ship-library-speed-veryslow");
52 }
53 else if (param <= 250)
54 {
55 result = DESC(@"oolite-ship-library-speed-slow");
56 }
57 else if (param <= 325)
58 {
59 result = DESC(@"oolite-ship-library-speed-average");
60 }
61 else if (param <= 425)
62 {
63 result = DESC(@"oolite-ship-library-speed-fast");
64 }
65 else
66 {
67 result = DESC(@"oolite-ship-library-speed-veryfast");
68 }
69 return result;
70}

References DESC, ShipEntity::maxFlightSpeed, and nil.

◆ OOShipLibraryTurnRate()

NSString * OOShipLibraryTurnRate ( ShipEntity * demo_ship)

Definition at line 73 of file OOShipLibraryDescriptions.m.

74{
75 GLfloat param = [demo_ship maxFlightRoll] + (2*[demo_ship maxFlightPitch]);
76 NSString *result = nil;
77 if (param <= 2)
78 {
79 result = DESC(@"oolite-ship-library-turn-veryslow");
80 }
81 else if (param <= 2.75)
82 {
83 result = DESC(@"oolite-ship-library-turn-slow");
84 }
85 else if (param <= 4.5)
86 {
87 result = DESC(@"oolite-ship-library-turn-average");
88 }
89 else if (param <= 6)
90 {
91 result = DESC(@"oolite-ship-library-turn-fast");
92 }
93 else
94 {
95 result = DESC(@"oolite-ship-library-turn-veryfast");
96 }
97 return result;
98}

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

+ Here is the call graph for this function:

◆ OOShipLibraryTurrets()

NSString * OOShipLibraryTurrets ( ShipEntity * demo_ship)

Definition at line 192 of file OOShipLibraryDescriptions.m.

193{
194 NSUInteger turretCount = [demo_ship turretCount];
195 if (turretCount > 0)
196 {
197 return [NSString stringWithFormat:DESC(@"oolite-ship-library-turrets-u"), turretCount];
198 }
199 else
200 {
201 return @"";
202 }
203}

References ShipEntity::turretCount.

+ Here is the call graph for this function:

◆ OOShipLibraryWeapons()

NSString * OOShipLibraryWeapons ( ShipEntity * demo_ship)

Definition at line 179 of file OOShipLibraryDescriptions.m.

180{
181 OOWeaponFacingSet facings = [demo_ship weaponFacings];
182 NSUInteger fixed = (facings&1)+(facings&2)/2+(facings&4)/4+(facings&8)/8;
183 NSUInteger pylons = [demo_ship missileCapacity];
184 if (fixed == 0 && pylons == 0)
185 {
186 return DESC(@"oolite-ship-library-weapons-none");
187 }
188 return [NSString stringWithFormat:DESC(@"oolite-ship-library-weapons-u-u"),fixed,pylons];
189}
uint8_t OOWeaponFacingSet
Definition OOTypes.h:237

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

+ Here is the call graph for this function:

◆ OOShipLibraryWitchspace()

NSString * OOShipLibraryWitchspace ( ShipEntity * demo_ship)

Definition at line 166 of file OOShipLibraryDescriptions.m.

167{
168 if ([demo_ship hasHyperspaceMotor])
169 {
170 return DESC(@"oolite-ship-library-witchspace-yes");
171 }
172 else
173 {
174 return DESC(@"oolite-ship-library-witchspace-no");
175 }
176}

References DESC.

Variable Documentation

◆ kOODemoShipCargo

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

Definition at line 37 of file OOShipLibraryDescriptions.h.

◆ kOODemoShipClass

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

Definition at line 31 of file OOShipLibraryDescriptions.h.

◆ 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

Definition at line 29 of file OOShipLibraryDescriptions.h.

◆ 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

Definition at line 34 of file OOShipLibraryDescriptions.h.

◆ 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.