Oolite 1.91.0.7646-241128-10e222e
Loading...
Searching...
No Matches
OOSystemDescriptionManager.h
Go to the documentation of this file.
1/*
2
3OOSystemDescriptionManager.h
4
5Class responsible for planet description data.
6
7Oolite
8Copyright (C) 2004-2013 Giles C Williams and contributors
9
10This program is free software; you can redistribute it and/or
11modify it under the terms of the GNU General Public License
12as published by the Free Software Foundation; either version 2
13of the License, or (at your option) any later version.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23MA 02110-1301, USA.
24
25*/
26
27#import "OOCocoa.h"
28#import "OOTypes.h"
29#import "legacy_random.h"
30
38
39
47
48
49#define OO_SYSTEM_LAYERS 4
50#define OO_SYSTEMS_PER_GALAXY (kOOMaximumSystemID+1)
51#define OO_GALAXIES_AVAILABLE (kOOMaximumGalaxyID+1)
52#define OO_SYSTEMS_AVAILABLE OO_SYSTEMS_PER_GALAXY * OO_GALAXIES_AVAILABLE
53// don't bother caching interstellar properties
54#define OO_SYSTEM_CACHE_LENGTH OO_SYSTEMS_AVAILABLE
55
56@interface OOSystemDescriptionEntry : NSObject
57{
58@private
59 NSMutableDictionary *layers[OO_SYSTEM_LAYERS];
60}
61
62- (void) setProperty:(NSString *)property forLayer:(OOSystemLayer)layer toValue:(id)value;
63- (id) getProperty:(NSString *)property forLayer:(OOSystemLayer)layer;
64
65@end
66
73@interface OOSystemDescriptionManager : NSObject
74{
75@private
76 NSMutableDictionary *universalProperties;
78 NSMutableDictionary *systemDescriptions;
79 NSMutableDictionary *propertyCache[OO_SYSTEM_CACHE_LENGTH];
80 NSMutableSet *propertiesInUse;
81 NSPoint coordinatesCache[OO_SYSTEM_CACHE_LENGTH];
82 NSMutableArray *neighbourCache[OO_SYSTEM_CACHE_LENGTH];
83 NSMutableDictionary *scriptedChanges;
84}
85
86// this needs to be re-called every time system coordinates change
87// changing system coordinates after plist loading is probably
88// too much of a can of worms *anyway*, so currently it's only
89// called just after the manager data is loaded.
90- (void) buildRouteCache;
91
92- (void) setUniversalProperties:(NSDictionary *)properties;
93- (void) setInterstellarProperties:(NSDictionary *)properties;
94
95// this is used by planetinfo.plist and has default layer 1
96- (void) setProperties:(NSDictionary *)properties forSystemKey:(NSString *)key;
97
98// this is used by Javascript property setting
99- (void) setProperty:(NSString *)property forSystemKey:(NSString *)key andLayer:(OOSystemLayer)layer toValue:(id)value fromManifest:(NSString *)manifest;
100
101- (void) importScriptedChanges:(NSDictionary *)scripted;
102- (void) importLegacyScriptedChanges:(NSDictionary *)scripted;
103- (NSDictionary *) exportScriptedChanges;
104
105- (NSDictionary *) getPropertiesForSystemKey:(NSString *)key;
106- (NSDictionary *) getPropertiesForSystem:(OOSystemID)s inGalaxy:(OOGalaxyID)g;
107- (NSDictionary *) getPropertiesForCurrentSystem;
108- (id) getProperty:(NSString *)property forSystemKey:(NSString *)key;
109- (id) getProperty:(NSString *)property forSystem:(OOSystemID)s inGalaxy:(OOGalaxyID)g;
110
111- (NSPoint) getCoordinatesForSystem:(OOSystemID)s inGalaxy:(OOGalaxyID)g;
112- (NSArray *) getNeighbourIDsForSystem:(OOSystemID)s inGalaxy:(OOGalaxyID)g;
113
114- (Random_Seed) getRandomSeedForCurrentSystem;
115- (Random_Seed) getRandomSeedForSystem:(OOSystemID)s inGalaxy:(OOGalaxyID)g;
116
117@end
118
119
@ OO_SYSTEMCONCEALMENT_NODATA
@ OO_SYSTEMCONCEALMENT_NONE
@ OO_SYSTEMCONCEALMENT_NOTHING
@ OO_SYSTEMCONCEALMENT_NONAME
int16_t OOSystemID
Definition OOTypes.h:211
uint8_t OOGalaxyID
Definition OOTypes.h:210
NSMutableDictionary * layers[OO_SYSTEM_LAYERS]
NSMutableDictionary * propertyCache[OO_SYSTEM_CACHE_LENGTH]
NSMutableArray * neighbourCache[OO_SYSTEM_CACHE_LENGTH]
NSMutableDictionary * universalProperties
OOSystemDescriptionEntry * interstellarSpace
NSPoint coordinatesCache[OO_SYSTEM_CACHE_LENGTH]