Oolite
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 "OOFoundation.h"
28#import "OOTypes.h"
29#import "legacy_random.h"
30
37
44
45#define OO_SYSTEM_LAYERS 4
46#define OO_SYSTEMS_PER_GALAXY (kOOMaximumSystemID + 1)
47#define OO_GALAXIES_AVAILABLE (kOOMaximumGalaxyID + 1)
48#define OO_SYSTEMS_AVAILABLE OO_SYSTEMS_PER_GALAXY* OO_GALAXIES_AVAILABLE
49// don't bother caching interstellar properties
50#define OO_SYSTEM_CACHE_LENGTH OO_SYSTEMS_AVAILABLE
51
52@interface OOSystemDescriptionEntry : NSObject {
53@private
54 NSMutableDictionary* layers[OO_SYSTEM_LAYERS];
55}
56
57- (void)setProperty:(NSString*)property forLayer:(OOSystemLayer)layer toValue:(id)value;
58- (id)getProperty:(NSString*)property forLayer:(OOSystemLayer)layer;
59
60@end
61
68@interface OOSystemDescriptionManager : NSObject {
69@private
70 NSMutableDictionary* universalProperties;
72 NSMutableDictionary* systemDescriptions;
73 NSMutableDictionary* propertyCache[OO_SYSTEM_CACHE_LENGTH];
74 NSMutableSet* propertiesInUse;
75 NSPoint coordinatesCache[OO_SYSTEM_CACHE_LENGTH];
76 NSMutableArray* neighbourCache[OO_SYSTEM_CACHE_LENGTH];
77 NSMutableDictionary* scriptedChanges;
78}
79
80// this needs to be re-called every time system coordinates change
81// changing system coordinates after plist loading is probably
82// too much of a can of worms *anyway*, so currently it's only
83// called just after the manager data is loaded.
84- (void)buildRouteCache;
85
86- (void)setUniversalProperties:(NSDictionary*)properties;
87- (void)setInterstellarProperties:(NSDictionary*)properties;
88
89// this is used by planetinfo.plist and has default layer 1
90- (void)setProperties:(NSDictionary*)properties forSystemKey:(NSString*)key;
91
92// this is used by Javascript property setting
93- (void)setProperty:(NSString*)property forSystemKey:(NSString*)key andLayer:(OOSystemLayer)layer toValue:(id)value fromManifest:(NSString*)manifest;
94
95- (void)importScriptedChanges:(NSDictionary*)scripted;
96- (void)importLegacyScriptedChanges:(NSDictionary*)scripted;
97- (NSDictionary*)exportScriptedChanges;
98
99- (NSDictionary*)getPropertiesForSystemKey:(NSString*)key;
100- (NSDictionary*)getPropertiesForSystem:(OOSystemID)s inGalaxy:(OOGalaxyID)g;
101- (NSDictionary*)getPropertiesForCurrentSystem;
102- (id)getProperty:(NSString*)property forSystemKey:(NSString*)key;
103- (id)getProperty:(NSString*)property forSystem:(OOSystemID)s inGalaxy:(OOGalaxyID)g;
104
105- (NSPoint)getCoordinatesForSystem:(OOSystemID)s inGalaxy:(OOGalaxyID)g;
106- (NSArray*)getNeighbourIDsForSystem:(OOSystemID)s inGalaxy:(OOGalaxyID)g;
107
108- (Random_Seed)getRandomSeedForCurrentSystem;
109- (Random_Seed)getRandomSeedForSystem:(OOSystemID)s inGalaxy:(OOGalaxyID)g;
110
111@end
@ OO_SYSTEMCONCEALMENT_NODATA
@ OO_SYSTEMCONCEALMENT_NONE
@ OO_SYSTEMCONCEALMENT_NOTHING
@ OO_SYSTEMCONCEALMENT_NONAME
int16_t OOSystemID
Definition OOTypes.h:183
uint8_t OOGalaxyID
Definition OOTypes.h:182
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]