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

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

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}
GLfloat maxEnergy
Definition Entity.m:763

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}
BoundingBox totalBoundingBox

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}
GLfloat maxFlightSpeed

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

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

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

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: