EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
EVE_Planet.h
Go to the documentation of this file.
1 
2 /* EVE_Planet.h
3  * enumerators and other defines for PI system
4  *
5  * Base PI system code by Comet0
6  * Updates and rewrites by Allan
7  */
8 
9 
10 #ifndef EVE_PLANET_H
11 #define EVE_PLANET_H
12 #include <map>
13 
14 #include "eve-common.h"
15 
16 namespace PI {
17  namespace Command {
18  enum {
19  Invalid = 0,
20  CreatePin = 1,
21  RemovePin = 2,
34  };
35  }
36 
37  namespace Pin {
38  namespace State {
39  enum {
40  Edit = -2,
41  Disabled = -1,
42  Idle = 0,
43  Active = 1
44  };
45  }
46 
47  enum {
48  Level0 = 0,
49  Level1 = 1,
50  Level2 = 2,
51  Level3 = 3,
52  Level4 = 4,
53  Level5 = 5,
54  // the following are only used by Planetary_Links
55  Level6 = 6,
56  Level7 = 7,
57  Level8 = 8,
58  Level9 = 9,
59  Level10 = 10
60  };
61  }
62 
63  namespace Route {
64  enum {
68  };
69  }
70 
71  //piLaunchOrbitDecayTime = DAY * 5
72  namespace Cargo {
73  enum {
74  InOrbit = 0,
75  Deployed = 1,
76  Claimed = 2,
77  Deleted = 3
78  };
79  }
80 
81 }
82 
83 namespace Launch {
84  struct Data {
91  double x;
92  double y;
93  double z;
94  };
95 }
96 
98 /* POD structure entries for PI data */
105  float dist_1;
106  float dist_2;
107  float dist_3;
108  float dist_4;
109  float dist_5;
110  std::string buffer_1;
111  std::string buffer_2;
112  std::string buffer_3;
113  std::string buffer_4;
114  std::string buffer_5;
115 };
116 
117 struct PI_Link {
123 };
124 
125 struct PI_Route {
132  std::list<uint32> path;
133 };
134 
135 struct PI_Heads {
138  double latitude;
139  double longitude;
140 };
141 
142 struct PI_Schematic {
145  uint16 cycleTime; // in seconds
146 
147  // typeID, qty
148  std::map<uint16, uint16> inputs;
149 };
150 
151 struct PI_Plant {
152  // specifically for processing plants. this is not saved in db as a group, but is in pinData
153  bool hasReceivedInputs :1; // plant has received material from upstream process. this enables check to verify type/qty for processing
154  bool receivedInputsLastCycle :1; // plant has received all required mat'l to make a production run.
155 
157  uint8 pLevel; // production level of this plant
160  int64 cycleTime; // in filetime
161  //int64 expiryTime; // in filetime
162  int64 installTime; // in filetime
163  int64 lastRunTime; // in filetime
164 
166 };
167 
168 struct PI_Pin {
169  bool update :1; // specifically for updating contents in db. this is a runtime value.
170 
171  bool isECU :1; // common for all pins
172  bool isBase :1; // common for all pins
173  bool isStorage :1; // common for all pins
174  bool isProcess :1; // common for all pins
175  bool isConsumer :1; // common for all pins
176  bool isLaunchable :1; // common for all pins
177  bool isCommandCenter :1; // common for all pins
178 
179  // these two are checked in client for the pin.CanActivate() method. it will return true if either are true. that is the only reference i can find.
180  bool hasReceivedInputs :1; // Process Only
181  bool receivedInputsLastCycle :1; // Process Only
182 
183  int8 state; // common for all pins
184  uint16 level; // common for all pins
185  uint16 typeID; // common for all pins
186  uint16 schematicID; // used in ecu as extractor head typeID
187  uint16 programType; // used in extractors as extracted resource typeID
188  uint32 qtyPerCycle; // Process and ECU
189  uint32 ownerID; // common for all pins
190  int64 lastRunTime; // common for all pins - copy of launchTime for Spaceports
191  int64 cycleTime; // Process and ECU // saved as filetime
192  int64 expiryTime; // ECU Only // saved as filetime
193  int64 installTime; // Process and ECU processing time, Pin Creation Time for others // saved as filetime
194  int64 lastLaunchTime; // Command Center and Spaceports // saved as filetime
195 
196  float latitude; // planetary location common for all pins
197  float longitude; // planetary location common for all pins
198 
199  float capacity; // pin volume cap in m3. - this is not implemented yet
200  float quantity; // volume of current contents in m3. - this is not implemented yet
201  float headRadius; // ECU Only
202 
203  std::map<uint16, PI_Heads> heads; // ECU Only
204  std::map<uint16, uint32> contents; // Storage <typeID, qty>
205 };
206 
207 
208 class PI_CCPin {
209 public:
210 
211  PI_CCPin() { Init(); }
212  ~PI_CCPin() { /* do nothing here */ }
213 
214  void Clear()
215  {
216  pins.clear();
217  links.clear();
218  plants.clear();
219  routes.clear();
220  }
221  void Init()
222  {
223  Clear();
224  level = 0;
225  ccPinID = 0;
226  }
227 
228  uint8 GetLevel() { return level; }
229  uint32 GetPinID() { return ccPinID; }
230 
233 
234  // pinID, pinData
235  std::map<uint32, PI_Pin> pins;
236  // linkID, linkData
237  std::map<uint32, PI_Link> links;
238  // routeID, routeData
239  std::map<uint16, PI_Route> routes;
240  // plantPinID, plantData - this dynamic data is not saved
241  std::map<uint32, PI_Plant> plants;
242 };
243 
244 /* these are internal client state events
245 enum PlanetEvents {
246  EVENT_NORMAL = 0,
247  EVENT_BUILDPIN = 1,
248  EVENT_CREATELINKSTART = 2,
249  EVENT_CREATELINKEND = 3,
250  EVENT_CREATEROUTE = 4,
251  EVENT_SURVEY = 5,
252  SUBEVENT_NORMAL = 6,
253  SUBEVENT_MOVEEXTRACTIONHEAD = 7
254 }; */
255 
256  /*
257  Extractors = 1026,
258  Command_Centers = 1027,
259  Processors = 1028,
260  Storage_Facilities = 1029,
261  Spaceports = 1030,
262  Planetary_Resources = 1031,
263  Planet_Solid = 1032,
264  Planet_Liquid_Gas = 1033,
265  Refined_Commodities = 1034,
266  Planet_Organic = 1035,
267  Planetary_Links = 1036,
268  Specialized_Commodities = 1040,
269  Advanced_Commodities = 1041,
270  Basic_Commodities = 1042,
271  */
272 /*
273  COMMAND_CREATEPIN: 'CreatePin',
274  COMMAND_REMOVEPIN: 'RemovePin',
275  COMMAND_CREATELINK: 'CreateLink',
276  COMMAND_REMOVELINK: 'RemoveLink',
277  COMMAND_SETLINKLEVEL: 'SetLinkLevel',
278  COMMAND_CREATEROUTE: 'CreateRoute',
279  COMMAND_REMOVEROUTE: 'RemoveRoute',
280  COMMAND_SETSCHEMATIC: 'SetSchematic',
281  COMMAND_UPGRADECOMMANDCENTER: 'UpgradeCommandCenter',
282  COMMAND_ADDEXTRACTORHEAD: 'AddExtractorHead',
283  COMMAND_KILLEXTRACTORHEAD: 'KillExtractorHead',
284  COMMAND_MOVEEXTRACTORHEAD: 'MoveExtractorHead',
285  COMMAND_INSTALLPROGRAM: 'InstallProgram'}
286 */
287 /*
288  __identifiers__ = {COMMAND_CREATEPIN: ['pinID'],
289  COMMAND_REMOVEPIN: ['pinID'],
290  COMMAND_CREATELINK: ['endpoint1', 'endpoint2'],
291  COMMAND_REMOVELINK: ['endpoint1', 'endpoint2'],
292  COMMAND_SETLINKLEVEL: ['endpoint1', 'endpoint2', 'level'],
293  COMMAND_CREATEROUTE: ['routeID'],
294  COMMAND_REMOVEROUTE: ['routeID'],
295  COMMAND_SETSCHEMATIC: ['pinID'],
296  COMMAND_UPGRADECOMMANDCENTER: ['pinID', 'level'],
297  COMMAND_ADDEXTRACTORHEAD: ['pinID', 'headID'],
298  COMMAND_KILLEXTRACTORHEAD: ['pinID', 'headID'],
299  COMMAND_MOVEEXTRACTORHEAD: ['pinID', 'headID'],
300  COMMAND_INSTALLPROGRAM: ['pinID']}
301 
302  __arguments__ = {COMMAND_CREATEPIN: ['typeID', 'latitude', 'longitude'],
303  COMMAND_REMOVEPIN: [],
304  COMMAND_CREATELINK: ['level'],
305  COMMAND_REMOVELINK: [],
306  COMMAND_SETLINKLEVEL: [],
307  COMMAND_CREATEROUTE: ['path', 'typeID', 'quantity'],
308  COMMAND_REMOVEROUTE: [],
309  COMMAND_SETSCHEMATIC: ['schematicID'],
310  COMMAND_UPGRADECOMMANDCENTER: [],
311  COMMAND_ADDEXTRACTORHEAD: ['latitude', 'longitude'],
312  COMMAND_KILLEXTRACTORHEAD: [],
313  COMMAND_MOVEEXTRACTORHEAD: ['latitude', 'longitude'],
314  COMMAND_INSTALLPROGRAM: ['typeID', 'headRadius']}
315 */
316 /*
317  info.proximity = const.planetResourceProximityPlanet
318  for i, scanRange in enumerate(const.planetResourceScanningRanges):
319  if scanRange >= dist:
320  info.proximity = i
321  minBand, maxBand = const.planetResourceProximityLimits[info.proximity]
322  info.newBand = min(maxBand, minBand + info.planetology + info.advancedPlanetology * 2)
323  requiredSkill = 5 - info.proximity
324 
325  * planetResourceScanDistance = 1000000000
326  * planetResourceProximityDistant = 0
327  * planetResourceProximityRegion = 1
328  * planetResourceProximityConstellation = 2
329  * planetResourceProximitySystem = 3
330  * planetResourceProximityPlanet = 4
331  * planetResourceProximityLimits = [(2, 6),
332  * (4, 10),
333  * (6, 15),
334  * (10, 20),
335  * (15, 30)]
336  * planetResourceScanningRanges = [9.0,
337  * 7.0,
338  * 5.0,
339  * 3.0,
340  * 1.0]
341  * planetResourceUpdateTime = 1 * HOUR
342  * planetResourceMaxValue = 1.21
343  */
344 
345 #endif // EVE_PLANET_H
double z
Definition: EVE_Planet.h:93
float longitude
Definition: EVE_Planet.h:197
bool isBase
Definition: EVE_Planet.h:172
std::map< uint32, PI_Pin > pins
Definition: EVE_Planet.h:235
std::map< uint16, PI_Route > routes
Definition: EVE_Planet.h:239
uint16 outputQty
Definition: EVE_Planet.h:143
std::list< uint32 > path
Definition: EVE_Planet.h:132
unsigned __int8 uint8
Definition: eve-compat.h:46
int8 priority
Definition: EVE_Planet.h:127
std::map< uint16, uint32 > contents
Definition: EVE_Planet.h:204
bool isConsumer
Definition: EVE_Planet.h:175
bool isLaunchable
Definition: EVE_Planet.h:176
uint16 commodityQuantity
Definition: EVE_Planet.h:129
uint16 programType
Definition: EVE_Planet.h:187
bool isCommandCenter
Definition: EVE_Planet.h:177
uint32 itemID
Definition: EVE_Planet.h:87
std::string buffer_2
Definition: EVE_Planet.h:111
uint8 level
Definition: EVE_Planet.h:231
int64 launchTime
Definition: EVE_Planet.h:90
uint8 status
Definition: EVE_Planet.h:85
uint32 solarSystemID
Definition: EVE_Planet.h:88
uint32 ownerID
Definition: EVE_Planet.h:189
double x
Definition: EVE_Planet.h:91
float quantity
Definition: EVE_Planet.h:200
uint32 qtyPerCycle
Definition: EVE_Planet.h:188
uint16 level
Definition: EVE_Planet.h:184
uint16 outputType
Definition: EVE_Planet.h:144
int64 installTime
Definition: EVE_Planet.h:162
int64 lastRunTime
Definition: EVE_Planet.h:163
int64 cycleTime
Definition: EVE_Planet.h:160
uint16 typeID
Definition: EVE_Planet.h:136
std::map< uint16, PI_Heads > heads
Definition: EVE_Planet.h:203
signed __int8 int8
Definition: eve-compat.h:45
std::map< uint32, PI_Plant > plants
Definition: EVE_Planet.h:241
std::map< uint16, uint16 > inputs
Definition: EVE_Planet.h:148
uint16 commodityTypeID
Definition: EVE_Planet.h:128
uint32 srcPinID
Definition: EVE_Planet.h:130
uint32 ecuPinID
Definition: EVE_Planet.h:137
void Clear()
Definition: EVE_Planet.h:214
int8 state
Definition: EVE_Planet.h:126
uint32 planetID
Definition: EVE_Planet.h:89
uint32 launchID
Definition: EVE_Planet.h:86
int64 lastRunTime
Definition: EVE_Planet.h:190
bool isECU
Definition: EVE_Planet.h:171
float latitude
Definition: EVE_Planet.h:196
uint8 GetLevel()
Definition: EVE_Planet.h:228
bool isStorage
Definition: EVE_Planet.h:173
uint16 typeID
Definition: EVE_Planet.h:185
bool hasReceivedInputs
Definition: EVE_Planet.h:180
float headRadius
Definition: EVE_Planet.h:201
int64 lastLaunchTime
Definition: EVE_Planet.h:194
uint16 qtyPerCycle
Definition: EVE_Planet.h:159
bool isProcess
Definition: EVE_Planet.h:174
double latitude
Definition: EVE_Planet.h:138
double longitude
Definition: EVE_Planet.h:139
uint32 ccPinID
Definition: EVE_Planet.h:232
std::map< uint32, PI_Link > links
Definition: EVE_Planet.h:237
unsigned __int32 uint32
Definition: eve-compat.h:50
int8 state
Definition: EVE_Planet.h:156
double y
Definition: EVE_Planet.h:92
uint8 pLevel
Definition: EVE_Planet.h:157
bool receivedInputsLastCycle
Definition: EVE_Planet.h:181
std::string buffer_3
Definition: EVE_Planet.h:112
int64 installTime
Definition: EVE_Planet.h:193
Definition: EVE_Planet.h:16
signed __int64 int64
Definition: eve-compat.h:51
void Init()
Definition: EVE_Planet.h:221
int64 cycleTime
Definition: EVE_Planet.h:191
float capacity
Definition: EVE_Planet.h:199
std::string buffer_5
Definition: EVE_Planet.h:114
std::string buffer_4
Definition: EVE_Planet.h:113
uint16 cycleTime
Definition: EVE_Planet.h:145
bool update
Definition: EVE_Planet.h:169
bool receivedInputsLastCycle
Definition: EVE_Planet.h:154
int8 state
Definition: EVE_Planet.h:183
uint32 GetPinID()
Definition: EVE_Planet.h:229
std::string buffer_1
Definition: EVE_Planet.h:110
uint8 schematicID
Definition: EVE_Planet.h:158
bool hasReceivedInputs
Definition: EVE_Planet.h:153
PI_Schematic data
Definition: EVE_Planet.h:165
uint32 destPinID
Definition: EVE_Planet.h:131
unsigned __int16 uint16
Definition: eve-compat.h:48
uint16 schematicID
Definition: EVE_Planet.h:186
int64 expiryTime
Definition: EVE_Planet.h:192