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

1742{
1743 return;
1744 static FILE *dump = NULL;
1745 if (dump == NULL) dump = fopen("strings.txt", "w");
1746 if (dump == NULL) return;
1747
1748 NSAutoreleasePool *pool = [NSAutoreleasePool new];
1749 NSMutableSet *strings = [NSMutableSet set];
1750 GatherStringAddrs(dict, strings, context);
1751
1752 NSEnumerator *entryEnum = nil;
1753 NSDictionary *entry = nil;
1754 for (entryEnum = [strings objectEnumerator]; (entry = [entryEnum nextObject]); )
1755 {
1756 NSString *string = [entry objectForKey:@"string"];
1757 NSString *context = [entry objectForKey:@"context"];
1758 void *pointer = [[entry objectForKey:@"address"] pointerValue];
1759
1760 string = [NSString stringWithFormat:@"%p\t%@: \"%@\"", pointer, context, string];
1761
1762 fprintf(dump, "%s\n", [string UTF8String]);
1763 }
1764
1765 fprintf(dump, "\n");
1766 fflush(dump);
1767 [pool release];
1768}
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 1796 of file OOShipRegistry.m.

1797{
1798 if ([object isKindOfClass:[NSString class]])
1799 {
1800 NSDictionary *entry = [NSDictionary dictionaryWithObjectsAndKeys:object, @"string", [NSValue valueWithPointer:object], @"address", context, @"context", nil];
1801 [strings addObject:entry];
1802 }
1803 else if ([object isKindOfClass:[NSArray class]])
1804 {
1805 GatherStringAddrsArray(object, strings, context);
1806 }
1807 else if ([object isKindOfClass:[NSDictionary class]])
1808 {
1809 GatherStringAddrsDict(object, strings, context);
1810 }
1811}
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 1784 of file OOShipRegistry.m.

1785{
1786 NSEnumerator *vEnum = nil;
1787 NSString *v = nil;
1788 unsigned i = 0;
1789 for (vEnum = [array objectEnumerator]; (v = [vEnum nextObject]); )
1790 {
1791 GatherStringAddrs(v, strings, [context stringByAppendingFormat:@"[%u]", i++]);
1792 }
1793}

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 1771 of file OOShipRegistry.m.

1772{
1773 NSEnumerator *keyEnum = nil;
1774 id key = nil;
1775 NSString *keyContext = [context stringByAppendingString:@" key"];
1776 for (keyEnum = [dict keyEnumerator]; (key = [keyEnum nextObject]); )
1777 {
1778 GatherStringAddrs(key, strings, keyContext);
1779 GatherStringAddrs([dict objectForKey:key], strings, [context stringByAppendingFormat:@".%@", key]);
1780 }
1781}

References 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 1820 of file OOShipRegistry.m.

1821{
1822 return [OOShipLibraryCategoryPlural([[a oo_dictionaryAtIndex:0] oo_stringForKey:@"class"]) compare:OOShipLibraryCategoryPlural([[b oo_dictionaryAtIndex:0] oo_stringForKey:@"class"])];
1823}

◆ SortDemoShipsByName()

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

Definition at line 1814 of file OOShipRegistry.m.

1815{
1816 return [[a oo_stringForKey:@"name"] compare:[b oo_stringForKey:@"name"]];
1817}

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.