Oolite
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) - initWithGalaxy:system:
(id) - valueForKey:
(void) - setValue:forKey:
(NSArray *) - allKeys
(void) - setNullAssigned:forKey:
(BOOL) - isNullAssignedForKey:
(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]

Class Methods

(void) + oo_javaScriptEngineWillReset: [implementation]

Private Attributes

OOGalaxyID _galaxy
OOSystemID _system
NSString * _planetKey
NSMutableSet * _nullAssignedKeys

Detailed Description

Definition at line 104 of file OOJSSystemInfo.m.

Method Documentation

◆ allKeys [1/2]

- (NSArray *) allKeys

Definition at line 255 of file OOJSSystemInfo.m.

256{
257 if ([UNIVERSE inInterstellarSpace] && _system == -1) {
258 return [[UNIVERSE currentSystemData] allKeys];
259 }
260 return [UNIVERSE systemDataKeysForGalaxy:_galaxy planet:_system];
261}
#define UNIVERSE
Definition Universe.h:827
OOSystemID _system

References _system, allKeys, and UNIVERSE.

Referenced by allKeys, SystemInfoEnumerate(), and SystemInfoExoticGetOwnPropertyNames().

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

◆ allKeys [2/2]

- (NSArray *) allKeys

References allKeys.

Here is the call graph for this function:

◆ coordinates

- (NSPoint) coordinates
implementation

Definition at line 223 of file OOJSSystemInfo.m.

224{
225 if ([UNIVERSE inInterstellarSpace] && _system == -1) {
226 return [PLAYER galaxy_coordinates];
227 }
228 return [UNIVERSE coordinatesForSystem:_system];
229}

References _system, coordinates, and UNIVERSE.

Referenced by coordinates, SystemInfoDistanceToSystem(), SystemInfoDistanceToSystem(), SystemInfoGetProperty(), and SystemInfoGetProperty().

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

◆ dealloc

- (void) dealloc
implementation

Definition at line 149 of file OOJSSystemInfo.m.

150{
151 [_planetKey release];
152
153 [super dealloc];
154}

References dealloc.

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 156 of file OOJSSystemInfo.m.

157{
158 return [NSString stringWithFormat:@"galaxy %u, system %i", _galaxy, _system];
159}

References descriptionComponents.

Referenced by descriptionComponents.

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

◆ galaxy [1/2]

- (OOGalaxyID) galaxy

Definition at line 263 of file OOJSSystemInfo.m.

264{
265 return _galaxy;
266}
OOGalaxyID _galaxy

References _galaxy, and galaxy.

Referenced by galaxy, GetJSSystemInfoForSystem(), initWithGalaxy:system:, SystemInfoDistanceToSystem(), SystemInfoDistanceToSystem(), SystemInfoGetProperty(), SystemInfoGetProperty(), SystemInfoGetSystemDataValue(), SystemInfoRouteToSystem(), SystemInfoRouteToSystem(), SystemInfoSamplePrice(), SystemInfoSamplePrice(), SystemInfoSetPropertyMethod(), SystemInfoSetPropertyMethod(), SystemInfoStaticFilteredSystems(), and SystemInfoStaticFilteredSystems().

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

◆ galaxy [2/2]

- (OOGalaxyID) galaxy

References galaxy.

Here is the call graph for this function:

◆ hash

- (NSUInteger) hash
implementation

Definition at line 176 of file OOJSSystemInfo.m.

177{
178 NSUInteger hash = _galaxy;
179 hash <<= 16;
180 hash |= (uint16_t)_system;
181 return hash;
182}
NSUInteger hash()

References _galaxy, _system, and hash.

Referenced by hash.

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

◆ init

- (id) init
implementation

Definition at line 128 of file OOJSSystemInfo.m.

129{
130 [self release];
131 return nil;
132}
return nil

References init, and nil.

Referenced by init, initWithGalaxy:system:, and system.

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

◆ initWithGalaxy:system: [1/2]

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

Definition at line 173 of file OOJSSystemInfo.m.

174{
176 [self release];
177 return nil;
178 }
179
180 if ((self = [super init])) {
181 _galaxy = galaxy;
182 _system = system;
183 _planetKey = [[NSString stringWithFormat:@"%u %i", galaxy, system] retain];
184 }
185 return self;
186}
@ kOOMaximumSystemID
Definition OOTypes.h:187
@ kOOMaximumGalaxyID
Definition OOTypes.h:186
@ kOOMinimumSystemID
Definition OOTypes.h:188
int16_t OOSystemID
Definition OOTypes.h:183
uint8_t OOGalaxyID
Definition OOTypes.h:182
NSString * _planetKey
OOSystemID system()
OOGalaxyID galaxy()

References _galaxy, _planetKey, _system, galaxy, init, kOOMaximumGalaxyID, kOOMaximumSystemID, kOOMinimumSystemID, nil, and system.

Here is the call graph for this function:

◆ initWithGalaxy:system: [2/2]

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

◆ isEqual:

- (BOOL) isEqual: (id) other
implementation

Definition at line 171 of file OOJSSystemInfo.m.

171 :(id)other
172{
173 return other == self || ([other isKindOfClass:[OOSystemInfo class]] && [other galaxy] == _galaxy && [other system] == _system);
174}

References _galaxy, and _system.

◆ isNullAssignedForKey:

- (BOOL) isNullAssignedForKey: (NSString*) key

Definition at line 207 of file OOJSSystemInfo.m.

207 :(NSString*)key
208{
209 return [_nullAssignedKeys containsObject:key];
210}

◆ oo_javaScriptEngineWillReset:

+ (void) oo_javaScriptEngineWillReset: (NSNotification*) notification
implementation

Definition at line 299 of file OOJSSystemInfo.m.

299 :(NSNotification*)notification
300{
301 JSValue oldCache = sCachedSystemInfo;
302 sCachedSystemInfo = JS_UNDEFINED;
303 if (JS_IsObject(oldCache))
304 JS_FreeValue(OOJSAcquireContext(), oldCache);
305}
OOINLINE JSContext * OOJSAcquireContext(void)
static JSValue sCachedSystemInfo

References OOJSAcquireContext(), and sCachedSystemInfo.

Here is the call graph for this function:

◆ oo_jsClassName

- (NSString *) oo_jsClassName
implementation

Definition at line 166 of file OOJSSystemInfo.m.

167{
168 return @"SystemInfo";
169}

References oo_jsClassName.

Referenced by oo_jsClassName.

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

◆ oo_jsValueInContext:

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

Definition at line 231 of file OOJSSystemInfo.m.

231 :(JSContext*)context
232{
233 JSObject* jsSelf = NULL;
234 jsval result = JSVAL_NULL;
235
236 jsSelf = JS_NewObject(context, &sSystemInfoClass, sSystemInfoPrototype, NULL);
237 if (jsSelf != NULL) {
238 if (!JS_SetPrivate(context, jsSelf, [self retain]))
239 jsSelf = NULL;
240 }
241 if (jsSelf != NULL)
242 result = OBJECT_TO_JSVAL(jsSelf);
243
244 return result;
245}
static JSObject * sSystemInfoPrototype
static JSClassDef sSystemInfoClass

References sSystemInfoClass, and sSystemInfoPrototype.

◆ setNullAssigned:forKey:

- (void) setNullAssigned: (BOOL) flag
forKey: (NSString*) key 

Definition at line 196 of file OOJSSystemInfo.m.

196 :(BOOL)flag forKey:(NSString*)key
197{
198 if (flag) {
199 if (_nullAssignedKeys == nil)
200 _nullAssignedKeys = [[NSMutableSet alloc] init];
201 [_nullAssignedKeys addObject:key];
202 } else {
203 [_nullAssignedKeys removeObject:key];
204 }
205}
NSMutableSet * _nullAssignedKeys

References _nullAssignedKeys, and nil.

Referenced by SystemInfoExoticSetProperty().

Here is the caller graph for this function:

◆ setValue:forKey: [1/2]

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

Definition at line 248 of file OOJSSystemInfo.m.

248 :(id)value forKey:(NSString*)key
249{
250 NSString* manifest = [[OOJSScript currentlyRunningScript] propertyNamed:kLocalManifestProperty];
251
252 [UNIVERSE setSystemDataForGalaxy:_galaxy planet:_system key:key value:value fromManifest:manifest forLayer:OO_LAYER_OXP_DYNAMIC];
253}
id propertyNamed:(NSString *name)
Definition OOJSScript.m:431
OOJSScript * currentlyRunningScript()
Definition OOJSScript.m:101

References OOJSScript::currentlyRunningScript, and OOJSScript::propertyNamed:.

Referenced by SystemInfoExoticSetProperty(), and SystemInfoSetProperty().

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

◆ setValue:forKey: [2/2]

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

◆ shortDescriptionComponents

- (NSString *) shortDescriptionComponents
implementation

Definition at line 161 of file OOJSSystemInfo.m.

162{
163 return _planetKey;
164}

References _planetKey, and shortDescriptionComponents.

Referenced by shortDescriptionComponents.

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

◆ system [1/2]

- (OOSystemID) system

Definition at line 268 of file OOJSSystemInfo.m.

269{
270 return _system;
271}

References _system, and system.

Referenced by GetJSSystemInfoForSystem(), initWithGalaxy:system:, system, SystemInfoGetProperty(), SystemInfoGetProperty(), SystemInfoGetSystemDataValue(), SystemInfoRouteToSystem(), SystemInfoRouteToSystem(), SystemInfoSamplePrice(), SystemInfoSamplePrice(), SystemInfoSetPropertyMethod(), SystemInfoSetPropertyMethod(), SystemInfoStaticFilteredSystems(), and SystemInfoStaticFilteredSystems().

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

◆ system [2/2]

- (OOSystemID) system

References init, nil, sSystemInfoClassID, and system.

Here is the call graph for this function:

◆ valueForKey: [1/2]

- (id) valueForKey: (NSString*) key

Definition at line 240 of file OOJSSystemInfo.m.

240 :(NSString*)key
241{
242 if ([UNIVERSE inInterstellarSpace] && _system == -1) {
243 return [[UNIVERSE currentSystemData] objectForKey:key];
244 }
245 return [UNIVERSE systemDataForGalaxy:_galaxy planet:_system key:key];
246}

References _system, and UNIVERSE.

Referenced by SystemInfoGetProperty(), SystemInfoGetSystemDataValue(), SystemInfoSamplePrice(), and SystemInfoSamplePrice().

Here is the caller graph for this function:

◆ valueForKey: [2/2]

- (id) valueForKey: (NSString *) key

Member Data Documentation

◆ _galaxy

- (OOGalaxyID) _galaxy
private

Definition at line 106 of file OOJSSystemInfo.m.

Referenced by galaxy, hash, initWithGalaxy:system:, and isEqual:.

◆ _nullAssignedKeys

- (NSMutableSet*) _nullAssignedKeys
private

Definition at line 144 of file OOJSSystemInfo.m.

Referenced by setNullAssigned:forKey:.

◆ _planetKey

- (NSString *) _planetKey
private

Definition at line 108 of file OOJSSystemInfo.m.

Referenced by initWithGalaxy:system:, and shortDescriptionComponents.

◆ _system

- (OOSystemID) _system
private

Definition at line 107 of file OOJSSystemInfo.m.

Referenced by allKeys, coordinates, hash, initWithGalaxy:system:, isEqual:, system, and valueForKey:.


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