Oolite
Loading...
Searching...
No Matches
OOShipRegistry.m File Reference
+ Include dependency graph for OOShipRegistry.m:

Go to the source code of this file.

Classes

category  OOShipRegistry(OODataLoader)
 

Macros

#define PRELOAD   0
 
#define kDefaultFlasherColor   @"redColor"
 

Functions

static void DumpStringAddrs (NSDictionary *dict, NSString *context)
 
static NSComparisonResult SortDemoShipsByName (id a, id b, void *context)
 
static NSComparisonResult SortDemoCategoriesByName (id a, id b, void *context)
 
static void GatherStringAddrsDict (NSDictionary *dict, NSMutableSet *strings, NSString *context)
 
static void GatherStringAddrsArray (NSArray *array, NSMutableSet *strings, NSString *context)
 
static void GatherStringAddrs (id object, NSMutableSet *strings, NSString *context)
 

Variables

static OOShipRegistrysSingleton = nil
 
static NSString *const kShipRegistryCacheName = @"ship registry"
 
static NSString *const kShipDataCacheKey = @"ship data"
 
static NSString *const kPlayerShipsCacheKey = @"player ships"
 
static NSString *const kRoleWeightsCacheKey = @"role weights"
 
static NSString *const kDefaultDemoShip = @"coriolis-station"
 
static NSString *const kVisualEffectRegistryCacheName = @"visual effect registry"
 
static NSString *const kVisualEffectDataCacheKey = @"visual effect data"
 

Macro Definition Documentation

◆ kDefaultFlasherColor

#define kDefaultFlasherColor   @"redColor"

◆ PRELOAD

#define PRELOAD   0

Definition at line 48 of file OOShipRegistry.m.

Function Documentation

◆ DumpStringAddrs()

static void DumpStringAddrs ( NSDictionary *  dict,
NSString *  context 
)
static

Definition at line 1725 of file OOShipRegistry.m.

1726{
1727 return;
1728 static FILE *dump = NULL;
1729 if (dump == NULL) dump = fopen("strings.txt", "w");
1730 if (dump == NULL) return;
1731
1732 NSAutoreleasePool *pool = [NSAutoreleasePool new];
1733 NSMutableSet *strings = [NSMutableSet set];
1734 GatherStringAddrs(dict, strings, context);
1735
1736 NSDictionary *entry = nil;
1737 foreach (entry, strings)
1738 {
1739 NSString *string = [entry objectForKey:@"string"];
1740 NSString *context = [entry objectForKey:@"context"];
1741 void *pointer = [[entry objectForKey:@"address"] pointerValue];
1742
1743 string = [NSString stringWithFormat:@"%p\t%@: \"%@\"", pointer, context, string];
1744
1745 fprintf(dump, "%s\n", [string UTF8String]);
1746 }
1747
1748 fprintf(dump, "\n");
1749 fflush(dump);
1750 [pool release];
1751}
return nil
static void GatherStringAddrs(id object, NSMutableSet *strings, NSString *context)

References GatherStringAddrs(), and nil.

+ Here is the call graph for this function:

◆ GatherStringAddrs()

static void GatherStringAddrs ( id  object,
NSMutableSet *  strings,
NSString *  context 
)
static

Definition at line 1777 of file OOShipRegistry.m.

1778{
1779 if ([object isKindOfClass:[NSString class]])
1780 {
1781 NSDictionary *entry = [NSDictionary dictionaryWithObjectsAndKeys:object, @"string", [NSValue valueWithPointer:object], @"address", context, @"context", nil];
1782 [strings addObject:entry];
1783 }
1784 else if ([object isKindOfClass:[NSArray class]])
1785 {
1786 GatherStringAddrsArray(object, strings, context);
1787 }
1788 else if ([object isKindOfClass:[NSDictionary class]])
1789 {
1790 GatherStringAddrsDict(object, strings, context);
1791 }
1792}
static void GatherStringAddrsArray(NSArray *array, NSMutableSet *strings, NSString *context)
static void GatherStringAddrsDict(NSDictionary *dict, NSMutableSet *strings, NSString *context)

References GatherStringAddrsArray(), and GatherStringAddrsDict().

Referenced by DumpStringAddrs(), GatherStringAddrsArray(), and GatherStringAddrsDict().

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

◆ GatherStringAddrsArray()

static void GatherStringAddrsArray ( NSArray *  array,
NSMutableSet *  strings,
NSString *  context 
)
static

Definition at line 1766 of file OOShipRegistry.m.

1767{
1768 NSString *v = nil;
1769 unsigned i = 0;
1770 foreach (v, array)
1771 {
1772 GatherStringAddrs(v, strings, [context stringByAppendingFormat:@"[%u]", i++]);
1773 }
1774}

References GatherStringAddrs(), and nil.

Referenced by GatherStringAddrs().

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

◆ GatherStringAddrsDict()

static void GatherStringAddrsDict ( NSDictionary *  dict,
NSMutableSet *  strings,
NSString *  context 
)
static

Definition at line 1754 of file OOShipRegistry.m.

1755{
1756 id key = nil;
1757 NSString *keyContext = [context stringByAppendingString:@" key"];
1758 foreachkey (key, dict)
1759 {
1760 GatherStringAddrs(key, strings, keyContext);
1761 GatherStringAddrs([dict objectForKey:key], strings, [context stringByAppendingFormat:@".%@", key]);
1762 }
1763}
#define foreachkey(VAR, DICT)
Definition OOCocoa.h:353

References foreachkey, GatherStringAddrs(), and nil.

Referenced by GatherStringAddrs().

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

◆ SortDemoCategoriesByName()

static NSComparisonResult SortDemoCategoriesByName ( id  a,
id  b,
void *  context 
)
static

Definition at line 1801 of file OOShipRegistry.m.

1802{
1803 return [OOShipLibraryCategoryPlural([[a oo_dictionaryAtIndex:0] oo_stringForKey:@"class"]) compare:OOShipLibraryCategoryPlural([[b oo_dictionaryAtIndex:0] oo_stringForKey:@"class"])];
1804}

◆ SortDemoShipsByName()

static NSComparisonResult SortDemoShipsByName ( id  a,
id  b,
void *  context 
)
static

Definition at line 1795 of file OOShipRegistry.m.

1796{
1797 return [[a oo_stringForKey:@"name"] compare:[b oo_stringForKey:@"name"]];
1798}

Variable Documentation

◆ kDefaultDemoShip

NSString* const kDefaultDemoShip = @"coriolis-station"
static

Definition at line 63 of file OOShipRegistry.m.

◆ kPlayerShipsCacheKey

NSString* const kPlayerShipsCacheKey = @"player ships"
static

Definition at line 61 of file OOShipRegistry.m.

◆ kRoleWeightsCacheKey

NSString* const kRoleWeightsCacheKey = @"role weights"
static

Definition at line 62 of file OOShipRegistry.m.

◆ kShipDataCacheKey

NSString* const kShipDataCacheKey = @"ship data"
static

Definition at line 60 of file OOShipRegistry.m.

◆ kShipRegistryCacheName

NSString* const kShipRegistryCacheName = @"ship registry"
static

Definition at line 59 of file OOShipRegistry.m.

◆ kVisualEffectDataCacheKey

NSString* const kVisualEffectDataCacheKey = @"visual effect data"
static

Definition at line 65 of file OOShipRegistry.m.

◆ kVisualEffectRegistryCacheName

NSString* const kVisualEffectRegistryCacheName = @"visual effect registry"
static

Definition at line 64 of file OOShipRegistry.m.

◆ sSingleton

OOShipRegistry* sSingleton = nil
static

Definition at line 56 of file OOShipRegistry.m.