EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SystemGPoint Class Reference

#include "SystemGPoint.h"

Collaboration diagram for SystemGPoint:

Public Member Functions

SystemGPoint.cpp

a group of methods and functions to get random points in a given solarsystem : Allan

Date
: 31 July 2014
void GetMoons (uint32 systemID)
 
void GetPlanets (uint32 systemID)
 
uint32 GetRandMoon (uint32 systemID)
 
uint32 GetRandPlanet (uint32 systemID)
 
const GPoint GetAnomalyPoint (SystemManager *pSys)
 
const GPoint Get2RandPlanets (uint32 systemID)
 
const GPoint Get3RandPlanets (uint32 systemID)
 
const GPoint GetRandPointOnMoon (uint32 systemID)
 
const GPoint GetRandPointOnPlanet (uint32 systemID)
 
const GPoint GetRandPointInSystem (uint32 systemID, int64 distance)
 

Protected Attributes

SystemDB m_db
 

Detailed Description

Definition at line 17 of file SystemGPoint.h.

Member Function Documentation

const GPoint SystemGPoint::Get2RandPlanets ( uint32  systemID)
Todo:
finish this

Definition at line 114 of file SystemGPoint.cpp.

References SystemDB::GetPlanets(), m_db, and NULL_ORIGIN().

114  {
115  uint8 total = 0;
116  std::vector<DBGPointEntity> planetIDs;
117  planetIDs.clear();
118  m_db.GetPlanets(systemID, planetIDs, total);
120  return NULL_ORIGIN;
121 }
unsigned __int8 uint8
Definition: eve-compat.h:46
SystemDB m_db
Definition: SystemGPoint.h:31
static const GPoint NULL_ORIGIN(0, 0, 0)
void GetPlanets(uint32 systemID, std::vector< DBGPointEntity > &planetIDs, uint8 &total)
Definition: SystemDB.cpp:338

Here is the call graph for this function:

const GPoint SystemGPoint::Get3RandPlanets ( uint32  systemID)
Todo:
finish this

Definition at line 123 of file SystemGPoint.cpp.

References SystemDB::GetPlanets(), m_db, and NULL_ORIGIN().

123  {
124  uint8 total = 0;
125  std::vector<DBGPointEntity> planetIDs;
126  planetIDs.clear();
127  m_db.GetPlanets(systemID, planetIDs, total);
130  return NULL_ORIGIN;
131 }
unsigned __int8 uint8
Definition: eve-compat.h:46
SystemDB m_db
Definition: SystemGPoint.h:31
static const GPoint NULL_ORIGIN(0, 0, 0)
void GetPlanets(uint32 systemID, std::vector< DBGPointEntity > &planetIDs, uint8 &total)
Definition: SystemDB.cpp:338

Here is the call graph for this function:

const GPoint SystemGPoint::GetAnomalyPoint ( SystemManager pSys)

Definition at line 152 of file SystemGPoint.cpp.

References SystemManager::GetID(), SystemDB::GetPlanets(), SystemManager::GetSE(), itemID(), m_db, MakeRandomInt(), GPoint::MakeRandomPointOnSphereLayer(), and ONE_AU_IN_METERS.

Referenced by AnomalyMgr::CreateAnomaly().

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 }
unsigned __int8 uint8
Definition: eve-compat.h:46
SystemEntity * GetSE(uint32 entityID) const
SystemDB m_db
Definition: SystemGPoint.h:31
uint32 GetID() const
Definition: SystemManager.h:80
Definition: gpoint.h:33
void MakeRandomPointOnSphereLayer(double radiusInner, double radiusOuter)
Definition: gpoint.h:59
void GetPlanets(uint32 systemID, std::vector< DBGPointEntity > &planetIDs, uint8 &total)
Definition: SystemDB.cpp:338
int64 MakeRandomInt(int64 low, int64 high)
Generates random integer from interval [low; high].
Definition: misc.cpp:109
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
static const int64 ONE_AU_IN_METERS
Definition: EVE_Consts.h:40

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemGPoint::GetMoons ( uint32  systemID)

Definition at line 68 of file SystemGPoint.cpp.

References SystemDB::GetMoons(), and m_db.

68  {
69  uint8 total = 0;
70  std::vector<DBGPointEntity> moonIDs;
71  moonIDs.clear();
72  m_db.GetMoons(systemID, moonIDs, total);
73 }
unsigned __int8 uint8
Definition: eve-compat.h:46
void GetMoons(uint32 systemID, std::vector< DBGPointEntity > &moonIDs, uint8 &total)
Definition: SystemDB.cpp:359
SystemDB m_db
Definition: SystemGPoint.h:31

Here is the call graph for this function:

void SystemGPoint::GetPlanets ( uint32  systemID)
Todo:
move this into MapData class

the purpose of this class is to have a common location with methods used to define random points in solar systems based on planet and moon positions. GetRandPointOnPlanet() will query solar systems for planets, pick a random planet, and define a coordnate within that planet's bubble. GetRandPointOnMoon() does same as above, but using moons. Get2RandPlanets() will pick a random point between 2 planets, for warp-out/warp-in and other things as we see fit. Get3RandPlanets() does same as above, but using 3 planets. GetRandPointInSystem() will define a random point within a given system.

this class of methods should be used for positioning mission space, cosmic signatures, anomolies, complexes, and other things needing a random position in a given system.

these methods will also be used for random npc spawns and their warping/movement.

class DBGPointEntity has index, itemID, radius, and position, and is found in SystemDB. see copy of class declaration below

NOTE i seem to remember that ALL COSMIC SPAWNS are within 6au from planets. ....cant find that info now. -allan 31Jul14int64 MakeRandomInt( int64 low, int64 high ) double MakeRandomFloat( double low, double high )

Definition at line 61 of file SystemGPoint.cpp.

References SystemDB::GetPlanets(), and m_db.

61  {
62  uint8 total = 0;
63  std::vector<DBGPointEntity> planetIDs;
64  planetIDs.clear();
65  m_db.GetPlanets(systemID, planetIDs, total);
66 }
unsigned __int8 uint8
Definition: eve-compat.h:46
SystemDB m_db
Definition: SystemGPoint.h:31
void GetPlanets(uint32 systemID, std::vector< DBGPointEntity > &planetIDs, uint8 &total)
Definition: SystemDB.cpp:338

Here is the call graph for this function:

uint32 SystemGPoint::GetRandMoon ( uint32  systemID)

Definition at line 133 of file SystemGPoint.cpp.

References SystemDB::GetMoons(), m_db, and MakeRandomInt().

133  {
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 }
unsigned __int8 uint8
Definition: eve-compat.h:46
void GetMoons(uint32 systemID, std::vector< DBGPointEntity > &moonIDs, uint8 &total)
Definition: SystemDB.cpp:359
SystemDB m_db
Definition: SystemGPoint.h:31
int64 MakeRandomInt(int64 low, int64 high)
Generates random integer from interval [low; high].
Definition: misc.cpp:109
unsigned __int16 uint16
Definition: eve-compat.h:48

Here is the call graph for this function:

uint32 SystemGPoint::GetRandPlanet ( uint32  systemID)

Definition at line 101 of file SystemGPoint.cpp.

References SystemDB::GetPlanets(), m_db, and MakeRandomInt().

101  {
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 }
unsigned __int8 uint8
Definition: eve-compat.h:46
SystemDB m_db
Definition: SystemGPoint.h:31
void GetPlanets(uint32 systemID, std::vector< DBGPointEntity > &planetIDs, uint8 &total)
Definition: SystemDB.cpp:338
int64 MakeRandomInt(int64 low, int64 high)
Generates random integer from interval [low; high].
Definition: misc.cpp:109
unsigned __int16 uint16
Definition: eve-compat.h:48

Here is the call graph for this function:

const GPoint SystemGPoint::GetRandPointInSystem ( uint32  systemID,
int64  distance 
)

Definition at line 146 of file SystemGPoint.cpp.

References NULL_ORIGIN().

146  {
147  // get system max diameter, verify distance is within system.
148 
149  return NULL_ORIGIN;
150 }
static const GPoint NULL_ORIGIN(0, 0, 0)

Here is the call graph for this function:

const GPoint SystemGPoint::GetRandPointOnMoon ( uint32  systemID)

Definition at line 88 of file SystemGPoint.cpp.

References SystemDB::GetMoons(), m_db, MakeRandomInt(), and NULL_ORIGIN().

Referenced by Command_tr(), and SystemManager::LoadPlayerDynamics().

88  {
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 }
unsigned __int8 uint8
Definition: eve-compat.h:46
void GetMoons(uint32 systemID, std::vector< DBGPointEntity > &moonIDs, uint8 &total)
Definition: SystemDB.cpp:359
SystemDB m_db
Definition: SystemGPoint.h:31
static const GPoint NULL_ORIGIN(0, 0, 0)
int64 MakeRandomInt(int64 low, int64 high)
Generates random integer from interval [low; high].
Definition: misc.cpp:109
unsigned __int16 uint16
Definition: eve-compat.h:48

Here is the call graph for this function:

Here is the caller graph for this function:

const GPoint SystemGPoint::GetRandPointOnPlanet ( uint32  systemID)

Definition at line 75 of file SystemGPoint.cpp.

References SystemDB::GetPlanets(), m_db, MakeRandomInt(), and NULL_ORIGIN().

Referenced by BubbleManager::Add(), Command_tr(), SystemManager::LoadSystemDynamics(), and Client::SetDestiny().

75  {
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 }
unsigned __int8 uint8
Definition: eve-compat.h:46
SystemDB m_db
Definition: SystemGPoint.h:31
static const GPoint NULL_ORIGIN(0, 0, 0)
void GetPlanets(uint32 systemID, std::vector< DBGPointEntity > &planetIDs, uint8 &total)
Definition: SystemDB.cpp:338
int64 MakeRandomInt(int64 low, int64 high)
Generates random integer from interval [low; high].
Definition: misc.cpp:109
unsigned __int16 uint16
Definition: eve-compat.h:48

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation


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