Oolite
Loading...
Searching...
No Matches
OOCharacter(Private) Category Reference

Instance Methods

(id) - initWithGenSeed:andOriginalSystem:
(void) - setCharacterFromDictionary:
(void) - setOriginSystem:
(Random_Seed) - genSeed

Detailed Description

Definition at line 33 of file OOCharacter.m.

Method Documentation

◆ genSeed

- (Random_Seed) genSeed

Extends class OOCharacter.

Definition at line 307 of file OOCharacter.m.

308{
309 return _genSeed;
310}

References genSeed.

Referenced by OOCharacter::basicSetUp, OOCharacter::castInRole:, genSeed, and OOCharacter::species.

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

◆ initWithGenSeed:andOriginalSystem:

- (id) initWithGenSeed: (Random_Seed) characterSeed
andOriginalSystem: (OOSystemID) systemSeed 

Extends class OOCharacter.

Definition at line 65 of file OOCharacter.m.

65 :(Random_Seed)characterSeed andOriginalSystem:(OOSystemID)system
66{
67 if ((self = [super init])) {
68 // do character set-up
69 _genSeed = characterSeed;
70 _originSystem = system;
71
72 [self basicSetUp];
73 }
74 return self;
75}
int16_t OOSystemID
Definition OOTypes.h:183
struct Random_Seed Random_Seed

References OOCharacter::basicSetUp.

Here is the call graph for this function:

◆ setCharacterFromDictionary:

- (void) setCharacterFromDictionary: (NSDictionary *) dict

Extends class OOCharacter.

Definition at line 397 of file OOCharacter.m.

397 :(NSDictionary*)dict
398{
399 id origin = nil;
400 Random_Seed seed;
401
402 origin = [dict objectForKey:@"origin"];
403 if ([origin isKindOfClass:[NSNumber class]] || ([origin respondsToSelector:@selector(intValue)] && ([origin intValue] != 0 || [origin isEqual:@"0"]))) {
404 // Number or numerical string
405 [self setOriginSystem:[origin intValue]];
406 } else if ([origin isKindOfClass:[NSString class]]) {
407 OOSystemID sys = [UNIVERSE findSystemFromName:origin];
408 if (sys < 0) {
409 OOLogERR(@"character.load.unknownSystem", @"could not find a system named '%@' in this galaxy.", origin);
410 [self setOriginSystem:(ranrot_rand() & 0xff)];
411 } else {
412 [self setOriginSystem:sys];
413 }
414 } else {
415 // no origin defined, select one at random.
416 [self setOriginSystem:(ranrot_rand() & 0xff)];
417 }
418
419 if ([dict objectForKey:@"random_seed"]) {
420 seed = RandomSeedFromString([dict oo_stringForKey:@"random_seed"]); // returns kNilRandomSeed on failure
421 } else {
422 seed.a = (ranrot_rand() & 0xff);
423 seed.b = (ranrot_rand() & 0xff);
424 seed.c = (ranrot_rand() & 0xff);
425 seed.d = (ranrot_rand() & 0xff);
426 seed.e = (ranrot_rand() & 0xff);
427 seed.f = (ranrot_rand() & 0xff);
428 }
429 [self setGenSeed:seed];
430 [self basicSetUp];
431
432 if ([dict oo_stringForKey:@"role"])
433 [self castInRole:[dict oo_stringForKey:@"role"]];
434 if ([dict oo_stringForKey:@"name"])
435 [self setName:[dict oo_stringForKey:@"name"]];
436 if ([dict oo_stringForKey:@"short_description"])
437 [self setShortDescription:[dict oo_stringForKey:@"short_description"]];
438 if ([dict objectForKey:@"legal_status"])
439 [self setLegalStatus:[dict oo_intForKey:@"legal_status"]];
440 if ([dict objectForKey:@"bounty"])
441 [self setLegalStatus:[dict oo_intForKey:@"bounty"]];
442 if ([dict objectForKey:@"insurance"])
443 [self setInsuranceCredits:[dict oo_unsignedLongLongForKey:@"insurance"]];
444 if ([dict oo_stringForKey:@"script"])
445 [self setCharacterScript:[dict oo_stringForKey:@"script"]];
446 if ([dict oo_arrayForKey:@"script_actions"])
447 [self setLegacyScript:[dict oo_arrayForKey:@"script_actions"]];
448}
#define OOLogERR(class, format,...)
Definition OOLogging.h:125
return nil
Random_Seed RandomSeedFromString(NSString *abcdefString)
voidpf uLong int origin
Definition ioapi.h:132
#define ranrot_rand()

References Random_Seed::a, Random_Seed::b, OOCharacter::basicSetUp, Random_Seed::c, OOCharacter::castInRole:, Random_Seed::d, Random_Seed::e, Random_Seed::f, nil, OOLogERR, RandomSeedFromString(), ranrot_rand, OOCharacter::setCharacterScript:, OOCharacter::setGenSeed:, OOCharacter::setInsuranceCredits:, OOCharacter::setLegacyScript:, OOCharacter::setLegalStatus:, OOCharacter::setName:, OOCharacter::setOriginSystem:, and OOCharacter::setShortDescription:.

Referenced by OOCharacter::characterWithDictionary:.

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

◆ setOriginSystem:

- (void) setOriginSystem: (OOSystemID) value

Extends class OOCharacter.

Definition at line 351 of file OOCharacter.m.

351 :(OOSystemID)value
352{
353 _originSystem = value;
354}

Referenced by setCharacterFromDictionary:.

Here is the caller graph for this function:

The documentation for this category was generated from the following file: