Oolite 1.91.0.7645-241119-222d325
Loading...
Searching...
No Matches
OOSystemInfo Class Reference
+ Inheritance diagram for OOSystemInfo:
+ Collaboration diagram for OOSystemInfo:

Instance Methods

(id) - initWithGalaxy:system:
 
(id) - valueForKey:
 
(void) - setValue:forKey:
 
(NSArray *) - allKeys
 
(OOGalaxyID- galaxy
 
(OOSystemID- system
 
(id) - init [implementation]
 
(void) - dealloc [implementation]
 
(NSString *) - descriptionComponents [implementation]
 
(NSString *) - shortDescriptionComponents [implementation]
 
(NSString *) - oo_jsClassName [implementation]
 
(BOOL) - isEqual: [implementation]
 
(NSUInteger) - hash [implementation]
 
(NSPoint) - coordinates [implementation]
 
(jsval) - oo_jsValueInContext: [implementation]
 

Private Attributes

OOGalaxyID _galaxy
 
OOSystemID _system
 
NSString * _planetKey
 

Detailed Description

Definition at line 117 of file OOJSSystemInfo.m.

Method Documentation

◆ allKeys

- (NSArray *) allKeys

Definition at line 122 of file OOJSSystemInfo.m.

233{
234 if ([UNIVERSE inInterstellarSpace] && _system == -1)
235 {
236 return [[UNIVERSE currentSystemData] allKeys];
237 }
238 return [UNIVERSE systemDataKeysForGalaxy:_galaxy planet:_system];
239}
#define UNIVERSE
Definition Universe.h:833
OOSystemID _system

Referenced by SystemInfoEnumerate().

+ Here is the caller graph for this function:

◆ coordinates

- (NSPoint) coordinates
implementation

Definition at line 122 of file OOJSSystemInfo.m.

262{
263 if ([UNIVERSE inInterstellarSpace] && _system == -1)
264 {
265 return [PLAYER galaxy_coordinates];
266 }
267 return [UNIVERSE coordinatesForSystem:_system];
268}

Referenced by SystemInfoDistanceToSystem(), and SystemInfoGetProperty().

+ Here is the caller graph for this function:

◆ dealloc

- (void) dealloc
implementation

Definition at line 122 of file OOJSSystemInfo.m.

170{
171 [_planetKey release];
172
173 [super dealloc];
174}

◆ descriptionComponents

- (NSString *) descriptionComponents
implementation

Definition at line 122 of file OOJSSystemInfo.m.

178{
179 return [NSString stringWithFormat:@"galaxy %u, system %i", _galaxy, _system];
180}

◆ galaxy

- (OOGalaxyID) galaxy

Definition at line 122 of file OOJSSystemInfo.m.

243{
244 return _galaxy;
245}
OOGalaxyID _galaxy

Referenced by GetJSSystemInfoForSystem(), SystemInfoDistanceToSystem(), SystemInfoGetProperty(), SystemInfoRouteToSystem(), SystemInfoSamplePrice(), SystemInfoSetPropertyMethod(), and SystemInfoStaticFilteredSystems().

+ Here is the caller graph for this function:

◆ hash

- (NSUInteger) hash
implementation

Definition at line 122 of file OOJSSystemInfo.m.

206{
207 NSUInteger hash = _galaxy;
208 hash <<= 16;
209 hash |= (uint16_t)_system;
210 return hash;
211}
NSUInteger hash()

◆ init

- (id) init
implementation

Definition at line 122 of file OOJSSystemInfo.m.

145{
146 [self release];
147 return nil;
148}
return nil

◆ initWithGalaxy:system:

- (id) initWithGalaxy: (OOGalaxyID) galaxy
system: (OOSystemID) system 

Definition at line 122 of file OOJSSystemInfo.m.

152{
154 {
155 [self release];
156 return nil;
157 }
158
159 if ((self = [super init]))
160 {
161 _galaxy = galaxy;
162 _system = system;
163 _planetKey = [[NSString stringWithFormat:@"%u %i", galaxy, system] retain];
164 }
165 return self;
166}
int16_t OOSystemID
Definition OOTypes.h:211
uint8_t OOGalaxyID
Definition OOTypes.h:210
@ kOOMaximumSystemID
Definition OOTypes.h:217
@ kOOMaximumGalaxyID
Definition OOTypes.h:216
@ kOOMinimumSystemID
Definition OOTypes.h:218
OOSystemID system()
OOGalaxyID galaxy()
NSString * _planetKey

◆ isEqual:

- (BOOL) isEqual: (id) other
implementation

Definition at line 122 of file OOJSSystemInfo.m.

195 :(id)other
196{
197 return other == self ||
198 ([other isKindOfClass:[OOSystemInfo class]] &&
199 [other galaxy] == _galaxy &&
200 [other system] == _system);
201
202}

◆ oo_jsClassName

- (NSString *) oo_jsClassName
implementation

Definition at line 122 of file OOJSSystemInfo.m.

190{
191 return @"SystemInfo";
192}

◆ oo_jsValueInContext:

- (jsval) oo_jsValueInContext: (JSContext *) context
implementation

Definition at line 122 of file OOJSSystemInfo.m.

271 :(JSContext *)context
272{
273 JSObject *jsSelf = NULL;
274 jsval result = JSVAL_NULL;
275
276 jsSelf = JS_NewObject(context, &sSystemInfoClass, sSystemInfoPrototype, NULL);
277 if (jsSelf != NULL)
278 {
279 if (!JS_SetPrivate(context, jsSelf, [self retain])) jsSelf = NULL;
280 }
281 if (jsSelf != NULL) result = OBJECT_TO_JSVAL(jsSelf);
282
283 return result;
284}
static JSObject * sSystemInfoPrototype
static JSClass sSystemInfoClass

◆ setValue:forKey:

- (void) setValue: (id) value
forKey: (NSString *) key 

Definition at line 122 of file OOJSSystemInfo.m.

224 :(id)value forKey:(NSString *)key
225{
226 NSString *manifest = [[OOJSScript currentlyRunningScript] propertyNamed:kLocalManifestProperty];
227
228 [UNIVERSE setSystemDataForGalaxy:_galaxy planet:_system key:key value:value fromManifest:manifest forLayer:OO_LAYER_OXP_DYNAMIC];
229}
id propertyNamed:(NSString *name)
Definition OOJSScript.m:491
OOJSScript * currentlyRunningScript()
Definition OOJSScript.m:339

Referenced by SystemInfoSetProperty().

+ Here is the caller graph for this function:

◆ shortDescriptionComponents

- (NSString *) shortDescriptionComponents
implementation

Definition at line 122 of file OOJSSystemInfo.m.

184{
185 return _planetKey;
186}

◆ system

- (OOSystemID) system

Definition at line 122 of file OOJSSystemInfo.m.

249{
250 return _system;
251}

Referenced by GetJSSystemInfoForSystem(), SystemInfoGetProperty(), SystemInfoRouteToSystem(), SystemInfoSamplePrice(), SystemInfoSetPropertyMethod(), and SystemInfoStaticFilteredSystems().

+ Here is the caller graph for this function:

◆ valueForKey:

- (id) valueForKey: (NSString *) key

Definition at line 122 of file OOJSSystemInfo.m.

214 :(NSString *)key
215{
216 if ([UNIVERSE inInterstellarSpace] && _system == -1)
217 {
218 return [[UNIVERSE currentSystemData] objectForKey:key];
219 }
220 return [UNIVERSE systemDataForGalaxy:_galaxy planet:_system key:key];
221}

Referenced by SystemInfoGetProperty(), and SystemInfoSamplePrice().

+ Here is the caller graph for this function:

Member Data Documentation

◆ _galaxy

- (OOGalaxyID) _galaxy
private

Definition at line 120 of file OOJSSystemInfo.m.

◆ _planetKey

- (NSString*) _planetKey
private

Definition at line 122 of file OOJSSystemInfo.m.

◆ _system

- (OOSystemID) _system
private

Definition at line 121 of file OOJSSystemInfo.m.


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