EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SystemGPoint.cpp
Go to the documentation of this file.
1 
10 //work in progress
14 #include "eve-server.h"
15 
16 #include "system/SystemGPoint.h"
17 #include "system/SystemManager.h"
18 
43 
46 /* copied from system/SystemDB.cpp
47  * namespace SystemDB:
48  * class DBGPointEntity {
49  * public:
50  * uint8 idx;
51  * uint32 itemID;
52  * GPoint position;
53  * double radius;
54  * double x;
55  * double y;
56  * double z;
57  * };
58  *
59 */
60 
62  uint8 total = 0;
63  std::vector<DBGPointEntity> planetIDs;
64  planetIDs.clear();
65  m_db.GetPlanets(systemID, planetIDs, total);
66 }
67 
69  uint8 total = 0;
70  std::vector<DBGPointEntity> moonIDs;
71  moonIDs.clear();
72  m_db.GetMoons(systemID, moonIDs, total);
73 }
74 
76  uint8 total = 0;
77  std::vector<DBGPointEntity> planetIDs;
78  planetIDs.clear();
79  m_db.GetPlanets(systemID, planetIDs, total);
80 
81  if (planetIDs.empty())
82  return NULL_ORIGIN;
83 
84  uint16 i = MakeRandomInt(1, total);
85  return (planetIDs[i].position + planetIDs[i].radius + 50000);
86 }
87 
89  uint8 total = 0;
90  std::vector<DBGPointEntity> moonIDs;
91  moonIDs.clear();
92  m_db.GetMoons(systemID, moonIDs, total);
93 
94  if (moonIDs.empty())
95  return NULL_ORIGIN;
96 
97  uint16 i = MakeRandomInt(1, total);
98  return (moonIDs[i].position + moonIDs[i].radius + 10000);
99 }
100 
102  uint8 total = 0;
103  std::vector<DBGPointEntity> planetIDs;
104  planetIDs.clear();
105  m_db.GetPlanets(systemID, planetIDs, total);
106 
107  if (planetIDs.empty())
108  return 0;
109 
110  uint16 i = MakeRandomInt(1, total);
111  return planetIDs[i].itemID;
112 }
113 
115  uint8 total = 0;
116  std::vector<DBGPointEntity> planetIDs;
117  planetIDs.clear();
118  m_db.GetPlanets(systemID, planetIDs, total);
120  return NULL_ORIGIN;
121 }
122 
124  uint8 total = 0;
125  std::vector<DBGPointEntity> planetIDs;
126  planetIDs.clear();
127  m_db.GetPlanets(systemID, planetIDs, total);
130  return NULL_ORIGIN;
131 }
132 
134  uint8 total = 0;
135  std::vector<DBGPointEntity> moonIDs;
136  moonIDs.clear();
137  m_db.GetMoons(systemID, moonIDs, total);
138 
139  if (moonIDs.empty())
140  return 0;
141 
142  uint16 i = MakeRandomInt(1, total);
143  return moonIDs[i].itemID;
144 }
145 
147  // get system max diameter, verify distance is within system.
148 
149  return NULL_ORIGIN;
150 }
151 
153 {
154  uint8 total = 0;
155  std::vector<DBGPointEntity> planetIDs;
156  planetIDs.clear();
157  m_db.GetPlanets(pSys->GetID(), planetIDs, total);
158 
159  SystemEntity* pSE(pSys->GetSE(planetIDs[MakeRandomInt(0, total)].itemID));
160 
161  GPoint pos(pSE->GetPosition());
163  return pos;
164 }
165 
unsigned __int8 uint8
Definition: eve-compat.h:46
const GPoint Get3RandPlanets(uint32 systemID)
SystemEntity * GetSE(uint32 entityID) const
const GPoint GetRandPointOnMoon(uint32 systemID)
uint32 GetRandMoon(uint32 systemID)
uint32 GetRandPlanet(uint32 systemID)
void GetMoons(uint32 systemID, std::vector< DBGPointEntity > &moonIDs, uint8 &total)
Definition: SystemDB.cpp:359
SystemDB m_db
Definition: SystemGPoint.h:31
uint32 GetID() const
Definition: SystemManager.h:80
void GetMoons(uint32 systemID)
const GPoint GetRandPointOnPlanet(uint32 systemID)
Definition: gpoint.h:33
static const GPoint NULL_ORIGIN(0, 0, 0)
void MakeRandomPointOnSphereLayer(double radiusInner, double radiusOuter)
Definition: gpoint.h:59
void GetPlanets(uint32 systemID, std::vector< DBGPointEntity > &planetIDs, uint8 &total)
Definition: SystemDB.cpp:338
unsigned __int32 uint32
Definition: eve-compat.h:50
int64 MakeRandomInt(int64 low, int64 high)
Generates random integer from interval [low; high].
Definition: misc.cpp:109
signed __int64 int64
Definition: eve-compat.h:51
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type()() itemID() copy() materialLevel()() itemID(attributeID)-Retrieves attribute value." ) COMMAND( setattr
const GPoint Get2RandPlanets(uint32 systemID)
const GPoint GetAnomalyPoint(SystemManager *pSys)
unsigned __int16 uint16
Definition: eve-compat.h:48
void GetPlanets(uint32 systemID)
const GPoint GetRandPointInSystem(uint32 systemID, int64 distance)
static const int64 ONE_AU_IN_METERS
Definition: EVE_Consts.h:40