33#define CASE(foo) case foo: return @#foo;
34#define REVERSE_CASE(foo) if ([string isEqualToString:@#foo]) return foo;
37#define ENTRY(label, value) case label: return @#label;
38#define GALACTIC_HYPERSPACE_ENTRY(label, value) case GALACTIC_HYPERSPACE_##label: return @#label;
39#define DIFF_STRING_ENTRY(label, string) case label: return @string;
45 #include "OOEntityStatus.tbl"
55 #include "OOBehaviour.tbl"
58 return @"** BEHAVIOUR UNKNOWN **";
66 #include "OOCompassMode.tbl"
76 #include "OOLongRangeChartMode.tbl"
86 #include "OOGalacticHyperspaceBehaviour.tbl"
97 #include "OOGUIScreenID.tbl"
108 #include "OOScanClass.tbl"
119 #include "OOShipDamageType.tbl"
129 #include "OOLegalStatusReason.tbl"
137#undef GALACTIC_HYPERSPACE_ENTRY
140#define ENTRY(label, value) if ([string isEqualToString:@#label]) return label;
141#define GALACTIC_HYPERSPACE_ENTRY(label, value) if ([string isEqualToString:@#label]) return GALACTIC_HYPERSPACE_##label;
145 #include "OOEntityStatus.tbl"
153 #include "OOCompassMode.tbl"
161 #include "OOGalacticHyperspaceBehaviour.tbl"
164 if ([
string hasPrefix:
@"BEHAVIOR_"])
166 string = [string substringFromIndex:[@"BEHAVIOR_" length]];
167 string = [@"BEHAVIOUR_" stringByAppendingString:string];
177 #include "OOGUIScreenID.tbl"
185 #include "OOScanClass.tbl"
192 #include "OOLongRangeChartMode.tbl"
198#undef GALACTIC_HYPERSPACE_ENTRY
210 return @"** ROUTE TYPE UNKNOWN **";
216 NSArray *strings =
nil;
217 NSString *value =
nil;
219 strings = [[UNIVERSE descriptions] objectForKey:@"government"];
220 if ([strings isKindOfClass:[NSArray
class]] && government < [strings
count])
222 value = [strings objectAtIndex:government];
223 if ([value isKindOfClass:[NSString
class]])
return value;
232 NSArray *strings =
nil;
233 NSString *value =
nil;
235 strings = [[UNIVERSE descriptions] objectForKey:@"economy"];
236 if ([strings isKindOfClass:[NSArray
class]] && economy < [strings
count])
238 value = [strings objectAtIndex:economy];
239 if ([value isKindOfClass:[NSString
class]])
return value;
248 switch ((JSType)type)
252 CASE(JSTYPE_FUNCTION);
255 CASE(JSTYPE_BOOLEAN);
260 return [NSString stringWithFormat:@"unknown (%u)", type];
267 return @"EQ_WEAPON_NONE";
291 if (![
string hasPrefix:
@"EQ_"])
309 if ([
string intValue] > 0)
311 switch ([
string intValue])
351 return @"Unknown cargo";
367 if ([
string isEqual:
@"CARGO_CARRIED"])
return CARGO_RANDOM;
388 return @"Unsupported energy unit";
406 enum { kRatingCount = 9 };
408 NSArray *ratingNames =
nil;
409 const unsigned killThresholds[kRatingCount - 1] =
422 ratingNames = [[UNIVERSE descriptions] oo_arrayForKey:@"rating"];
423 for (i = 0; i < kRatingCount - 1; ++i)
425 if (kills < killThresholds[i])
return [ratingNames oo_stringAtIndex:i];
428 return [ratingNames oo_stringAtIndex:kRatingCount - 1];
434 return [NSString stringWithFormat:@"%@ (%u)", OODisplayRatingStringFromKillCount(kills), kills];
440 enum { kStatusCount = 3 };
442 NSArray *statusNames =
nil;
443 const int statusThresholds[kStatusCount - 1] =
450 statusNames = [[UNIVERSE descriptions] oo_arrayForKey:@"legal_status"];
451 for (i = 0; i != kStatusCount - 1; ++i)
453 if (legalStatus < statusThresholds[i])
return [statusNames oo_stringAtIndex:i];
456 return [statusNames oo_stringAtIndex:kStatusCount - 1];
462 NSArray *conditionNames = [[UNIVERSE descriptions] oo_arrayForKey:@"condition"];
463 return [conditionNames oo_stringAtIndex:alertCondition];
508 NSString *ret = [UNIVERSE descriptionForKey:[@"commodity-name " stringByAppendingString:[symbolicName lowercaseString]]];
509 return ret ? ret : symbolicName;
550 switch (dockingClearanceStatus)
559 return @"DOCKING_CLEARANCE_STATUS_UNKNOWN";
573 return @"DETAIL_LEVEL_UNKNOWN";
@ kOOEnergyUnitTypeDefault
OOWeaponType OOWeaponTypeFromEquipmentIdentifierStrict(NSString *string)
NSString * OOStringFromGraphicsDetail(OOGraphicsDetail detail)
OOWeaponType OOWeaponTypeFromString(NSString *string)
NSString * OOStringFromBehaviour(OOBehaviour value)
OOEnergyUnitType StringToEnergyUnitType(NSString *string)
NSString * CargoTypeToString(OOCargoType cargo)
NSString * OOStringFromLongRangeChartMode(OOLongRangeChartMode value)
NSString * OODisplayStringFromEconomyID(OOEconomyID economy)
OOWeaponType OOWeaponTypeFromEquipmentIdentifierLegacy(NSString *string)
OOGalacticHyperspaceBehaviour OOGalacticHyperspaceBehaviourFromString(NSString *string)
OOWeaponType OOWeaponTypeFromEquipmentIdentifierSloppy(NSString *string)
NSString * OOStringFromWeaponType(OOWeaponType weapon)
NSString * CommodityDisplayNameForSymbolicName(NSString *symbolicName)
NSString * DisplayStringForMassUnit(OOMassUnit unit)
OORouteType StringToRouteType(NSString *string)
OOShaderSetting OOShaderSettingFromString(NSString *string)
NSString * OOStringFromGUIScreenID(OOGUIScreenID value)
OOCargoType StringToCargoType(NSString *string)
NSString * OOEquipmentIdentifierFromWeaponType(OOWeaponType weapon)
#define REVERSE_CASE(foo)
NSString * OODisplayStringFromGovernmentID(OOGovernmentID government)
NSString * RouteTypeToString(OORouteType routeType)
OOScanClass OOScanClassFromString(NSString *string)
OOCompassMode OOCompassModeFromString(NSString *string)
NSString * OOStringFromEntityStatus(OOEntityStatus value)
OOEntityStatus OOEntityStatusFromString(NSString *string)
NSString * JSTypeToString(int type)
NSString * DockingClearanceStatusToString(OODockingClearanceStatus dockingClearanceStatus)
NSString * OOStringFromCompassMode(OOCompassMode value)
NSString * OOStringFromGalacticHyperspaceBehaviour(OOGalacticHyperspaceBehaviour value)
NSString * OODisplayRatingStringFromKillCount(unsigned kills)
NSString * OOStringFromShaderSetting(OOShaderSetting setting)
NSString * OOStringFromShipDamageType(OOShipDamageType value)
NSString * OODisplayStringFromAlertCondition(OOAlertCondition alertCondition)
NSString * OODisplayStringFromLegalStatus(int legalStatus)
OOGUIScreenID OOGUIScreenIDFromString(NSString *string)
NSString * EnergyUnitTypeToString(OOEnergyUnitType unit)
NSString * KillCountToRatingAndKillString(unsigned kills)
NSString * DisplayStringForMassUnitForCommodity(OOCommodityType commodity)
OOGraphicsDetail OOGraphicsDetailFromString(NSString *string)
NSString * OOStringFromLegalStatusReason(OOLegalStatusReason value)
NSString * CommodityDisplayNameForCommodityArray(NSArray *commodityDefinition)
NSString * OOStringFromScanClass(OOScanClass value)
NSString * OODisplayStringFromShaderSetting(OOShaderSetting setting)
OOLongRangeChartMode OOLongRangeChartModeFromString(NSString *string)
@ kOOShaderSettingDefault
@ kOOLongRangeChartModeDefault
NSString * OOCommodityType
@ DOCKING_CLEARANCE_STATUS_TIMING_OUT
@ DOCKING_CLEARANCE_STATUS_NOT_REQUIRED
@ DOCKING_CLEARANCE_STATUS_GRANTED
@ DOCKING_CLEARANCE_STATUS_NONE
@ DOCKING_CLEARANCE_STATUS_REQUESTED
@ ENERGY_UNIT_NAVAL_DAMAGED
@ ENERGY_UNIT_NORMAL_DAMAGED
OOGalacticHyperspaceBehaviour
@ kOOGalacticHyperspaceBehaviourDefault
OOEquipmentType * equipmentTypeWithIdentifier:(NSString *identifier)