Oolite
Loading...
Searching...
No Matches
OOCharacter Class Reference

#include <OOCharacter.h>

Inheritance diagram for OOCharacter:
Collaboration diagram for OOCharacter:

Instance Methods

(id) - initWithRole:andOriginalSystem:
(NSString *) - planetOfOrigin
(OOSystemID) - planetIDOfOrigin
(NSString *) - species
(void) - basicSetUp
(BOOL) - castInRole:
(NSString *) - name
(void) - setName:
(NSString *) - shortDescription
(void) - setShortDescription:
(int) - legalStatus
(void) - setLegalStatus:
(OOCreditsQuantity) - insuranceCredits
(void) - setInsuranceCredits:
(NSArray *) - legacyScript
(void) - setLegacyScript:
(OOJSScript *) - script
(void) - setCharacterScript:
(void) - doScriptEvent:
(NSDictionary *) - infoForScripting
(NSString *) - descriptionComponents [implementation]
(NSString *) - oo_jsClassName [implementation]
(void) - dealloc [implementation]
(id) - initWithGenSeed:andOriginalSystem: [implementation]
(Random_Seed) - genSeed [implementation]
(void) - setOriginSystem: [implementation]
(void) - setGenSeed: [implementation]
(void) - setCharacterFromDictionary: [implementation]

Class Methods

(OOCharacter *) + characterWithRole:andOriginalSystem:
(OOCharacter *) + randomCharacterWithRole:andOriginalSystem:
(OOCharacter *) + characterWithDictionary:

Private Attributes

NSString * _name
NSString * _shortDescription
OOSystemID _originSystem
Random_Seed _genSeed
int _legalStatus
OOCreditsQuantity _insuranceCredits
NSArray * _scriptActions
OOJSScript * _script

Detailed Description

Definition at line 34 of file OOCharacter.h.

Method Documentation

◆ basicSetUp

- (void) basicSetUp

Definition at line 149 of file OOCharacter.m.

150{
151 // save random seeds for restoration later
152 RNG_Seed savedRNGSeed = currentRandomSeed();
153 RANROTSeed savedRANROTSeed = RANROTGetFullSeed();
154 // set RNG to character seed
155 Random_Seed genSeed = [self genSeed];
157
158 // determine the planet of origin
159 NSDictionary* originInfo = [UNIVERSE generateSystemData:[self planetIDOfOrigin]];
160 NSString* planet = [originInfo oo_stringForKey:KEY_NAME];
161 OOGovernmentID government = [originInfo oo_intForKey:KEY_GOVERNMENT]; // 0 .. 7 (0 anarchic .. 7 most stable)
162 int criminalTendency = government ^ 0x07;
163
164 // determine the character's species
165 NSString* species = [self species];
166
167 // determine the character's name
169 NSString* genName = nil;
170 if ([species hasPrefix:@"human"]) {
171 genName = [NSString stringWithFormat:@"%@ %@", OOExpandWithSeed(genSeed, @"%R"), OOExpandKeyWithSeed(genSeed, @"nom")];
172 } else {
173 /* NOTE: we can't use "%R %R" because that will produce the same string
174 twice. TODO: is there a reason not to use %N and kOOExpandGoodRNG
175 here? Is there some context where we rely on being able to get the
176 same name for a given genSeed?
177 */
178 genName = [NSString stringWithFormat:@"%@ %@", OOExpandWithSeed(genSeed, @"%R"), OOExpandWithSeed(genSeed, @"%R")];
179 }
180 [self setName:genName];
181
182 [self setShortDescription:OOExpandKeyWithSeed(genSeed, @"character-generic-description", species, planet)];
183
184 // determine _legalStatus for a completely random character
185 [self setLegalStatus:0]; // clean
186 int legalIndex = gen_rnd_number() & gen_rnd_number() & 0x03;
187 while (((gen_rnd_number() & 0xf) < criminalTendency) && (legalIndex < 3)) {
188 legalIndex++;
189 }
190 if (legalIndex == 3) {
191 // criminal
192 [self setLegalStatus:criminalTendency + criminalTendency * (gen_rnd_number() & 0x03) + (gen_rnd_number() & gen_rnd_number() & 0x7f)];
193 }
194 legalIndex = 0;
195 if (_legalStatus > 0)
196 legalIndex = (_legalStatus <= 50) ? 1 : 2;
197
198 // if clean - determine insurance level (if any)
199 [self setInsuranceCredits:0];
200 if (legalIndex == 0) {
201 int insuranceIndex = gen_rnd_number() & gen_rnd_number() & 0x03;
202 switch (insuranceIndex) {
203 case 1:
204 [self setInsuranceCredits:125];
205 break;
206 case 2:
207 [self setInsuranceCredits:250];
208 break;
209 case 3:
210 [self setInsuranceCredits:500];
211 }
212 }
213
214 // restore random seed
215 setRandomSeed(savedRNGSeed);
216 RANROTSetFullSeed(savedRANROTSeed);
217}
return nil
uint8_t OOGovernmentID
Definition OOTypes.h:179
Random_Seed genSeed()
NSString * species()
RANROTSeed RANROTGetFullSeed(void)
void seed_RNG_only_for_planet_description(Random_Seed s_seed)
void setRandomSeed(RNG_Seed a_seed)
RNG_Seed currentRandomSeed(void)
void RANROTSetFullSeed(RANROTSeed seed)
int gen_rnd_number(void)
void seed_for_planet_description(Random_Seed s_seed)
struct RANROTSeed RANROTSeed
struct Random_Seed Random_Seed
struct RNG_Seed RNG_Seed

References _legalStatus, basicSetUp, currentRandomSeed(), gen_rnd_number(), genSeed, nil, planetIDOfOrigin, RANROTGetFullSeed(), RANROTSetFullSeed(), seed_for_planet_description(), seed_RNG_only_for_planet_description(), setInsuranceCredits:, setLegalStatus:, setName:, setRandomSeed(), setShortDescription:, and species.

Referenced by basicSetUp, OOCharacter(Private)::initWithGenSeed:andOriginalSystem:, and OOCharacter(Private)::setCharacterFromDictionary:.

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

◆ castInRole:

- (BOOL) castInRole: (NSString*) role

Definition at line 219 of file OOCharacter.m.

219 :(NSString*)role
220{
221 BOOL specialSetUpDone = NO;
222
223 role = [role lowercaseString];
224 if ([role hasPrefix:@"pirate"]) {
225 // determine _legalStatus for a completely random character
226 Random_Seed genSeed = [self genSeed];
227 int sins = 0x08 | (genSeed.a & genSeed.b);
228 [self setLegalStatus:sins & 0x7f];
229
230 specialSetUpDone = YES;
231 } else if ([role hasPrefix:@"trader"]) {
232 [self setLegalStatus:0]; // clean
233
234 int insuranceIndex = gen_rnd_number() & 0x03;
235 switch (insuranceIndex) {
236 case 0:
237 [self setInsuranceCredits:0];
238 break;
239 case 1:
240 [self setInsuranceCredits:125];
241 break;
242 case 2:
243 [self setInsuranceCredits:250];
244 break;
245 case 3:
246 [self setInsuranceCredits:500];
247 }
248 specialSetUpDone = YES;
249 } else if ([role hasPrefix:@"hunter"]) {
250 [self setLegalStatus:0]; // clean
251 int insuranceIndex = gen_rnd_number() & 0x03;
252 if (insuranceIndex == 3)
253 [self setInsuranceCredits:500];
254 specialSetUpDone = YES;
255 } else if ([role hasPrefix:@"police"]) {
256 [self setLegalStatus:0]; // clean
257 [self setInsuranceCredits:125];
258 specialSetUpDone = YES;
259 } else if ([role isEqual:@"miner"]) {
260 [self setLegalStatus:0]; // clean
261 [self setInsuranceCredits:25];
262 specialSetUpDone = YES;
263 } else if ([role isEqual:@"passenger"]) {
264 [self setLegalStatus:0]; // clean
265 int insuranceIndex = gen_rnd_number() & 0x03;
266 switch (insuranceIndex) {
267 case 0:
268 [self setInsuranceCredits:25];
269 break;
270 case 1:
271 [self setInsuranceCredits:125];
272 break;
273 case 2:
274 [self setInsuranceCredits:250];
275 break;
276 case 3:
277 [self setInsuranceCredits:500];
278 }
279 specialSetUpDone = YES;
280 } else if ([role isEqual:@"slave"]) {
281 [self setLegalStatus:0]; // clean
282 [self setInsuranceCredits:0];
283 specialSetUpDone = YES;
284 } else if ([role isEqual:@"thargoid"]) {
285 [self setLegalStatus:100];
286 [self setInsuranceCredits:0];
287 [self setName:DESC(@"character-thargoid-name")];
288 [self setShortDescription:DESC(@"character-a-thargoid")];
289 specialSetUpDone = YES;
290 }
291
292 // do long description here
293
294 return specialSetUpDone;
295}

References gen_rnd_number(), genSeed, setInsuranceCredits:, setLegalStatus:, setName:, and setShortDescription:.

Referenced by initWithRole:andOriginalSystem:, randomCharacterWithRole:andOriginalSystem:, and OOCharacter(Private)::setCharacterFromDictionary:.

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

◆ characterWithDictionary:

+ (OOCharacter *) characterWithDictionary: (NSDictionary*) c_dict

Definition at line 111 of file OOCharacter.m.

111 :(NSDictionary*)dict
112{
113 OOCharacter* character = [[[OOCharacter alloc] init] autorelease];
114 [character setCharacterFromDictionary:dict];
115
116 return character;
117}
void setCharacterFromDictionary:(NSDictionary *dict)

References setCharacterFromDictionary:.

Referenced by ShipEntity::setUpShipFromDictionary:, ShipSetCrew(), and ShipSetCrew().

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

◆ characterWithRole:andOriginalSystem:

+ (OOCharacter *) characterWithRole: (NSString*) c_role
andOriginalSystem: (OOSystemID) s 

Definition at line 89 of file OOCharacter.m.

89 :(NSString*)role andOriginalSystem:(OOSystemID)system
90{
91 return [[[self alloc] initWithRole:role andOriginalSystem:system] autorelease];
92}
int16_t OOSystemID
Definition OOTypes.h:183

◆ dealloc

- (void) dealloc
implementation

Definition at line 55 of file OOCharacter.m.

56{
57 [_name release];
58 [_shortDescription release];
59 [_scriptActions release];
61
62 [super dealloc];
63}
#define DESTROY(x)
OOJSScript * _script
Definition OOCharacter.h:43

References _script, dealloc, and DESTROY.

Referenced by dealloc.

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

◆ descriptionComponents

- (NSString *) descriptionComponents
implementation

Definition at line 45 of file OOCharacter.m.

46{
47 return [NSString stringWithFormat:@"%@, %@. bounty: %i insurance: %zu", [self name], [self shortDescription], [self legalStatus], [self insuranceCredits]];
48}

References descriptionComponents, insuranceCredits, legalStatus, name, and shortDescription.

Referenced by descriptionComponents.

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

◆ doScriptEvent:

- (void) doScriptEvent: (OOJSPropID) message

Definition at line 390 of file OOCharacter.m.

390 :(OOJSPropID)message
391{
392 JSContext* context = OOJSAcquireContext();
393 [_script callMethod:message inContext:context withArguments:NULL count:0 result:NULL];
394 OOJSRelinquishContext(context);
395}
jsid OOJSPropID
Definition OOJSPropID.h:31
OOINLINE JSContext * OOJSAcquireContext(void)
OOINLINE void OOJSRelinquishContext(JSContext *context)

References OOJSScript::callMethod:inContext:withArguments:count:result:, OOJSAcquireContext(), and OOJSRelinquishContext().

Referenced by PlayerEntity(Contracts)::processEscapePods.

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

◆ genSeed

- (Random_Seed) genSeed
implementation

Provided by category OOCharacter(Private).

Definition at line 307 of file OOCharacter.m.

308{
309 return _genSeed;
310}
Random_Seed _genSeed
Definition OOCharacter.h:39

References OOCharacter(Private)::genSeed.

Referenced by basicSetUp, castInRole:, OOCharacter(Private)::genSeed, and species.

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

◆ infoForScripting

- (NSDictionary *) infoForScripting

Definition at line 327 of file OOCharacter.m.

328{
329 return [NSDictionary dictionaryWithObjectsAndKeys:
330 [self name], @"name",
331 [self shortDescription], @"description",
332 [self species], @"species",
333 [NSNumber numberWithInt:[self legalStatus]], @"legalStatus",
334 [NSNumber numberWithUnsignedLongLong:[self insuranceCredits]], @"insuranceCredits",
335 [NSNumber numberWithInt:[self planetIDOfOrigin]], @"homeSystem",
336 nil];
337}

References infoForScripting, insuranceCredits, legalStatus, name, planetIDOfOrigin, shortDescription, and species.

Referenced by ShipEntity::crewForScripting, infoForScripting, and PlayerEntity(Contracts)::processEscapePods.

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) system 
implementation

Provided by category OOCharacter(Private).

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}
OOSystemID _originSystem
Definition OOCharacter.h:38

References basicSetUp.

Here is the call graph for this function:

◆ initWithRole:andOriginalSystem:

- (id) initWithRole: (NSString*) role
andOriginalSystem: (OOSystemID) s 

Definition at line 77 of file OOCharacter.m.

77 :(NSString*)role andOriginalSystem:(OOSystemID)system
78{
79 Random_Seed seed;
81
82 if ((self = [self initWithGenSeed:seed andOriginalSystem:system])) {
83 [self castInRole:role];
84 }
85
86 return self;
87}
void make_pseudo_random_seed(Random_Seed *seed_ptr)

References castInRole:, and make_pseudo_random_seed().

Here is the call graph for this function:

◆ insuranceCredits

- (OOCreditsQuantity) insuranceCredits

Definition at line 317 of file OOCharacter.m.

318{
319 return _insuranceCredits;
320}
OOCreditsQuantity _insuranceCredits
Definition OOCharacter.h:41

References _insuranceCredits, and insuranceCredits.

Referenced by descriptionComponents, infoForScripting, insuranceCredits, and PlayerEntity(Contracts)::processEscapePods.

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

◆ legacyScript

- (NSArray *) legacyScript

Definition at line 322 of file OOCharacter.m.

323{
324 return _scriptActions;
325}
NSArray * _scriptActions
Definition OOCharacter.h:42

References _scriptActions, and legacyScript.

Referenced by legacyScript, and PlayerEntity(Contracts)::processEscapePods.

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

◆ legalStatus

- (int) legalStatus

Definition at line 312 of file OOCharacter.m.

313{
314 return _legalStatus;
315}

References _legalStatus, int(), and legalStatus.

Referenced by descriptionComponents, infoForScripting, ShipEntity::launchEscapeCapsule, and legalStatus.

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

◆ name

- (NSString *) name

Definition at line 297 of file OOCharacter.m.

298{
299 return _name;
300}
NSString * _name
Definition OOCharacter.h:36

References _name, and name.

Referenced by descriptionComponents, infoForScripting, name, PlayerEntity(Contracts)::processEscapePods, and ShipEntity::scoopUpProcess:processEvents:processMessages:.

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

◆ oo_jsClassName

- (NSString *) oo_jsClassName
implementation

Definition at line 50 of file OOCharacter.m.

51{
52 return @"Character";
53}

References oo_jsClassName.

Referenced by oo_jsClassName.

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

◆ planetIDOfOrigin

- (OOSystemID) planetIDOfOrigin

Definition at line 126 of file OOCharacter.m.

127{
128 // determine the planet of origin
129 return _originSystem;
130}

References _originSystem, and planetIDOfOrigin.

Referenced by basicSetUp, infoForScripting, planetIDOfOrigin, planetOfOrigin, and species.

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

◆ planetOfOrigin

- (NSString *) planetOfOrigin

Definition at line 119 of file OOCharacter.m.

120{
121 // determine the planet of origin
122 NSDictionary* originInfo = [UNIVERSE generateSystemData:[self planetIDOfOrigin]];
123 return [originInfo objectForKey:KEY_NAME];
124}

References planetIDOfOrigin, and planetOfOrigin.

Referenced by planetOfOrigin.

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

◆ randomCharacterWithRole:andOriginalSystem:

+ (OOCharacter *) randomCharacterWithRole: (NSString*) c_role
andOriginalSystem: (OOSystemID) s 

Definition at line 94 of file OOCharacter.m.

94 :(NSString*)role andOriginalSystem:(OOSystemID)system
95{
96 Random_Seed seed;
97
98 seed.a = (Ranrot() & 0xff);
99 seed.b = (Ranrot() & 0xff);
100 seed.c = (Ranrot() & 0xff);
101 seed.d = (Ranrot() & 0xff);
102 seed.e = (Ranrot() & 0xff);
103 seed.f = (Ranrot() & 0xff);
104
105 OOCharacter* character = [[[OOCharacter alloc] initWithGenSeed:seed andOriginalSystem:system] autorelease];
106 [character castInRole:role];
107
108 return character;
109}
BOOL castInRole:(NSString *role)
unsigned Ranrot(void)

References Random_Seed::a, Random_Seed::b, Random_Seed::c, castInRole:, Random_Seed::d, Random_Seed::e, Random_Seed::f, and Ranrot().

Referenced by Universe::addShipAt:withRole:withinRadius:, Universe::addShipWithRole:launchPos:rfactor:, ShipEntity::launchEscapeCapsule, ShipEntity::setSingleCrewWithRole:, and Universe::witchspaceShipWithPrimaryRole:.

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

◆ script

- (OOJSScript *) script

Definition at line 377 of file OOCharacter.m.

378{
379 return _script;
380}

References _script, and script.

Referenced by script.

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

◆ setCharacterFromDictionary:

- (void) setCharacterFromDictionary: (NSDictionary*) dict
implementation

Provided by category OOCharacter(Private).

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
Random_Seed RandomSeedFromString(NSString *abcdefString)
voidpf uLong int origin
Definition ioapi.h:132
#define ranrot_rand()

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

Referenced by characterWithDictionary:.

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

◆ setCharacterScript:

- (void) setCharacterScript: (NSString*) scriptName

Definition at line 382 of file OOCharacter.m.

382 :(NSString*)scriptName
383{
384 [_script autorelease];
386 properties:[NSDictionary dictionaryWithObject:self forKey:@"character"]];
387 [_script retain];
388}
id jsScriptFromFileNamed:properties:(NSString *fileName,[properties] NSDictionary *properties)
Definition OOScript.m:177

References _script, and OOScript::jsScriptFromFileNamed:properties:.

Referenced by OOCharacter(Private)::setCharacterFromDictionary:.

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

◆ setGenSeed:

- (void) setGenSeed: (Random_Seed) value
implementation

Definition at line 356 of file OOCharacter.m.

356 :(Random_Seed)value
357{
358 _genSeed = value;
359}

References _genSeed.

Referenced by OOCharacter(Private)::setCharacterFromDictionary:.

Here is the caller graph for this function:

◆ setInsuranceCredits:

- (void) setInsuranceCredits: (OOCreditsQuantity) value

Definition at line 366 of file OOCharacter.m.

366 :(OOCreditsQuantity)value
367{
368 _insuranceCredits = value;
369}
uint64_t OOCreditsQuantity
Definition OOTypes.h:160

References _insuranceCredits.

Referenced by basicSetUp, castInRole:, and OOCharacter(Private)::setCharacterFromDictionary:.

Here is the caller graph for this function:

◆ setLegacyScript:

- (void) setLegacyScript: (NSArray*) scriptActions

Definition at line 371 of file OOCharacter.m.

371 :(NSArray*)some_actions
372{
373 [_scriptActions autorelease];
374 _scriptActions = [some_actions copy];
375}

References _scriptActions.

Referenced by OOCharacter(Private)::setCharacterFromDictionary:.

Here is the caller graph for this function:

◆ setLegalStatus:

- (void) setLegalStatus: (int) value

Definition at line 361 of file OOCharacter.m.

361 :(int)value
362{
363 _legalStatus = value;
364}
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque

References _legalStatus.

Referenced by basicSetUp, castInRole:, ShipEntity::launchEscapeCapsule, and OOCharacter(Private)::setCharacterFromDictionary:.

Here is the caller graph for this function:

◆ setName:

- (void) setName: (NSString*) value

Definition at line 339 of file OOCharacter.m.

339 :(NSString*)value
340{
341 [_name autorelease];
342 _name = [value copy];
343}

References _name.

Referenced by basicSetUp, castInRole:, and OOCharacter(Private)::setCharacterFromDictionary:.

Here is the caller graph for this function:

◆ setOriginSystem:

- (void) setOriginSystem: (OOSystemID) value
implementation

Provided by category OOCharacter(Private).

Definition at line 351 of file OOCharacter.m.

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

Referenced by OOCharacter(Private)::setCharacterFromDictionary:.

Here is the caller graph for this function:

◆ setShortDescription:

- (void) setShortDescription: (NSString*) value

Definition at line 345 of file OOCharacter.m.

345 :(NSString*)value
346{
347 [_shortDescription autorelease];
348 _shortDescription = [value copy];
349}
NSString * _shortDescription
Definition OOCharacter.h:37

References _shortDescription.

Referenced by basicSetUp, castInRole:, and OOCharacter(Private)::setCharacterFromDictionary:.

Here is the caller graph for this function:

◆ shortDescription

- (NSString *) shortDescription

Definition at line 302 of file OOCharacter.m.

303{
304 return _shortDescription;
305}

References _shortDescription, and shortDescription.

Referenced by descriptionComponents, infoForScripting, PlayerEntity(Contracts)::processEscapePods, and shortDescription.

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

◆ species

- (NSString *) species

Definition at line 132 of file OOCharacter.m.

133{
134 // determine the character's species
135 int species = [self genSeed].f & 0x03; // 0-1 native to home system, 2 human colonial, 3 other
136 NSString* speciesString = nil;
137 if (species == 3)
138 speciesString = [UNIVERSE getSystemInhabitants:[self genSeed].e plural:NO];
139 else
140 speciesString = [UNIVERSE getSystemInhabitants:[self planetIDOfOrigin] plural:NO];
141
142 if (![[UNIVERSE descriptions] oo_boolForKey:@"lowercase_ignore"]) {
143 speciesString = [speciesString lowercaseString];
144 }
145
146 return [speciesString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
147}
#define UNIVERSE
Definition Universe.h:827

References genSeed, nil, planetIDOfOrigin, species, and UNIVERSE.

Referenced by basicSetUp, infoForScripting, and species.

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

Member Data Documentation

◆ _genSeed

- (Random_Seed) _genSeed
private

Definition at line 39 of file OOCharacter.h.

Referenced by setGenSeed:.

◆ _insuranceCredits

- (OOCreditsQuantity) _insuranceCredits
private

Definition at line 41 of file OOCharacter.h.

Referenced by insuranceCredits, and setInsuranceCredits:.

◆ _legalStatus

- (int) _legalStatus
private

Definition at line 40 of file OOCharacter.h.

Referenced by basicSetUp, legalStatus, and setLegalStatus:.

◆ _name

- (NSString*) _name
private

Definition at line 36 of file OOCharacter.h.

Referenced by name, and setName:.

◆ _originSystem

- (OOSystemID) _originSystem
private

Definition at line 38 of file OOCharacter.h.

Referenced by planetIDOfOrigin.

◆ _script

- (OOJSScript*) _script
private

Definition at line 43 of file OOCharacter.h.

Referenced by dealloc, script, and setCharacterScript:.

◆ _scriptActions

- (NSArray*) _scriptActions
private

Definition at line 42 of file OOCharacter.h.

Referenced by legacyScript, and setLegacyScript:.

◆ _shortDescription

- (NSString*) _shortDescription
private

Definition at line 37 of file OOCharacter.h.

Referenced by setShortDescription:, and shortDescription.


The documentation for this class was generated from the following files: