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

#include "Planet.h"

Inheritance diagram for PlanetSE:
Collaboration diagram for PlanetSE:

Public Member Functions

virtual PlanetSEGetPlanetSE ()
 
virtual bool IsPlanetSE ()
 
bool HasCOSE ()
 
void SetCustomsOffice (CustomsSE *pSE)
 
CustomsSEGetCustomsOffice ()
 
bool HasColony ()
 
Planet.cpp

Specific Class for individual planets. this class will hold all planet data and relative info for each planet.

: Allan

Date
: 30 April 2016
 PlanetSE (InventoryItemRef self, PyServiceMgr &services, SystemManager *system)
 
virtual ~PlanetSE ()
 
virtual void Process ()
 
virtual bool LoadExtras ()
 
PyRepGetPlanetInfo (Colony *pColony)
 
PyRepGetResourceData (Call_ResourceDataDict &dict)
 
PyRepGetPlanetResourceInfo ()
 
PyRepGetExtractorsForPlanet (int32 planetID)
 
void AbandonColony (Colony *pColony)
 
ColonyGetColony (Client *pClient)
 
void CreateCustomsOffice ()
 
- Public Member Functions inherited from StaticSystemEntity
 StaticSystemEntity (InventoryItemRef self, PyServiceMgr &services, SystemManager *system)
 
virtual ~StaticSystemEntity ()
 
virtual StaticSystemEntityGetStaticSE ()
 
virtual bool isGlobal ()
 
virtual bool IsInanimateSE ()
 
virtual bool IsStaticEntity ()
 
virtual void EncodeDestiny (Buffer &into)
 
virtual PyDictMakeSlimItem ()
 
- Public Member Functions inherited from SystemEntity
 SystemEntity (InventoryItemRef self, PyServiceMgr &services, SystemManager *system)
 
virtual ~SystemEntity ()
 
virtual bool ProcessTic ()
 
virtual SystemEntityGetSE ()
 
virtual StationSEGetStationSE ()
 
virtual MoonSEGetMoonSE ()
 
virtual StargateSEGetGateSE ()
 
virtual BeltSEGetBeltSE ()
 
virtual ItemSystemEntityGetItemSE ()
 
virtual ContainerSEGetContSE ()
 
virtual WreckSEGetWreckSE ()
 
virtual AnomalySEGetAnomalySE ()
 
virtual WormholeSEGetWormholeSE ()
 
virtual FieldSEGetFieldSE ()
 
virtual ProbeSEGetProbeSE ()
 
virtual ObjectSystemEntityGetObjectSE ()
 
virtual AsteroidSEGetAsteroidSE ()
 
virtual StructureSEGetPOSSE ()
 
virtual StructureSEGetJammerSE ()
 
virtual JumpBridgeSEGetJumpBridgeSE ()
 
virtual StructureSEGetOutpostSE ()
 
virtual TowerSEGetTowerSE ()
 
virtual ArraySEGetArraySE ()
 
virtual WeaponSEGetWeaponSE ()
 
virtual BatterySEGetBatterySE ()
 
virtual DeployableSEGetDeployableSE ()
 
virtual SentryGetSentrySE ()
 
virtual ModuleSEGetModuleSE ()
 
virtual ReactorSEGetReactorSE ()
 
virtual CustomsSEGetCOSE ()
 
virtual TCUSEGetTCUSE ()
 
virtual SBUSEGetSBUSE ()
 
virtual IHubSEGetIHubSE ()
 
virtual DynamicSystemEntityGetDynamicSE ()
 
virtual NPCGetNPCSE ()
 
virtual DroneSEGetDroneSE ()
 
virtual MissileGetMissileSE ()
 
virtual ShipSEGetShipSE ()
 
virtual ConcordGetConcordSE ()
 
virtual bool IsSystemEntity ()
 
virtual bool IsBeltSE ()
 
virtual bool IsGateSE ()
 
virtual bool IsMoonSE ()
 
virtual bool IsStationSE ()
 
virtual bool IsItemEntity ()
 
virtual bool IsAnomalySE ()
 
virtual bool IsWormholeSE ()
 
virtual bool IsCelestialSE ()
 
virtual bool IsContainerSE ()
 
virtual bool IsFieldSE ()
 
virtual bool IsProbeSE ()
 
virtual bool IsObjectEntity ()
 
virtual bool IsSentrySE ()
 
virtual bool IsPOSSE ()
 
virtual bool IsCOSE ()
 
virtual bool IsTCUSE ()
 
virtual bool IsSBUSE ()
 
virtual bool IsIHubSE ()
 
virtual bool IsTowerSE ()
 
virtual bool IsArraySE ()
 
virtual bool IsJammerSE ()
 
virtual bool IsWeaponSE ()
 
virtual bool IsBatterySE ()
 
virtual bool IsModuleSE ()
 
virtual bool IsMoonMiner ()
 
virtual bool IsOutpostSE ()
 
virtual bool IsAsteroidSE ()
 
virtual bool IsDeployableSE ()
 
virtual bool IsJumpBridgeSE ()
 
virtual bool IsReactorSE ()
 
virtual bool IsOperSE ()
 
virtual bool IsDynamicEntity ()
 
virtual bool IsLogin ()
 
virtual bool IsInvul ()
 
virtual bool IsFrozen ()
 
virtual bool IsNPCSE ()
 
virtual bool IsDroneSE ()
 
virtual bool IsWreckSE ()
 
virtual bool IsMissileSE ()
 
virtual bool IsShipSE ()
 
virtual bool IsConcord ()
 
PyServiceMgrGetServices ()
 
SystemBubbleSysBubble ()
 
SystemManagerSystemMgr ()
 
TargetManagerTargetMgr ()
 
DestinyManagerDestinyMgr ()
 
InventoryItemRef GetSelf ()
 
uint16 GetTypeID ()
 
uint32 GetGroupID ()
 
uint8 GetCategoryID ()
 
EVEItemFlags GetFlag ()
 
uint32 GetID ()
 
double GetRadius ()
 
uint32 GetLocationID ()
 
const char * GetName () const
 
const GPointGetPosition () const
 
void SetPosition (const GPoint &pos)
 
double x ()
 
double y ()
 
double z ()
 
int32 GetAllianceID ()
 
int32 GetWarFactionID ()
 
uint32 GetCorporationID ()
 
uint32 GetOwnerID ()
 
uint32 GetFleetID ()
 
void SetFleetID (uint32 set)
 
int8 GetHarmonic ()
 
void SetHarmonic (int8 set)
 
void DropLoot (WreckContainerRef wreckRef, uint32 groupID, uint32 owner)
 
void AwardSecurityStatus (InventoryItemRef iRef, Character *pChar)
 
void SendDamageStateChanged ()
 
bool ApplyDamage (Damage &d)
 
double DistanceTo2 (const SystemEntity *other)
 
PyTupleMakeDamageState ()
 
virtual void Abandon ()
 
const bool IsDead ()
 
const GVectorGetVelocity ()
 
virtual void Killed (Damage &fatal_blow)
 
virtual void MakeDamageState (DoDestinyDamageState &into)
 
virtual void MissileLaunched (Missile *pMissile)
 
virtual void UpdateDamage ()
 
virtual void Delete ()
 
virtual void SetPilot (Client *pClient)
 
virtual bool HasPilot ()
 
virtual ClientGetPilot ()
 

Protected Attributes

CustomsSEpCO
 
PlanetResourceData m_data
 
- Protected Attributes inherited from SystemEntity
SystemBubblem_bubble
 
SystemManagerm_system
 
TargetManagerm_targMgr
 
DestinyManagerm_destiny
 
PyServiceMgrm_services
 
InventoryItemRef m_self
 
bool m_killed
 
double m_radius
 
int32 m_harmonic
 
int32 m_warID
 
int32 m_allyID
 
uint32 m_corpID
 
uint32 m_fleetID
 
uint32 m_ownerID
 

Private Attributes

std::map< uint16, std::string > m_typeBuffers
 
std::map< uint32, Colony * > m_colonies
 

Detailed Description

Definition at line 38 of file Planet.h.

Constructor & Destructor Documentation

PlanetSE::PlanetSE ( InventoryItemRef  self,
PyServiceMgr services,
SystemManager system 
)

Definition at line 45 of file Planet.cpp.

References m_data.

46 : StaticSystemEntity(self, services, system),
47 pCO(nullptr)
48 {
50 }
PlanetResourceData m_data
Definition: Planet.h:74
StaticSystemEntity(InventoryItemRef self, PyServiceMgr &services, SystemManager *system)
CustomsSE * pCO
Definition: Planet.h:73
PlanetSE::~PlanetSE ( )
virtual

Definition at line 52 of file Planet.cpp.

References m_colonies, and SafeDelete().

53 {
54  for (auto cur : m_colonies) {
55  cur.second->Shutdown();
56  SafeDelete(cur.second);
57  }
58 }
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
std::map< uint32, Colony * > m_colonies
Definition: Planet.h:84

Here is the call graph for this function:

Member Function Documentation

void PlanetSE::AbandonColony ( Colony pColony)

Definition at line 266 of file Planet.cpp.

References Colony::AbandonColony(), Colony::GetOwner(), and m_colonies.

267 {
268  pColony->AbandonColony();
269  m_colonies.erase(pColony->GetOwner());
270 }
uint32 GetOwner()
Definition: Colony.cpp:249
void AbandonColony()
Definition: Colony.cpp:341
std::map< uint32, Colony * > m_colonies
Definition: Planet.h:84

Here is the call graph for this function:

void PlanetSE::CreateCustomsOffice ( )
Todo:
will need to write this code and make it play nice with everything else. a CO will be a special container as a CustomsSE, linked to the planet it orbits, and any colony on that planet. there is only one CO per planet, but ALL chars with a colony on that planet can access their items on the same CO the CO will load all items when it loads, but will need checks on "view items" or "open container" to ONLY send items owned by calling char, or NONE for chars that dont have a colony on that planet. i dont know where/how to do that yet...will need testing CO can go into reinforced mode, like towers (hint: use same code)

Definition at line 272 of file Planet.cpp.

References SystemManager::AddEntity(), FactionData::allianceID, corpCONCORD, corpInterbus, FactionData::corporationID, EvE::Trig::Deg2Rad(), factionCONCORD, FactionData::factionID, factionInterBus, flagNone, SystemManager::GetID(), SystemEntity::GetPosition(), SystemEntity::GetRadius(), SystemManager::GetSystemSecurityRating(), CustomsSE::Init(), EVEDB::invTypes::InterbusCustomsOffice, InventoryItem::itemID(), itoa(), SystemEntity::m_self, SystemEntity::m_services, SystemEntity::m_system, MakeRandomInt(), FactionData::ownerID, pCO, EVEDB::invTypes::PlanetaryCustomsOffice, sItemFactory, Ga::GaVec3::x, Ga::GaVec3::y, and Ga::GaVec3::z.

Referenced by PlanetMgr::CreatePin().

273 {
283  //ItemData( uint32 _typeID, uint32 _ownerID, uint32 _locationID, EVEItemFlags _flag, uint32 _quantity, const char *_customInfo = "", bool _contraband = false);
284  FactionData data = FactionData();
285  data.ownerID = corpInterbus;
286  data.factionID = factionInterBus;
287  data.allianceID = 0;
290 
291  if (m_system->GetSystemSecurityRating() > 0.49) {
293  data.ownerID = corpCONCORD;
294  data.factionID = factionCONCORD; //sDataMgr.GetRegionFaction(m_system->GetRegionID());
295  data.allianceID = 0;
296  data.corporationID = corpCONCORD;
297  }
298 
299  /* this puts CO in warp-in bubble
300  // calculate warp-in point
301  GPoint pos = GetPosition();
302  uint32 radius = m_self->radius();
303  srandom(m_self->itemID());
304  int64 rand = random();
305  double j = (((rand / RAND_MAX) -1.0) / 3.0);
306  double s = 20 * pow(0.025 * (10 * log10(radius/1000000) -39), 20) +0.5;
307  s = EvE::max(0.5, EvE::min(s, 10.5));
308  double t = asin((pos.x/fabs(pos.x)) * (pos.z / sqrt(pow(pos.x, 2) + pow(pos.z, 2)))) +j;
309  uint32 d = radius * (s +1) +10000;
310  pos.x += d * sin(t);
311  pos.y += 0.5 * radius * sin(j);
312  pos.z -= d * cos(t);
313  // put CO 50km closer to planet than warpIn point.
314  GVector dir(pos, m_self->position());
315  dir.normalize();
316  pos -= (dir * 50000);
317  */
318  // this puts CO in random 700km orbit around planet
319  GPoint pos(GetPosition());
320  //pos.MakeRandomPointOnSphere(GetRadius() + 700000);
321 
322  //uint32 dist = BUBBLE_RADIUS_METERS + 10000/*m_self->GetAttribute(AttrMoonAnchorDistance).get_int()*/;
323  uint32 radius = GetRadius();
324  float rad = EvE::Trig::Deg2Rad(25);
325 
326  pos.x += radius + 700000 * std::sin(rad);
327  pos.z += radius + 700000 * std::cos(rad);
328  pos.y += MakeRandomInt(-1000, 1000);
329 
330  ItemData idata(typeID, data.ownerID, m_system->GetID(), flagNone, 1, itoa(m_self->itemID()), false);
331  StructureItemRef iRef = sItemFactory.SpawnStructure(idata);
332  iRef->SetPosition(pos);
333  iRef->ChangeSingleton(true, false);
334  iRef->SaveItem();
335  pCO = new CustomsSE(iRef, m_services, m_system, data);
336  pCO->Init();
338 }
void AddEntity(SystemEntity *pSE, bool addSignal=true)
double GetRadius()
Definition: SystemEntity.h:208
virtual void Init()
PyServiceMgr & m_services
Definition: SystemEntity.h:267
const float GetSystemSecurityRating()
Definition: SystemManager.h:86
uint32 GetID() const
Definition: SystemManager.h:80
const GPoint & GetPosition() const
Definition: SystemEntity.h:211
Definition: gpoint.h:33
InventoryItemRef m_self
Definition: SystemEntity.h:269
double Deg2Rad(double deg)
Definition: Trig.h:25
SystemManager * m_system
Definition: SystemEntity.h:263
unsigned __int32 uint32
Definition: eve-compat.h:50
uint32 corporationID
int64 MakeRandomInt(int64 low, int64 high)
Generates random integer from interval [low; high].
Definition: misc.cpp:109
#define sItemFactory
Definition: ItemFactory.h:165
CustomsSE * pCO
Definition: Planet.h:73
unsigned __int16 uint16
Definition: eve-compat.h:48
const char * itoa(int64 num)
Convers num to string.
uint32 itemID() const
Definition: InventoryItem.h:98
Reference-counting-based smart pointer.
Definition: RefPtr.h:133

Here is the call graph for this function:

Here is the caller graph for this function:

Colony * PlanetSE::GetColony ( Client pClient)

Definition at line 255 of file Planet.cpp.

References Client::GetCharacterID(), m_colonies, and SystemEntity::m_services.

256 {
257  std::map<uint32, Colony*>::const_iterator itr = m_colonies.find(pClient->GetCharacterID());
258  if (itr != m_colonies.end())
259  return itr->second;
260  Colony* pColony = new Colony(&m_services, pClient, this);
261  m_colonies[pClient->GetCharacterID()] = pColony;
262 
263  return pColony;
264 }
int32 GetCharacterID() const
Definition: Client.h:113
PyServiceMgr & m_services
Definition: SystemEntity.h:267
Definition: Colony.h:38
std::map< uint32, Colony * > m_colonies
Definition: Planet.h:84

Here is the call graph for this function:

CustomsSE* PlanetSE::GetCustomsOffice ( )
inline

Definition at line 68 of file Planet.h.

References pCO.

Referenced by PlanetMgr::CreatePin(), and Colony::PlanetXfer().

68 { return pCO; }
CustomsSE * pCO
Definition: Planet.h:73

Here is the caller graph for this function:

PyRep * PlanetSE::GetExtractorsForPlanet ( int32  planetID)

Definition at line 230 of file Planet.cpp.

References PyList::AddItem(), PyRep::Dump(), PlanetDB::GetExtractorsForPlanet(), DBResultRow::GetFloat(), DBResultRow::GetInt(), DBQueryResult::GetRow(), is_log_enabled, and PyDict::SetItem().

230  {
231  // NOTE this gets ALL extractors on this planet
232  // returns typeID, ownerID, latitude?, longitude?
233 
234  DBQueryResult res;
235  // {for ecu in planetID} SELECT `headID`, `typeID`, `ownerID`, `latitude`, `longitude` FROM `piECUHeads`
236  PlanetDB::GetExtractorsForPlanet(planetID, res);
237 
238  PyList* list = new PyList();
239  DBResultRow row;
240  while (res.GetRow(row)) {
241  PyDict* dict(new PyDict());
242  dict->SetItem("pinID", new PyInt(row.GetInt(0)));
243  dict->SetItem("typeID", new PyInt(row.GetInt(1)));
244  dict->SetItem("ownerID", new PyInt(row.GetInt(2)));
245  dict->SetItem("latitude", new PyFloat(row.GetFloat(3)));
246  dict->SetItem("longitude", new PyFloat(row.GetFloat(4)));
247  list->AddItem(new PyObject("util.KeyVal", dict));
248  }
249 
250  if (is_log_enabled(PLANET__RES_DUMP))
251  list->Dump(PLANET__RES_DUMP, " ");
252  return list;
253 }
float GetFloat(uint32 index) const
Definition: dbcore.cpp:682
int32 GetInt(uint32 index) const
Definition: dbcore.cpp:635
Python's dictionary.
Definition: PyRep.h:719
Python floating point number.
Definition: PyRep.h:292
void Dump(FILE *into, const char *pfx) const
Dumps object to file.
Definition: PyRep.cpp:84
void AddItem(PyRep *i)
Definition: PyRep.h:701
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
#define is_log_enabled(type)
Definition: logsys.h:78
Python object.
Definition: PyRep.h:826
Python integer.
Definition: PyRep.h:231
static void GetExtractorsForPlanet(uint32 planetID, DBQueryResult &res)
Definition: PlanetDB.cpp:194
Python list.
Definition: PyRep.h:639

Here is the call graph for this function:

PyRep * PlanetSE::GetPlanetInfo ( Colony pColony)

Definition at line 209 of file Planet.cpp.

References args, PyRep::Dump(), SystemManager::GetID(), Colony::GetLevel(), Colony::GetLinks(), Colony::GetPins(), SystemEntity::GetRadius(), Colony::GetRoutes(), Colony::GetSimTime(), Colony::HasColony(), is_log_enabled, InventoryItem::itemID(), SystemEntity::m_self, SystemEntity::m_system, PyDict::SetItem(), and InventoryItem::typeID().

209  {
210  PyDict *args = new PyDict();
211  args->SetItem("planetTypeID", new PyInt(m_self->typeID()));
212  args->SetItem("solarSystemID", new PyInt(m_system->GetID()));
213  args->SetItem("radius", new PyInt(GetRadius()));
214  args->SetItem("planetID", new PyInt(m_self->itemID()));
215  if (pColony->HasColony()) {
216  //pColony->Update();
217  args->SetItem("level", new PyInt(pColony->GetLevel()));
218  args->SetItem("pins", pColony->GetPins());
219  args->SetItem("links", pColony->GetLinks());
220  args->SetItem("routes", pColony->GetRoutes());
221  args->SetItem("currentSimTime", new PyLong(pColony->GetSimTime()));
222  }
223  //PyIncRef(args);
224  PyObject *rtn = new PyObject("util.KeyVal", args);
225  if (is_log_enabled(PLANET__RES_DUMP))
226  rtn->Dump(PLANET__RES_DUMP, " ");
227  return rtn;
228 }
int64 GetSimTime()
Definition: Colony.h:92
double GetRadius()
Definition: SystemEntity.h:208
Python's dictionary.
Definition: PyRep.h:719
int8 GetLevel()
Definition: Colony.h:91
uint32 GetID() const
Definition: SystemManager.h:80
void Dump(FILE *into, const char *pfx) const
Dumps object to file.
Definition: PyRep.cpp:84
PyTuple * GetLinks()
Definition: Colony.cpp:1277
bool HasColony()
Definition: Colony.h:89
* args
#define is_log_enabled(type)
Definition: logsys.h:78
InventoryItemRef m_self
Definition: SystemEntity.h:269
PyTuple * GetRoutes()
Definition: Colony.cpp:1293
Python object.
Definition: PyRep.h:826
Python integer.
Definition: PyRep.h:231
SystemManager * m_system
Definition: SystemEntity.h:263
PyTuple * GetPins()
Definition: Colony.cpp:1206
void SetItem(PyRep *key, PyRep *value)
SetItem adds or sets a database entry.
Definition: PyRep.cpp:713
uint16 typeID() const
uint32 itemID() const
Definition: InventoryItem.h:98
Python long integer.
Definition: PyRep.h:261

Here is the call graph for this function:

PyRep * PlanetSE::GetPlanetResourceInfo ( )

Definition at line 196 of file Planet.cpp.

References PlanetResourceData::dist_1, PlanetResourceData::dist_2, PlanetResourceData::dist_3, PlanetResourceData::dist_4, PlanetResourceData::dist_5, PyRep::Dump(), is_log_enabled, m_data, PyDict::SetItem(), PlanetResourceData::type_1, PlanetResourceData::type_2, PlanetResourceData::type_3, PlanetResourceData::type_4, and PlanetResourceData::type_5.

197 {
198  PyDict* res = new PyDict();
199  res->SetItem(new PyInt(m_data.type_1), new PyFloat(m_data.dist_1));
200  res->SetItem(new PyInt(m_data.type_2), new PyFloat(m_data.dist_2));
201  res->SetItem(new PyInt(m_data.type_3), new PyFloat(m_data.dist_3));
202  res->SetItem(new PyInt(m_data.type_4), new PyFloat(m_data.dist_4));
203  res->SetItem(new PyInt(m_data.type_5), new PyFloat(m_data.dist_5));
204  if (is_log_enabled(PLANET__RES_DUMP))
205  res->Dump(PLANET__RES_DUMP, " ");
206  return res;
207 }
PlanetResourceData m_data
Definition: Planet.h:74
Python's dictionary.
Definition: PyRep.h:719
Python floating point number.
Definition: PyRep.h:292
void Dump(FILE *into, const char *pfx) const
Dumps object to file.
Definition: PyRep.cpp:84
#define is_log_enabled(type)
Definition: logsys.h:78
Python integer.
Definition: PyRep.h:231
void SetItem(PyRep *key, PyRep *value)
SetItem adds or sets a database entry.
Definition: PyRep.cpp:713

Here is the call graph for this function:

virtual PlanetSE* PlanetSE::GetPlanetSE ( )
inlinevirtual

Reimplemented from SystemEntity.

Definition at line 49 of file Planet.h.

49 { return this; }
PyRep * PlanetSE::GetResourceData ( Call_ResourceDataDict &  dict)
Todo:
this needs a minor rewrite....bands are dictated by client request. bufferData is random fill based on bands, but kept per planet will have to create a method to fill buffer with random values, rather than fill with single value the full 30 band data buffer will be created on planet creation for each resource, and the "bands" are the "layers" of the resource, per se, with more layers giving higher degree of accuracy. the client sends depth request, and that will determine the bands and buffer size to return. the requested bands will have to be taken from the full 30-band data buffer, as needed. this resource data MAY change over the course of the running server, but not decided how/when/why yet.

Definition at line 136 of file Planet.cpp.

References _log, args, PyRep::Dump(), is_log_enabled, m_typeBuffers, and sPIDataMgr.

137 {
138  /* from eve/client/script/environment/planet\clientPlanet.py
139  * This method is used to fetch spherical harmonic data for a given
140  * resource type on the current planet.
141  */
142  // will update this to use PI skills (sent in dict) as system grows..not sure how yet.
153  // actual hex from live for "data"
154  //E80E364382F13EBFEC13F03FEB42483F1263B2BF8C94004075360EC19842ACBEC0B7FABF0C5DA73EF4F6E03FC0B21C3EE0D71F3E5206233E8FC6E43E5245E6BFAD29A63F112C81 \
155  BF6038393EFE19C1BF8FA975C2808D093FE0BB5EBF6C9A533FA1DB4FBF04DDAF3D3CE450C0435DB7BCBDDB80BF2EAD783FE028A8C04A733FBF76012BBFEA17FCBFF4F4113E6C7EC9 \
156  3FFB8EDBBE52C084BF04608B3DFA748F3E3715823F5DA7F1BE5FA97B4206CE83BE2597E03FF6AF46BF2F6EA9BE160297BFBD70FB3FC02B75BF66A0AD3FA095213F2ED9033E5B9D50 \
157  BE94BC53BE2C77E9BFDFDDE24066B21F3F5B1A043FC6531D40E2426CBE5012204036F3ACBF4EA60DBFBDDC46BFB469044020D610BFF68E0EBF1145A8BFD3B0063FF43EB7BFAF69DE \
158  3F437B92C14232D1BEA0E45FBFDC639BBE4813C43E476F2D3F3E260F403436BC3EA993B8BFCDE9153F22C3243F0021DCBF9ECB443F619A6EBF824FE03F4118ED3E96AD5C3F9413B5 \
159  3FE8D0CA3D0EE85CBDF3EC6D3E32E5EDBE3DBAA13EB2379BBF18A8233FCFA5E1BE91B0C03FA51AC9BE9F3F593F4B160FC0A817F0BEF1E5AE3F487E6C3F586B943F4921A73FA845FE \
160  BEAE9D103FE725AEBF1B3A9FC14F69733F3B1B04BF18B9AE3FCBF4D0BD447B483F3E1870BFAAA7A1BEEC3C35C076BB1C3F697F493D00C4C7BEE74CFABFA4E6053F972189BCBDC3AE \
161  3F42E984BF85FDBC3E3C9275BF3C07FFBD4C30D0BED828C43E6CF6C3C0C2F5CDBEBD5E3DBFACB29ABFCA75B1BD6A4035BFE537F83E165BD3BD5D3F4FBDACA1F6BF2A97E0BD4C1F44 \
162  3FF054B6BE692C0F3F8EFB933F52BDE4BF5D97D33E4998C8BF22E25BBE581710BF9F093A3E3D8E8F3DBFEF453F9D32443E1B2EAD41B9FB39BFA85A753F73FABFBFE1B155BE01FFBE \
163  BF897341BF715F19BE5739323EC2E50C3FF7A2B23F47499ABF6E4E1E3F93F555BEF51F8E3FBC21C13DC69CE5BFCD1E5DBF997FC23DDB348D3E300E6B3D49D4183FEDE50CBFD2EBAC \
164  BE509C37BE5310D9BF22BFA940BBE2013F9437083FEC5EB33FE79D053E8FB0903F12BB5CBF4D02BC3E26DAC2BF0CD894BDEEB8B7BEAE1F1440564199BEFE322BBFE5F690BE9E1241 \
165  3FDD38A5BFB2AEAC3E3C8681BF19A36F3F3E2C9D3EB039813E46BD47BF200996BE12F0A3BFC1DAFE3E9C5EA4BFAC65223F74A7EBC03047C3BB1CB01ABF15148F3E9B71163E6C545E \
166  3FDB34553F34096E3D6E12A03F3CF08ABFE904303F367E9ABE064D583FEAE2953F3A5DC7BE
167 
168  /*
169  dict.resourceTypeID;
170  dict.advancedPlanetology;
171  dict.oldBand;
172  dict.planetology;
173  dict.remoteSensing;
174  dict.updateTime;
175  */
176  std::map<uint16, std::string>::iterator itr = m_typeBuffers.find(dict.resourceTypeID);
177  if (itr == m_typeBuffers.end())
178  return nullptr;
179  uint16 size = (uint16)pow(dict.newBand, 2) *4;
180  std::string data = itr->second.substr(0, size);
181  // adjust data for system security. not sure how to make it 'less' yet
182  _log(PLANET__DEBUG, "PlanetSE::GetResourceData() for %s (%u) using remoteSense: %u, planetology: %u, advPlanetology: %u - updateTime: %u, proximity: %u, newBand: %u, oldBand: %u, bufferSize: %u", \
183  sPIDataMgr.GetProductName(dict.resourceTypeID), dict.resourceTypeID, dict.remoteSensing, dict.planetology, dict.advancedPlanetology, \
184  dict.updateTime, dict.proximity, dict.newBand, dict.oldBand, size);
185  PyDict* args = new PyDict();
186  args->SetItemString("data", new PyString(data));
187  args->SetItemString("numBands", new PyInt(dict.newBand));
188  args->SetItemString("proximity", new PyInt(dict.proximity));
189  //PyIncRef(args);
190  PyObject* rtn = new PyObject("util.KeyVal", args);
191  if (is_log_enabled(PLANET__RES_DUMP))
192  rtn->Dump(PLANET__RES_DUMP, " ");
193  return rtn;
194 }
#define _log(type, fmt,...)
Definition: logsys.h:124
Python string.
Definition: PyRep.h:430
Python's dictionary.
Definition: PyRep.h:719
#define sPIDataMgr
Definition: PlanetDataMgr.h:79
void Dump(FILE *into, const char *pfx) const
Dumps object to file.
Definition: PyRep.cpp:84
* args
#define is_log_enabled(type)
Definition: logsys.h:78
Python object.
Definition: PyRep.h:826
Python integer.
Definition: PyRep.h:231
std::map< uint16, std::string > m_typeBuffers
Definition: Planet.h:77
unsigned __int16 uint16
Definition: eve-compat.h:48

Here is the call graph for this function:

bool PlanetSE::HasColony ( )
inline

Definition at line 70 of file Planet.h.

References m_colonies.

70 { return !m_colonies.empty(); }
std::map< uint32, Colony * > m_colonies
Definition: Planet.h:84
bool PlanetSE::HasCOSE ( )
inline

Definition at line 65 of file Planet.h.

References pCO.

65 { return pCO != nullptr; }
CustomsSE * pCO
Definition: Planet.h:73
virtual bool PlanetSE::IsPlanetSE ( )
inlinevirtual

Reimplemented from SystemEntity.

Definition at line 51 of file Planet.h.

51 { return true; }
bool PlanetSE::LoadExtras ( )
virtual
Todo:
use this to initialize planet data, create planet manager, or whatever else i decide is needed for planet management this is called after SE is created.
Todo:
save planet data after creation. change data every x hours?days?

Reimplemented from StaticSystemEntity.

Definition at line 60 of file Planet.cpp.

References PlanetResourceData::buffer_1, PlanetResourceData::buffer_2, PlanetResourceData::buffer_3, PlanetResourceData::buffer_4, PlanetResourceData::buffer_5, PlanetResourceData::dist_1, PlanetResourceData::dist_2, PlanetResourceData::dist_3, PlanetResourceData::dist_4, PlanetResourceData::dist_5, SystemManager::GetSystemSecurityRating(), hexList, StaticSystemEntity::LoadExtras(), m_data, SystemEntity::m_self, SystemEntity::m_system, m_typeBuffers, MakeRandomFloat(), MakeRandomInt(), EvE::min(), sPlanetDataMgr, PlanetResourceData::type_1, PlanetResourceData::type_2, PlanetResourceData::type_3, PlanetResourceData::type_4, PlanetResourceData::type_5, and InventoryItem::typeID().

60  {
62  return false;
63 
67  std::vector<uint16> typeIDs;
68  sPlanetDataMgr.GetPlanetData(m_self->typeID(), typeIDs);
69  m_data.type_1 = typeIDs.at(0);
70  m_data.type_2 = typeIDs.at(1);
71  m_data.type_3 = typeIDs.at(2);
72  m_data.type_4 = typeIDs.at(3);
73  m_data.type_5 = typeIDs.at(4);
74 
77  /* quality: (min=1.0, max=154.275) */
78  // these are relative indicators of material quantity. makes no difference to ecu or extraction amount
79  // as system matures, we will begin adjusting these (from extractor data) and saving per planet
80  float sysSec = (1.1 - m_system->GetSystemSecurityRating()); // 0.1 - 2.0
81  int min = round(sysSec *10);
82  m_data.dist_1 = MakeRandomInt(min, 75) * sysSec + MakeRandomFloat(0, 4);
83  m_data.dist_2 = MakeRandomInt(min, 75) * sysSec + MakeRandomFloat(0, 4);
84  m_data.dist_3 = MakeRandomInt(min, 75) * sysSec + MakeRandomFloat(0, 4);
85  m_data.dist_4 = MakeRandomInt(min, 75) * sysSec + MakeRandomFloat(0, 4);
86  m_data.dist_5 = MakeRandomInt(min, 75) * sysSec + MakeRandomFloat(0, 4);
87 
88  //if (sysSec > 1) {
89  for (uint16 i=0; i<3600; ++i) //this cannot use numList
90  m_data.buffer_1 += hexList[MakeRandomInt(0,15)]; // random fill buffer to capacity, 1k8 bytes.
91  for (uint16 i=0; i<3600; ++i)
92  m_data.buffer_2 += hexList[MakeRandomInt(0,15)]; // random fill buffer to capacity, 1k8 bytes.
93  for (uint16 i=0; i<3600; ++i)
94  m_data.buffer_3 += hexList[MakeRandomInt(0,15)]; // random fill buffer to capacity, 1k8 bytes.
95  for (uint16 i=0; i<3600; ++i)
96  m_data.buffer_4 += hexList[MakeRandomInt(0,15)]; // random fill buffer to capacity, 1k8 bytes.
97  for (uint16 i=0; i<3600; ++i)
98  m_data.buffer_5 += hexList[MakeRandomInt(0,15)]; // random fill buffer to capacity, 1k8 bytes.
99  /* } else {
100  for (uint16 i=0; i<1000; ++i) {
101  m_data.buffer_1 += asciiList[MakeRandomInt(0,57)]; // random fill buffer to capacity, 1k8 bytes.
102  m_data.buffer_2 += alphaList[MakeRandomInt(0,26)]; // random fill buffer to capacity, 1k8 bytes.
103  m_data.buffer_3 += numList[MakeRandomInt(0,10)]; // random fill buffer to capacity, 1k8 bytes.
104  m_data.buffer_4 += numList[MakeRandomInt(0,10)]; // random fill buffer to capacity, 1k8 bytes.
105  m_data.buffer_5 += numList[MakeRandomInt(0,10)]; // random fill buffer to capacity, 1k8 bytes.
106  }
107  } */
108 /*
109  for (uint16 i=0; i<800; ++i) {
110  m_data.buffer_1 += std::to_string(0);
111  m_data.buffer_2 += std::to_string(0);
112  m_data.buffer_3 += std::to_string(0);
113  m_data.buffer_4 += std::to_string(0);
114  m_data.buffer_5 += std::to_string(0);
115  }
116 */
122 
123  // should we check for a CO here?
124  // no, it hasnt been loaded at this point
125 
126  return true;
127 }
PlanetResourceData m_data
Definition: Planet.h:74
std::string buffer_2
Definition: EVE_Planet.h:111
double min(double x, double y)
Definition: misc.h:95
double MakeRandomFloat(double low, double high)
Generates random real from interval [low; high].
Definition: misc.cpp:114
const float GetSystemSecurityRating()
Definition: SystemManager.h:86
InventoryItemRef m_self
Definition: SystemEntity.h:269
SystemManager * m_system
Definition: SystemEntity.h:263
static const char hexList[]
Definition: EVE_Consts.h:18
std::string buffer_3
Definition: EVE_Planet.h:112
int64 MakeRandomInt(int64 low, int64 high)
Generates random integer from interval [low; high].
Definition: misc.cpp:109
std::string buffer_5
Definition: EVE_Planet.h:114
std::map< uint16, std::string > m_typeBuffers
Definition: Planet.h:77
std::string buffer_4
Definition: EVE_Planet.h:113
virtual bool LoadExtras()
std::string buffer_1
Definition: EVE_Planet.h:110
unsigned __int16 uint16
Definition: eve-compat.h:48
uint16 typeID() const
#define sPlanetDataMgr
Definition: PlanetDataMgr.h:41

Here is the call graph for this function:

void PlanetSE::Process ( )
virtual

Reimplemented from SystemEntity.

Definition at line 130 of file Planet.cpp.

References m_colonies.

131 {
132  for (auto cur : m_colonies)
133  cur.second->Process();
134 }
std::map< uint32, Colony * > m_colonies
Definition: Planet.h:84
void PlanetSE::SetCustomsOffice ( CustomsSE pSE)
inline

Definition at line 67 of file Planet.h.

References pCO.

Referenced by DynamicEntityFactory::BuildEntity(), and ObjectSystemEntity::Killed().

67 { pCO = pSE; }
CustomsSE * pCO
Definition: Planet.h:73

Here is the caller graph for this function:

Member Data Documentation

std::map<uint32, Colony*> PlanetSE::m_colonies
private

Definition at line 84 of file Planet.h.

Referenced by AbandonColony(), GetColony(), HasColony(), Process(), and ~PlanetSE().

PlanetResourceData PlanetSE::m_data
protected

Definition at line 74 of file Planet.h.

Referenced by GetPlanetResourceInfo(), LoadExtras(), and PlanetSE().

std::map<uint16, std::string> PlanetSE::m_typeBuffers
private

Definition at line 77 of file Planet.h.

Referenced by GetResourceData(), and LoadExtras().

CustomsSE* PlanetSE::pCO
protected

Definition at line 73 of file Planet.h.

Referenced by CreateCustomsOffice(), GetCustomsOffice(), HasCOSE(), and SetCustomsOffice().


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