Oolite
Loading...
Searching...
No Matches
OOShipRegistry.m File Reference
import "OOShipRegistry.h"
import "GameController.h"
import "NSDictionaryOOExtensions.h"
import "OOCacheManager.h"
import "OOCollectionExtractors.h"
import "OOColor.h"
import "OODeepCopy.h"
import "OOJSScript.h"
import "OOLegacyScriptWhitelist.h"
import "OOMesh.h"
import "OOProbabilitySet.h"
import "OORoleSet.h"
import "OOShipLibraryDescriptions.h"
import "OOStringExpander.h"
import "OOStringParsing.h"
import "ResourceManager.h"
import "Universe.h"
import "OODebugStandards.h"
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 OOShipRegistry * sSingleton = 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()

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

Definition at line 1559 of file OOShipRegistry.m.

1560{
1561 return;
1562 static FILE* dump = NULL;
1563 if (dump == NULL)
1564 dump = fopen("strings.txt", "w");
1565 if (dump == NULL)
1566 return;
1567
1568 NSAutoreleasePool* pool = [NSAutoreleasePool new];
1569 NSMutableSet* strings = [NSMutableSet set];
1570 GatherStringAddrs(dict, strings, context);
1571
1572 NSDictionary* entry = nil;
1573 foreach (entry, strings) {
1574 NSString* string = [entry objectForKey:@"string"];
1575 NSString* context = [entry objectForKey:@"context"];
1576 void* pointer = [[entry objectForKey:@"address"] pointerValue];
1577
1578 string = [NSString stringWithFormat:@"%p\t%@: \"%@\"", pointer, context, string];
1579
1580 fprintf(dump, "%s\n", [string UTF8String]);
1581 }
1582
1583 fprintf(dump, "\n");
1584 fflush(dump);
1585 [pool release];
1586}
return nil
static void GatherStringAddrs(id object, NSMutableSet *strings, NSString *context)

References GatherStringAddrs(), and nil.

Referenced by OOShipRegistry(OODataLoader)::loadShipData.

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

◆ GatherStringAddrs()

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

Definition at line 1608 of file OOShipRegistry.m.

1609{
1610 if ([object isKindOfClass:[NSString class]]) {
1611 NSDictionary* entry = [NSDictionary dictionaryWithObjectsAndKeys:object, @"string", [NSValue valueWithPointer:object], @"address", context, @"context", nil];
1612 [strings addObject:entry];
1613 } else if ([object isKindOfClass:[NSArray class]]) {
1614 GatherStringAddrsArray(object, strings, context);
1615 } else if ([object isKindOfClass:[NSDictionary class]]) {
1616 GatherStringAddrsDict(object, strings, context);
1617 }
1618}
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()

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

Definition at line 1599 of file OOShipRegistry.m.

1600{
1601 NSString* v = nil;
1602 unsigned i = 0;
1603 foreach (v, array) {
1604 GatherStringAddrs(v, strings, [context stringByAppendingFormat:@"[%u]", i++]);
1605 }
1606}

References GatherStringAddrs(), and nil.

Referenced by GatherStringAddrs().

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

◆ GatherStringAddrsDict()

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

Definition at line 1588 of file OOShipRegistry.m.

1589{
1590 id key = nil;
1591 NSString* keyContext = [context stringByAppendingString:@" key"];
1592 foreachkey(key, dict)
1593 {
1594 GatherStringAddrs(key, strings, keyContext);
1595 GatherStringAddrs([dict objectForKey:key], strings, [context stringByAppendingFormat:@".%@", key]);
1596 }
1597}
#define foreachkey(VAR, DICT)

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

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

Definition at line 1625 of file OOShipRegistry.m.

1626{
1627 return [OOShipLibraryCategoryPlural([[a oo_dictionaryAtIndex:0] oo_stringForKey:@"class"]) compare:OOShipLibraryCategoryPlural([[b oo_dictionaryAtIndex:0] oo_stringForKey:@"class"])];
1628}

◆ SortDemoShipsByName()

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

Definition at line 1620 of file OOShipRegistry.m.

1621{
1622 return [[a oo_stringForKey:@"name"] compare:[b oo_stringForKey:@"name"]];
1623}

Variable Documentation

◆ kDefaultDemoShip

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

Definition at line 60 of file OOShipRegistry.m.

Referenced by OOShipRegistry(OODataLoader)::loadDemoShips.

◆ kPlayerShipsCacheKey

NSString* const kPlayerShipsCacheKey = @"player ships"
static

Definition at line 58 of file OOShipRegistry.m.

◆ kRoleWeightsCacheKey

NSString* const kRoleWeightsCacheKey = @"role weights"
static

Definition at line 59 of file OOShipRegistry.m.

◆ kShipDataCacheKey

NSString* const kShipDataCacheKey = @"ship data"
static

Definition at line 57 of file OOShipRegistry.m.

◆ kShipRegistryCacheName

NSString* const kShipRegistryCacheName = @"ship registry"
static

Definition at line 56 of file OOShipRegistry.m.

◆ kVisualEffectDataCacheKey

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

Definition at line 62 of file OOShipRegistry.m.

◆ kVisualEffectRegistryCacheName

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

Definition at line 61 of file OOShipRegistry.m.

◆ sSingleton

OOShipRegistry* sSingleton = nil
static

Definition at line 54 of file OOShipRegistry.m.