Oolite 1.91.0.7645-241119-222d325
Loading...
Searching...
No Matches
PlayerEntity(ScriptMethods) Category Reference

#include <PlayerEntityScriptMethods.h>

Instance Methods

(unsigned) - score
 
(void) - setScore:
 
(double) - creditBalance
 
(void) - setCreditBalance:
 
(NSString *) - dockedStationName
 
(NSString *) - dockedStationDisplayName
 
(BOOL) - dockedAtMainStation
 
(void) - awardCommodityType:amount:
 
(void) - resetScannerZoom
 
(OOGalaxyID- currentGalaxyID
 
(OOSystemID- currentSystemID
 
(void) - setMissionChoice:
 
(void) - setMissionChoice:withEvent:
 
(void) - setMissionChoice:keyPress:
 
(void) - setMissionChoice:keyPress:withEvent:
 
(void) - allowMissionInterrupt
 
(OOTimeDelta- scriptTimer
 
(unsigned) - systemPseudoRandom100
 
(unsigned) - systemPseudoRandom256
 
(double) - systemPseudoRandomFloat
 
(NSDictionary *) - passengerContractMarker:
 
(NSDictionary *) - parcelContractMarker:
 
(NSDictionary *) - cargoContractMarker:
 
(NSDictionary *) - defaultMarker:
 
(NSDictionary *) - validatedMarker:
 
(NSString *) - keyBindingDescription2:
 
(NSString *) - getKeyBindingDescription:
 
(NSString *) - keyCodeDescription:
 
(NSString *) - keyCodeDescriptionShort:
 
(NSString *) - commanderKillsAsString
 
(NSString *) - commanderBountyAsString
 
(NSString *) - creditsFormattedForSubstitution
 
(NSString *) - creditsFormattedForLegacySubstitution
 

Detailed Description

Definition at line 31 of file PlayerEntityScriptMethods.h.

Method Documentation

◆ allowMissionInterrupt

- (void) allowMissionInterrupt

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

237{
238 _missionAllowInterrupt = YES;
239}

◆ awardCommodityType:amount:

- (void) awardCommodityType: (NSString *) type
amount: (OOCargoQuantity) amount 

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

82 :(OOCommodityType)type amount:(OOCargoQuantity)amount
83{
84 OOMassUnit unit;
85
86 if (![[UNIVERSE commodities] goodDefined:type])
87 {
88 return;
89 }
90
91 OOLog(@"script.debug.note.awardCargo", @"Going to award cargo: %d x '%@'", amount, type);
92
93 unit = [shipCommodityData massUnitForGood:type];
94
95 if ([self status] != STATUS_DOCKED)
96 {
97 // in-flight
98 while (amount)
99 {
100 if (unit != UNITS_TONS)
101 {
102 if (specialCargo)
103 {
104 // is this correct behaviour?
105 [shipCommodityData addQuantity:amount forGood:type];
106 }
107 else
108 {
109 int amount_per_container = (unit == UNITS_KILOGRAMS)? 1000 : 1000000;
110 while (amount > 0)
111 {
112 int smaller_quantity = 1 + ((amount - 1) % amount_per_container);
113 if ([cargo count] < [self maxAvailableCargoSpace])
114 {
115 ShipEntity* container = [UNIVERSE newShipWithRole:@"1t-cargopod"];
116 if (container)
117 {
118 // the cargopod ship is just being set up. If ejected, will call UNIVERSE addEntity
119 // [container wasAddedToUniverse]; // seems to be not needed anymore for pods
120 [container setScanClass: CLASS_CARGO];
121 [container setStatus:STATUS_IN_HOLD];
122 [container setCommodity:type andAmount:smaller_quantity];
123 [cargo addObject:container];
124 [container release];
125 }
126 }
127 amount -= smaller_quantity;
128 }
129 }
130 }
131 else if (!specialCargo)
132 // no adding TCs while special cargo in hold
133 {
134 // put each ton in a separate container
135 while (amount)
136 {
137 if ([cargo count] < [self maxAvailableCargoSpace])
138 {
139 ShipEntity* container = [UNIVERSE newShipWithRole:@"1t-cargopod"];
140 if (container)
141 {
142 // the cargopod ship is just being set up. If ejected, will call UNIVERSE addEntity
143 // [container wasAddedToUniverse]; // seems to be not needed anymore for pods
144 [container setScanClass: CLASS_CARGO];
145 [container setStatus:STATUS_IN_HOLD];
146 [container setCommodity:type andAmount:1];
147 [cargo addObject:container];
148 [container release];
149 }
150 }
151 amount--;
152 }
153 }
154 }
155 }
156 else
157 { // docked
158 // like purchasing a commodity
159 int manifest_quantity = [shipCommodityData quantityForGood:type];
160 while ((amount)&&(current_cargo < [self maxAvailableCargoSpace]))
161 {
162 manifest_quantity++;
163 amount--;
164 if (unit == UNITS_TONS) current_cargo++;
165 }
166 [shipCommodityData setQuantity:manifest_quantity forGood:type];
167 }
168 [self calculateCurrentCargo];
169}
#define OOLog(class, format,...)
Definition OOLogging.h:88
unsigned count
NSString * OOCommodityType
Definition OOTypes.h:106
uint32_t OOCargoQuantity
Definition OOTypes.h:176
OOMassUnit
Definition OOTypes.h:123
@ UNITS_TONS
Definition OOTypes.h:124
@ UNITS_KILOGRAMS
Definition OOTypes.h:125
#define UNIVERSE
Definition Universe.h:833
void setScanClass:(OOScanClass sClass)
Definition Entity.m:799
void setStatus:(OOEntityStatus stat)
void setCommodity:andAmount:(OOCommodityType co_type,[andAmount] OOCargoQuantity co_amount)

◆ cargoContractMarker:

- (NSDictionary *) cargoContractMarker: (OOSystemID) system

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

300 :(OOSystemID)system
301{
302 return [[[NSDictionary dictionaryWithObjectsAndKeys:
303 [NSNumber numberWithInt:system], @"system",
304 MISSION_DEST_LEGACY, @"name",
305 @"orangeColor", @"markerColor",
306 @"MARKER_SQUARE", @"markerShape",
307 nil] retain] autorelease];
308}
int16_t OOSystemID
Definition OOTypes.h:211

◆ commanderBountyAsString

- (NSString *) commanderBountyAsString

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

368{
369 return [NSString stringWithFormat:@"%i", [self legalStatus]];
370}

◆ commanderKillsAsString

- (NSString *) commanderKillsAsString

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

375{
376 return [NSString stringWithFormat:@"%i", [self score]];
377}

◆ creditBalance

- (double) creditBalance

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

53{
54 return 0.1 * credits;
55}

◆ creditsFormattedForLegacySubstitution

- (NSString *) creditsFormattedForLegacySubstitution

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

357{
358 OOCreditsQuantity tenthsOfCredits = [self deciCredits];
359 unsigned long long integerCredits = tenthsOfCredits / 10;
360 unsigned long long tenths = tenthsOfCredits % 10;
361
362 return [NSString stringWithFormat:@"%llu.%llu", integerCredits, tenths];
363}
uint64_t OOCreditsQuantity
Definition OOTypes.h:182

◆ creditsFormattedForSubstitution

- (NSString *) creditsFormattedForSubstitution

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

345{
346 return OOStringFromDeciCredits([self deciCredits], YES, NO);
347}
NSString * OOStringFromDeciCredits(OOCreditsQuantity tenthsOfCredits, BOOL includeDecimal, BOOL includeSymbol)

◆ currentGalaxyID

- (OOGalaxyID) currentGalaxyID

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

179{
180 return galaxy_number;
181}

◆ currentSystemID

- (OOSystemID) currentSystemID

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

185{
186 if ([UNIVERSE sun] == nil) return -1; // Interstellar space
187 return [UNIVERSE currentSystemID];
188}
return nil

◆ defaultMarker:

- (NSDictionary *) defaultMarker: (OOSystemID) system

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

311 :(OOSystemID)system
312{
313 return [[[NSDictionary dictionaryWithObjectsAndKeys:
314 [NSNumber numberWithInt:system], @"system",
315 MISSION_DEST_LEGACY, @"name",
316 @"redColor", @"markerColor",
317 @"MARKER_X", @"markerShape",
318 nil] retain] autorelease];
319}

◆ dockedAtMainStation

- (BOOL) dockedAtMainStation

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

77{
78 return [self status] == STATUS_DOCKED && [self dockedStation] == [UNIVERSE station];
79}

◆ dockedStationDisplayName

- (NSString *) dockedStationDisplayName

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

71{
72 return [[self dockedStation] displayName];
73}

◆ dockedStationName

- (NSString *) dockedStationName

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

65{
66 return [[self dockedStation] name];
67}

◆ getKeyBindingDescription:

- (NSString *) getKeyBindingDescription: (NSArray *) keyList

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

393 :(NSArray *) keyList
394{
395 NSUInteger i = 0;
396 NSMutableString *final = [NSMutableString string];
397 for (i = 0; i < [keyList count]; i++) {
398 if (i != 0) final = [NSMutableString stringWithFormat:@"%@ or ", final];
399 NSDictionary *def = [keyList objectAtIndex:i];
400 NSString *key = [def objectForKey:@"key"];
401 OOKeyCode k_int = (OOKeyCode)[key integerValue];
402 NSString *desc = [self keyCodeDescription:k_int];
403 // 0 = key not set
404 if (k_int != 0) {
405 if ([[def objectForKey:@"mod2"] boolValue] == YES) final = [NSMutableString stringWithFormat:@"%@%@+", final, keyMod2Text];
406 if ([[def objectForKey:@"mod1"] boolValue] == YES) final = [NSMutableString stringWithFormat:@"%@%@+", final, keyMod1Text];
407 if ([[def objectForKey:@"shift"] boolValue] == YES) final = [NSMutableString stringWithFormat:@"%@%@+", final, keyShiftText];
408 final = [NSMutableString stringWithFormat:@"%@%@", final, desc];
409 }
410 }
411 return final;
412}
uint16_t OOKeyCode
Definition OOTypes.h:186

◆ keyBindingDescription2:

- (NSString *) keyBindingDescription2: (NSString *) binding

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

381 :(NSString *)binding
382{
383 if ([keyconfig2_settings objectForKey:binding] == nil)
384 {
385 // no such setting
386 return nil;
387 }
388 NSArray *keyList = (NSArray*)[keyconfig2_settings objectForKey:binding];
389 return [self getKeyBindingDescription:keyList];
390}

◆ keyCodeDescription:

- (NSString *) keyCodeDescription: (OOKeyCode) code

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

415 :(OOKeyCode)code
416{
417 switch (code)
418 {
419 case 0:
420 return DESC(@"oolite-keycode-unset");
421 case 9:
422 return DESC(@"oolite-keycode-tab");
423 case 13:
424 return DESC(@"oolite-keycode-enter");
425 case 27:
426 return DESC(@"oolite-keycode-esc");
427 case 32:
428 return DESC(@"oolite-keycode-space");
429 case gvFunctionKey1:
430 return DESC(@"oolite-keycode-f1");
431 case gvFunctionKey2:
432 return DESC(@"oolite-keycode-f2");
433 case gvFunctionKey3:
434 return DESC(@"oolite-keycode-f3");
435 case gvFunctionKey4:
436 return DESC(@"oolite-keycode-f4");
437 case gvFunctionKey5:
438 return DESC(@"oolite-keycode-f5");
439 case gvFunctionKey6:
440 return DESC(@"oolite-keycode-f6");
441 case gvFunctionKey7:
442 return DESC(@"oolite-keycode-f7");
443 case gvFunctionKey8:
444 return DESC(@"oolite-keycode-f8");
445 case gvFunctionKey9:
446 return DESC(@"oolite-keycode-f9");
447 case gvFunctionKey10:
448 return DESC(@"oolite-keycode-f10");
449 case gvFunctionKey11:
450 return DESC(@"oolite-keycode-f11");
451 case gvArrowKeyRight:
452 return DESC(@"oolite-keycode-right");
453 case gvArrowKeyLeft:
454 return DESC(@"oolite-keycode-left");
455 case gvArrowKeyDown:
456 return DESC(@"oolite-keycode-down");
457 case gvArrowKeyUp:
458 return DESC(@"oolite-keycode-up");
459 case gvHomeKey:
460 return DESC(@"oolite-keycode-home");
461 case gvEndKey:
462 return DESC(@"oolite-keycode-end");
463 case gvInsertKey:
464 return DESC(@"oolite-keycode-insert");
465 case gvDeleteKey:
466 return DESC(@"oolite-keycode-delete");
467 case gvPageUpKey:
468 return DESC(@"oolite-keycode-pageup");
469 case gvPageDownKey:
470 return DESC(@"oolite-keycode-pagedown");
471 case gvNumberPadKey0:
472 return DESC(@"oolite-keycode-numpad0");
473 case gvNumberPadKey1:
474 return DESC(@"oolite-keycode-numpad1");
475 case gvNumberPadKey2:
476 return DESC(@"oolite-keycode-numpad2");
477 case gvNumberPadKey3:
478 return DESC(@"oolite-keycode-numpad3");
479 case gvNumberPadKey4:
480 return DESC(@"oolite-keycode-numpad4");
481 case gvNumberPadKey5:
482 return DESC(@"oolite-keycode-numpad5");
483 case gvNumberPadKey6:
484 return DESC(@"oolite-keycode-numpad6");
485 case gvNumberPadKey7:
486 return DESC(@"oolite-keycode-numpad7");
487 case gvNumberPadKey8:
488 return DESC(@"oolite-keycode-numpad8");
489 case gvNumberPadKey9:
490 return DESC(@"oolite-keycode-numpad9");
491 case gvPrintScreenKey:
492 return DESC(@"oolite-keycode-printscreen");
493 case gvPauseKey:
494 return DESC(@"oolite-keycode-pause");
496 return DESC(@"oolite-keycode-numpad/");
498 return DESC(@"oolite-keycode-numpad=");
500 return DESC(@"oolite-keycode-numpad-");
502 return DESC(@"oolite-keycode-numpad*");
504 return DESC(@"oolite-keycode-numpad.");
506 return DESC(@"oolite-keycode-numpad+");
508 return DESC(@"oolite-keycode-numpadenter");
509
510 default:
511 return [NSString stringWithFormat:@"%C",code];
512 }
513}
@ gvNumberPadKeyDivide
@ gvNumberPadKeyMultiply
@ gvNumberPadKeyPeriod
@ gvFunctionKey2
@ gvInsertKey
@ gvNumberPadKeyPlus
@ gvNumberPadKey9
@ gvNumberPadKey1
@ gvFunctionKey10
@ gvFunctionKey5
@ gvDeleteKey
@ gvArrowKeyDown
@ gvNumberPadKey2
@ gvFunctionKey9
@ gvNumberPadKey3
@ gvFunctionKey4
@ gvEndKey
@ gvHomeKey
@ gvNumberPadKeyEquals
@ gvNumberPadKey6
@ gvNumberPadKeyEnter
@ gvNumberPadKey5
@ gvNumberPadKey4
@ gvPauseKey
@ gvNumberPadKeyMinus
@ gvNumberPadKey7
@ gvPrintScreenKey
@ gvFunctionKey11
@ gvFunctionKey8
@ gvPageDownKey
@ gvNumberPadKey8
@ gvFunctionKey3
@ gvArrowKeyUp
@ gvArrowKeyRight
@ gvFunctionKey6
@ gvArrowKeyLeft
@ gvFunctionKey7
@ gvPageUpKey
@ gvNumberPadKey0
@ gvFunctionKey1
#define DESC(key)
Definition Universe.h:839

◆ keyCodeDescriptionShort:

- (NSString *) keyCodeDescriptionShort: (OOKeyCode) code

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

515 :(OOKeyCode)code
516{
517 switch (code)
518 {
519 case 0:
520 return DESC(@"oolite-keycode-short-unset");
521 case 9:
522 return DESC(@"oolite-keycode-short-tab");
523 case 13:
524 return DESC(@"oolite-keycode-short-enter");
525 case 27:
526 return DESC(@"oolite-keycode-short-esc");
527 case 32:
528 return DESC(@"oolite-keycode-short-space");
529 case gvFunctionKey1:
530 return DESC(@"oolite-keycode-short-f1");
531 case gvFunctionKey2:
532 return DESC(@"oolite-keycode-short-f2");
533 case gvFunctionKey3:
534 return DESC(@"oolite-keycode-short-f3");
535 case gvFunctionKey4:
536 return DESC(@"oolite-keycode-short-f4");
537 case gvFunctionKey5:
538 return DESC(@"oolite-keycode-short-f5");
539 case gvFunctionKey6:
540 return DESC(@"oolite-keycode-short-f6");
541 case gvFunctionKey7:
542 return DESC(@"oolite-keycode-short-f7");
543 case gvFunctionKey8:
544 return DESC(@"oolite-keycode-short-f8");
545 case gvFunctionKey9:
546 return DESC(@"oolite-keycode-short-f9");
547 case gvFunctionKey10:
548 return DESC(@"oolite-keycode-short-f10");
549 case gvFunctionKey11:
550 return DESC(@"oolite-keycode-short-f11");
551 case gvArrowKeyRight:
552 return DESC(@"oolite-keycode-short-right");
553 case gvArrowKeyLeft:
554 return DESC(@"oolite-keycode-short-left");
555 case gvArrowKeyDown:
556 return DESC(@"oolite-keycode-short-down");
557 case gvArrowKeyUp:
558 return DESC(@"oolite-keycode-short-up");
559 case gvHomeKey:
560 return DESC(@"oolite-keycode-short-home");
561 case gvEndKey:
562 return DESC(@"oolite-keycode-short-end");
563 case gvInsertKey:
564 return DESC(@"oolite-keycode-short-insert");
565 case gvDeleteKey:
566 return DESC(@"oolite-keycode-short-delete");
567 case gvPageUpKey:
568 return DESC(@"oolite-keycode-short-pageup");
569 case gvPageDownKey:
570 return DESC(@"oolite-keycode-short-pagedown");
571 case gvNumberPadKey0:
572 return DESC(@"oolite-keycode-short-numpad0");
573 case gvNumberPadKey1:
574 return DESC(@"oolite-keycode-short-numpad1");
575 case gvNumberPadKey2:
576 return DESC(@"oolite-keycode-short-numpad2");
577 case gvNumberPadKey3:
578 return DESC(@"oolite-keycode-short-numpad3");
579 case gvNumberPadKey4:
580 return DESC(@"oolite-keycode-short-numpad4");
581 case gvNumberPadKey5:
582 return DESC(@"oolite-keycode-short-numpad5");
583 case gvNumberPadKey6:
584 return DESC(@"oolite-keycode-short-numpad6");
585 case gvNumberPadKey7:
586 return DESC(@"oolite-keycode-short-numpad7");
587 case gvNumberPadKey8:
588 return DESC(@"oolite-keycode-short-numpad8");
589 case gvNumberPadKey9:
590 return DESC(@"oolite-keycode-short-numpad9");
591 case gvPrintScreenKey:
592 return DESC(@"oolite-keycode-short-printscreen");
593 case gvPauseKey:
594 return DESC(@"oolite-keycode-short-pause");
596 return DESC(@"oolite-keycode-short-numpad/");
598 return DESC(@"oolite-keycode-short-numpad=");
600 return DESC(@"oolite-keycode-short-numpad-");
602 return DESC(@"oolite-keycode-short-numpad*");
604 return DESC(@"oolite-keycode-short-numpad.");
606 return DESC(@"oolite-keycode-short-numpad+");
608 return DESC(@"oolite-keycode-short-numpadenter");
609 default:
610 return [NSString stringWithFormat:@"%C",code];
611 }
612}

◆ parcelContractMarker:

- (NSDictionary *) parcelContractMarker: (OOSystemID) system

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

289 :(OOSystemID)system
290{
291 return [[[NSDictionary dictionaryWithObjectsAndKeys:
292 [NSNumber numberWithInt:system], @"system",
293 MISSION_DEST_LEGACY, @"name",
294 @"orangeColor", @"markerColor",
295 @"MARKER_PLUS", @"markerShape",
296 nil] retain] autorelease];
297}

◆ passengerContractMarker:

- (NSDictionary *) passengerContractMarker: (OOSystemID) system

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

278 :(OOSystemID)system
279{
280 return [[[NSDictionary dictionaryWithObjectsAndKeys:
281 [NSNumber numberWithInt:system], @"system",
282 MISSION_DEST_LEGACY, @"name",
283 @"orangeColor", @"markerColor",
284 @"MARKER_DIAMOND", @"markerShape",
285 nil] retain] autorelease];
286}

◆ resetScannerZoom

- (void) resetScannerZoom

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

173{
174 scanner_zoom_rate = SCANNER_ZOOM_RATE_DOWN;
175}
#define SCANNER_ZOOM_RATE_DOWN

◆ score

- (unsigned) score

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

41{
42 return ship_kills;
43}

◆ scriptTimer

- (OOTimeDelta) scriptTimer

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

243{
244 return script_time;
245}

◆ setCreditBalance:

- (void) setCreditBalance: (double) value

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

58 :(double)value
59{
60 credits = OODeciCreditsFromDouble(value * 10.0);
61}
OOCreditsQuantity OODeciCreditsFromDouble(double doubleDeciCredits)

◆ setMissionChoice:

- (void) setMissionChoice: (NSString *) newChoice

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

191 :(NSString *)newChoice
192{
193 [self setMissionChoice:newChoice keyPress:@"" withEvent:YES];
194}

◆ setMissionChoice:keyPress:

- (void) setMissionChoice: (NSString *) newChoice
keyPress: (NSString *) keyPress 

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

203 :(NSString *)newChoice keyPress:(NSString *)keyPress
204{
205 [self setMissionChoice:newChoice keyPress:keyPress withEvent:YES];
206}

◆ setMissionChoice:keyPress:withEvent:

- (void) setMissionChoice: (NSString *) newChoice
keyPress: (NSString *) keyPress
withEvent: (BOOL) withEvent 

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

209 :(NSString *)newChoice keyPress:(NSString *)keyPress withEvent:(BOOL)withEvent
210{
211 BOOL equal = [newChoice isEqualToString:missionChoice] || (newChoice == missionChoice); // Catch both being nil as well
212 if (!equal)
213 {
214 if (newChoice == nil)
215 {
216 NSString *oldChoice = missionChoice;
217 [missionChoice autorelease];
218 missionChoice = nil;
219 if (withEvent) [self doScriptEvent:OOJSID("missionChoiceWasReset") withArgument:oldChoice];
220 }
221 else
222 {
223 [missionChoice autorelease];
224 missionChoice = [newChoice copy];
225 }
226 }
227 equal = [keyPress isEqualToString:missionKeyPress] || (keyPress == missionKeyPress);
228 if (!equal)
229 {
230 [missionKeyPress autorelease];
231 missionKeyPress = [keyPress copy];
232 }
233}

◆ setMissionChoice:withEvent:

- (void) setMissionChoice: (NSString *) newChoice
withEvent: (BOOL) withEvent 

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

197 :(NSString *)newChoice withEvent:(BOOL)withEvent
198{
199 [self setMissionChoice:newChoice keyPress:@"" withEvent:withEvent];
200}

◆ setScore:

- (void) setScore: (unsigned) value

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

46 :(unsigned)value
47{
48 ship_kills = value;
49}

◆ systemPseudoRandom100

- (unsigned) systemPseudoRandom100

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

252{
253 seed_RNG_only_for_planet_description([[UNIVERSE systemManager] getRandomSeedForCurrentSystem]);
254 return (gen_rnd_number() * 256 + gen_rnd_number()) % 100;
255}
void seed_RNG_only_for_planet_description(Random_Seed s_seed)
int gen_rnd_number(void)

◆ systemPseudoRandom256

- (unsigned) systemPseudoRandom256

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

259{
260 seed_RNG_only_for_planet_description([[UNIVERSE systemManager] getRandomSeedForCurrentSystem]);
261 return gen_rnd_number();
262}

◆ systemPseudoRandomFloat

- (double) systemPseudoRandomFloat

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

266{
267 seed_RNG_only_for_planet_description([[UNIVERSE systemManager] getRandomSeedForCurrentSystem]);
268 unsigned a = gen_rnd_number();
269 unsigned b = gen_rnd_number();
270 unsigned c = gen_rnd_number();
271
272 a = (a << 16) | (b << 8) | c;
273 return (double)a / (double)0x01000000;
274
275}

◆ validatedMarker:

- (NSDictionary *) validatedMarker: (NSDictionary *) marker

Extends class PlayerEntity.

Definition at line 623 of file PlayerEntityScriptMethods.m.

322 :(NSDictionary *)marker
323{
324 OOSystemID dest = [marker oo_intForKey:@"system"];
325// FIXME: parameters
326 if (dest < 0 || dest > kOOMaximumSystemID)
327 {
328 return nil;
329 }
330 NSString *group = [marker oo_stringForKey:@"name" defaultValue:MISSION_DEST_LEGACY];
331
332 return [[[NSDictionary dictionaryWithObjectsAndKeys:
333 [NSNumber numberWithInt:dest], @"system",
334 group, @"name",
335 [marker oo_stringForKey:@"markerColor" defaultValue:@"redColor"], @"markerColor",
336 [marker oo_stringForKey:@"markerShape" defaultValue:@"MARKER_X"], @"markerShape",
337 [NSNumber numberWithFloat:[marker oo_floatForKey:@"markerScale" defaultValue:1.0]], @"markerScale",
338 nil] retain] autorelease];
339
340}
@ kOOMaximumSystemID
Definition OOTypes.h:217

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