Oolite 1.91.0.7645-241119-222d325
Loading...
Searching...
No Matches
OOShipLibraryDescriptions.m File Reference
+ Include dependency graph for OOShipLibraryDescriptions.m:

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)
 

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
OOCargoQuantity maxAvailableCargoSpace()

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}
float energyRechargeRate()

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}
GLfloat maxEnergy
Definition Entity.h:143

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}
BoundingBox totalBoundingBox
Definition ShipEntity.h:213

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}
GLfloat maxFlightSpeed
Definition ShipEntity.h:239

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}
GLfloat maxFlightRoll()

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}
NSUInteger turretCount()

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
NSUInteger missileCapacity()
OOWeaponFacingSet weaponFacings()

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.