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

#include "SystemBubble.h"

Collaboration diagram for SystemBubble:

Public Member Functions

 SystemBubble (SystemManager *pSystem, const GPoint &center, double radius)
 
 ~SystemBubble () noexcept
 
SystemEntity *const GetEntity (uint32 entityID) const
 
SystemManager *const GetSystem () const
 
void Process ()
 
void SetBelt (InventoryItemRef itemRef)
 
void SetGate (uint32 gateID)
 
void ResetBubbleRatSpawn ()
 
bool IsIce ()
 
bool IsBelt ()
 
bool IsGate ()
 
bool IsAnomaly ()
 
bool IsMission ()
 
bool IsIncursion ()
 
bool IsSpawned ()
 
void SetAnomaly (bool set=true)
 
void SetMission (bool set=true)
 
void SetIncursion (bool set=true)
 
void SetSpawned (bool set=true)
 
void SetSpawnTimer (bool isBelt=false)
 
uint32 CountNPCs ()
 
uint32 CountPlayers ()
 
uint32 CountDynamics ()
 
bool IsEmpty () const
 
bool HasPlayers () const
 
bool HasStatics () const
 
bool HasDynamics () const
 
double x () const
 
double y () const
 
double z () const
 
uint16 GetID ()
 
uint32 GetSystemID ()
 
GPoint GetCenter ()
 
ContainerSEGetCenterMarker ()
 
void clear ()
 
void PrintEntityList ()
 
void Add (SystemEntity *pSE)
 
void Remove (SystemEntity *pSE)
 
void ProcessWander (std::vector< SystemEntity * > &wanderers)
 
void SendAddBalls (SystemEntity *to_who)
 
void SendAddBalls2 (SystemEntity *to_who)
 
void RemoveExclusive (SystemEntity *pSE)
 
void AddBallExclusive (SystemEntity *about_who)
 
void BubblecastDestiny (std::vector< PyTuple * > &updates, std::vector< PyTuple * > &events, const char *desc) const
 
void BubblecastDestinyUpdate (std::vector< PyTuple * > &updates, const char *desc) const
 
void BubblecastDestinyEvent (std::vector< PyTuple * > &events, const char *desc) const
 
void BubblecastDestinyUpdate (PyTuple **payload, const char *desc) const
 
void BubblecastDestinyEvent (PyTuple **payload, const char *desc) const
 
void BubblecastSendNotification (const char *notifyType, const char *idType, PyTuple **payload, bool seq=true)
 
void BubblecastDestinyUpdateExclusive (PyTuple **payload, const char *desc, SystemEntity *pSE) const
 
bool InBubble (const GPoint &pt, bool inWarp=false) const
 
bool IsOverlap (const GPoint &pt) const
 
void MarkCenter ()
 
void RemoveMarkers ()
 
bool HasWarpBubble ()
 
void SetWarpBubble (bool set=false)
 
void GetEntities (std::map< uint32, SystemEntity * > &into) const
 
void GetAllEntities (std::map< uint32, SystemEntity * > &into) const
 
void GetPlayers (std::vector< Client * > &into) const
 
void GetEntityVec (std::vector< SystemEntity * > &into) const
 
SystemEntityGetRandomEntity ()
 
bool HasTower ()
 
TowerSEGetTowerSE ()
 
void SetTowerSE (TowerSE *pTower)
 
bool HasTCU ()
 
TCUSEGetTCUSE ()
 
void SetTCUSE (TCUSE *pTCU)
 
bool HasSBU ()
 
SBUSEGetSBUSE ()
 
void SetSBUSE (SBUSE *pSBU)
 
bool HasIHub ()
 
IHubSEGetIHubSE ()
 
void SetIHubSE (IHubSE *pIHub)
 
PyObjectGetDroneState () const
 
void SyncPos ()
 
void CmdDropLoot ()
 

Protected Member Functions

void RemoveBall (SystemEntity *about_who)
 
void RemoveBalls (SystemEntity *to_who)
 
void RemoveBallExclusive (SystemEntity *about_who)
 
void MarkBubble (const GPoint &position, std::string &name, std::string &desc, bool center=false)
 

Protected Attributes

const GPoint m_center
 
const double m_radius
 

Private Attributes

TCUSEm_tcuSE
 
SBUSEm_sbuSE
 
IHubSEm_ihubSE
 
TowerSEm_towerSE
 
SystemManagerm_system
 
ContainerSEm_centerSE
 
bool m_hasMarkers:1
 
bool m_hasBubble:1
 
uint16 m_bubbleID
 
uint32 m_systemID
 
std::map< uint32, Client * > m_players
 
std::map< uint32, SystemEntity * > m_markers
 
std::map< uint32, SystemEntity * > m_dynamicEntities
 
std::map< uint32, SystemEntity * > m_entities
 
std::map< uint32, DroneSE * > m_drones
 
Timer m_spawnTimer
 
bool m_ice:1
 
bool m_belt:1
 
bool m_gate:1
 
bool m_anomaly:1
 
bool m_mission:1
 
bool m_incursion:1
 
bool m_spawned:1
 

Detailed Description

Definition at line 49 of file SystemBubble.h.

Constructor & Destructor Documentation

SystemBubble::SystemBubble ( SystemManager pSystem,
const GPoint center,
double  radius 
)

Definition at line 45 of file SystemBubble.cpp.

References _log, SystemManager::GetID(), m_anomaly, m_belt, m_bubbleID, m_center, m_dynamicEntities, m_entities, m_gate, m_hasBubble, m_hasMarkers, m_ice, m_incursion, m_markers, m_mission, m_players, m_radius, m_spawned, m_systemID, sBubbleMgr, Ga::GaVec3::x, Ga::GaVec3::y, and Ga::GaVec3::z.

46 : m_system(pSystem),
47 m_center(center),
48 m_radius(radius),
49 m_tcuSE(nullptr),
50 m_sbuSE(nullptr),
51 m_ihubSE(nullptr),
52 m_towerSE(nullptr),
53 m_centerSE(nullptr),
54 m_spawnTimer(0)
55 {
56  m_ice = false;
57  m_belt = false;
58  m_gate = false;
59  m_anomaly = false;
60  m_mission = false;
61  m_spawned = false;
62  m_incursion = false;
63  m_hasBubble = false;
64  m_hasMarkers = false;
65 
66  m_markers.clear();
67  m_players.clear();
68  m_entities.clear();
69  m_dynamicEntities.clear();
70 
71  m_systemID = pSystem->GetID();
72  m_bubbleID = sBubbleMgr.GetBubbleID();
73 
74  _log(DESTINY__BUBBLE_TRACE, "SystemBubble::Constructor - Created new bubble %u(%p) at (%.2f,%.2f,%.2f)[%.1f].",\
76 }
const GPoint m_center
Definition: SystemBubble.h:167
TowerSE * m_towerSE
Definition: SystemBubble.h:182
std::map< uint32, SystemEntity * > m_dynamicEntities
Definition: SystemBubble.h:194
uint16 m_bubbleID
Definition: SystemBubble.h:189
std::map< uint32, SystemEntity * > m_markers
Definition: SystemBubble.h:193
#define _log(type, fmt,...)
Definition: logsys.h:124
const double m_radius
Definition: SystemBubble.h:168
uint32 GetID() const
Definition: SystemManager.h:80
SBUSE * m_sbuSE
Definition: SystemBubble.h:180
GaFloat x
Definition: GaTypes.h:207
TCUSE * m_tcuSE
Definition: SystemBubble.h:179
Timer m_spawnTimer
Definition: SystemBubble.h:199
IHubSE * m_ihubSE
Definition: SystemBubble.h:181
std::map< uint32, Client * > m_players
Definition: SystemBubble.h:192
GaFloat y
Definition: GaTypes.h:207
uint32 m_systemID
Definition: SystemBubble.h:190
std::map< uint32, SystemEntity * > m_entities
Definition: SystemBubble.h:195
ContainerSE * m_centerSE
Definition: SystemBubble.h:184
SystemManager * m_system
Definition: SystemBubble.h:183
#define sBubbleMgr
GaFloat z
Definition: GaTypes.h:207

Here is the call graph for this function:

SystemBubble::~SystemBubble ( )
noexcept

Definition at line 78 of file SystemBubble.cpp.

References m_hasMarkers, m_markers, and SafeDelete().

79 {
80  if (m_hasMarkers)
81  for (auto cur : m_markers) {
82  cur.second->Delete(); // delete marker cans here
83  SafeDelete(cur.second);
84  }
85 }
std::map< uint32, SystemEntity * > m_markers
Definition: SystemBubble.h:193
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83

Here is the call graph for this function:

Member Function Documentation

void SystemBubble::Add ( SystemEntity pSE)

Definition at line 186 of file SystemBubble.cpp.

References _log, AddBallExclusive(), BeltMgr::CheckSpawn(), Ga::GaVec3::distance(), Timer::Enabled(), SystemManager::GetBeltMgr(), SystemEntity::GetDroneSE(), SystemEntity::GetID(), SystemEntity::GetName(), SystemEntity::GetPilot(), SystemEntity::GetPosition(), SystemEntity::HasPilot(), is_log_enabled, SystemEntity::IsDroneSE(), SystemEntity::isGlobal(), SystemEntity::IsStaticEntity(), m_belt, SystemEntity::m_bubble, m_bubbleID, m_center, m_drones, m_dynamicEntities, m_entities, m_gate, m_players, m_spawnTimer, m_system, NULL_ORIGIN(), ONE_AU_IN_METERS, sConfig, SendAddBalls(), and SetSpawnTimer().

Referenced by BubbleManager::Add(), and DestinyManager::WarpUpdate().

187 {
188  //if they are already in this bubble, do not continue.
189  if (m_entities.find(pSE->GetID()) != m_entities.end()) {
190  _log(DESTINY__BUBBLE_TRACE, "SystemBubble::Add() - Tried to add Static Entity %u to bubble %u, but it is already in here.",\
191  pSE->GetID(), m_bubbleID);
192  return;
193  }
194 
195  pSE->m_bubble = this;
196  // global entities also in SystemMgr's static list. this is used for SystemBubble->IsEmpty() deletion check
197  if (pSE->IsStaticEntity() or pSE->isGlobal()) {
198  _log(DESTINY__BUBBLE_TRACE, "SystemBubble::Add() - Entity %s(%u) is static or global or both.", pSE->GetName(), pSE->GetID() );
199  // all static and global entities (stations, gates, asteroid fields, cyno fields, etc) are put into bubble's staticEntity map
200  m_entities[pSE->GetID()] = pSE;
201  return;
202  }
203 
204  //if they are already in this bubble, do not continue.
205  if (m_dynamicEntities.find(pSE->GetID()) != m_dynamicEntities.end()) {
206  _log(DESTINY__BUBBLE_TRACE, "SystemBubble::Add() - Tried to add Dynamic Entity %u to bubble %u, but it is already in here.",\
207  pSE->GetID(), m_bubbleID);
208  return;
209  }
210 
211  _log(DESTINY__BUBBLE_TRACE, "SystemBubble::Add() - Adding entity %u to bubble %u. Dist to center: %.2f", \
212  pSE->GetID(), m_bubbleID, m_center.distance(pSE->GetPosition()));
213 
214  if (is_log_enabled(DESTINY__BUBBLE_DEBUG)) {
215  GPoint startPoint( pSE->GetPosition() );
216  GVector direction(startPoint, NULL_ORIGIN);
217  double rangeToStar = direction.length();
218  rangeToStar /= ONE_AU_IN_METERS;
219  _log(DESTINY__BUBBLE_DEBUG, "SystemBubble::Add() - Distance to Star %.2f AU. %u/%u Entities in bubble %u",\
220  rangeToStar, m_entities.size(), m_dynamicEntities.size(), m_bubbleID);
221  //if (sConfig.debug.StackTrace)
222  // EvE::traceStack();
223  }
224 
225  if (pSE->HasPilot()) {
226  // Set spawn timer for this bubble, if needed
227  if (m_belt) {
228  // check for roids and load/spawn as needed.
230  if (sConfig.npc.RoamingSpawns)
231  if (!m_spawnTimer.Enabled())
232  SetSpawnTimer(true);
233  }
234  if (m_gate and sConfig.npc.StaticSpawns)
235  if (!m_spawnTimer.Enabled())
236  SetSpawnTimer(false);
237 
238  Client* pClient(pSE->GetPilot());
239  SendAddBalls( pSE );
240  if (!m_players.empty())
241  AddBallExclusive(pSE); // adds new player to all players in bubble, if any
242 
243  m_players[pClient->GetCharacterID()] = pClient; //add to bubble's player list
244  } else {
245  if (!m_players.empty())
246  AddBallExclusive(pSE);
247  if (pSE->IsDroneSE())
248  m_drones[pSE->GetID()] = pSE->GetDroneSE();
249  }
250 
251  // all non-global entities (players, npcs, roids, containers, etc) are put into bubble's dynamicEntity map
252  m_dynamicEntities[pSE->GetID()] = pSE;
253 }
#define sConfig
A macro for easier access to the singleton.
virtual DroneSE * GetDroneSE()
Definition: SystemEntity.h:135
const GPoint m_center
Definition: SystemBubble.h:167
std::map< uint32, SystemEntity * > m_dynamicEntities
Definition: SystemBubble.h:194
uint16 m_bubbleID
Definition: SystemBubble.h:189
void AddBallExclusive(SystemEntity *about_who)
#define _log(type, fmt,...)
Definition: logsys.h:124
void SendAddBalls(SystemEntity *to_who)
virtual bool HasPilot()
Definition: SystemEntity.h:258
virtual Client * GetPilot()
Definition: SystemEntity.h:259
SystemBubble * m_bubble
Definition: SystemEntity.h:262
std::map< uint32, DroneSE * > m_drones
Definition: SystemBubble.h:196
const GPoint & GetPosition() const
Definition: SystemEntity.h:211
#define is_log_enabled(type)
Definition: logsys.h:78
Definition: gpoint.h:33
bool Enabled() const
Definition: timer.h:41
static const GPoint NULL_ORIGIN(0, 0, 0)
Timer m_spawnTimer
Definition: SystemBubble.h:199
BeltMgr * GetBeltMgr()
void SetSpawnTimer(bool isBelt=false)
uint32 GetID()
Definition: SystemEntity.h:207
std::map< uint32, Client * > m_players
Definition: SystemBubble.h:192
const char * GetName() const
Definition: SystemEntity.h:210
Definition: Client.h:66
virtual bool isGlobal()
Definition: SystemEntity.h:142
std::map< uint32, SystemEntity * > m_entities
Definition: SystemBubble.h:195
SystemManager * m_system
Definition: SystemBubble.h:183
Definition: gpoint.h:70
GaExpInl GaFloat distance(const GaVec3 &oth) const
Definition: GaTypes.h:158
virtual bool IsStaticEntity()
Definition: SystemEntity.h:146
virtual bool IsDroneSE()
Definition: SystemEntity.h:187
static const int64 ONE_AU_IN_METERS
Definition: EVE_Consts.h:40
void CheckSpawn(uint16 bubbleID)
Definition: BeltMgr.cpp:82

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemBubble::AddBallExclusive ( SystemEntity about_who)

Definition at line 637 of file SystemBubble.cpp.

References _log, Buffer::Append(), BubblecastDestinyUpdateExclusive(), SystemEntity::DestinyMgr(), Destiny::DumpUpdate(), SystemEntity::EncodeDestiny(), SystemEntity::GetID(), is_log_enabled, DestinyManager::IsCloaked(), SystemManager::IsLoaded(), m_bubbleID, m_system, SystemEntity::MakeDamageState(), SystemEntity::MakeSlimItem(), Destiny::AddBall_header::packet_type, PySafeDecRef, sEntityList, and Destiny::AddBall_header::stamp.

Referenced by Add(), and DestinyManager::UnCloak().

637  {
638  if (!m_system->IsLoaded())
639  return;
640  if (pSE->DestinyMgr() != nullptr)
641  if (pSE->DestinyMgr()->IsCloaked())
642  return;
643 
644  Buffer* destinyBuffer = new Buffer();
645 
646  //create AddBalls header
648  head.packet_type = 1; // 0 = full state 1 = balls
649  head.stamp = sEntityList.GetStamp();
650  destinyBuffer->Append( head );
651 
652  AddBalls addballs;
653  //encode destiny binary
654  pSE->EncodeDestiny( *destinyBuffer );
655  addballs.state = new PyBuffer( &destinyBuffer );
656  //encode damage state
657  addballs.damageDict[ pSE->GetID() ] = pSE->MakeDamageState();
658  //encode SlimItem
659  addballs.slims = new PyList();
660  addballs.slims->AddItem( new PyObject( "foo.SlimItem", pSE->MakeSlimItem() ) );
661 
662  _log(DESTINY__BUBBLE_TRACE, "SystemBubble::AddBallExclusive() - Adding entity %u to bubble %u", pSE->GetID(), m_bubbleID);
663  if (is_log_enabled(DESTINY__BALL_DUMP))
664  addballs.Dump( DESTINY__BALL_DUMP, " " );
665  _log( DESTINY__BALL_DECODE, " Ball Decoded:" );
666  if (is_log_enabled(DESTINY__BALL_DECODE))
667  Destiny::DumpUpdate( DESTINY__BALL_DECODE, &( addballs.state->content() )[0], (uint32)addballs.state->content().size() );
668  //bubblecast the update
669  PyTuple* t = addballs.Encode();
670  BubblecastDestinyUpdateExclusive( &t, "AddBall", pSE );
671  PySafeDecRef( t );
672 }
void Append(const T &value)
Appends a single value to buffer.
Definition: Buffer.h:437
uint16 m_bubbleID
Definition: SystemBubble.h:189
void BubblecastDestinyUpdateExclusive(PyTuple **payload, const char *desc, SystemEntity *pSE) const
#define _log(type, fmt,...)
Definition: logsys.h:124
#define sEntityList
Definition: EntityList.h:208
Python tuple.
Definition: PyRep.h:567
#define is_log_enabled(type)
Definition: logsys.h:78
Generic class for buffers.
Definition: Buffer.h:40
Python object.
Definition: PyRep.h:826
unsigned __int32 uint32
Definition: eve-compat.h:50
void DumpUpdate(LogType into, const uint8 *data, uint32 len)
#define PySafeDecRef(op)
Definition: PyRep.h:61
SystemManager * m_system
Definition: SystemBubble.h:183
Python buffer.
Definition: PyRep.h:382
entityID heal the character with the entityID note giving you detailed ship status information gives a list of all dynamic entities and players and their destinyState in this bubble shows some current destiny variables save all kick all and halt server immediate command list all items in current location s gives list of cargo contents and volumes in all holds list current session values show current ship DNA show current objects in their destiny state
Python list.
Definition: PyRep.h:639

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemBubble::BubblecastDestiny ( std::vector< PyTuple * > &  updates,
std::vector< PyTuple * > &  events,
const char *  desc 
) const

Definition at line 924 of file SystemBubble.cpp.

References BubblecastDestinyEvent(), BubblecastDestinyUpdate(), and m_players.

Referenced by DestinyManager::SendDestinyUpdate().

924  {
925  if (m_players.empty())
926  return;
927 
928  BubblecastDestinyUpdate(updates, desc);
929  BubblecastDestinyEvent(events, desc);
930 }
void BubblecastDestinyEvent(std::vector< PyTuple * > &events, const char *desc) const
std::map< uint32, Client * > m_players
Definition: SystemBubble.h:192
void BubblecastDestinyUpdate(std::vector< PyTuple * > &updates, const char *desc) const

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemBubble::BubblecastDestinyEvent ( std::vector< PyTuple * > &  events,
const char *  desc 
) const

Definition at line 939 of file SystemBubble.cpp.

Referenced by BubblecastDestiny(), and ActiveModule::ShowEffect().

939  {
940  for (std::vector<PyTuple *>::iterator cur = events.begin(); cur != events.end(); ++cur)
941  BubblecastDestinyEvent(&(*cur), desc);
942 
943  events.clear();
944 }
void BubblecastDestinyEvent(std::vector< PyTuple * > &events, const char *desc) const

Here is the caller graph for this function:

void SystemBubble::BubblecastDestinyEvent ( PyTuple **  payload,
const char *  desc 
) const

Definition at line 970 of file SystemBubble.cpp.

References _log, is_log_enabled, m_players, and PyIncRef.

971 {
972  if (is_log_enabled(DESTINY__BUBBLECAST_DUMP))
973  (*payload)->Dump(DESTINY__BUBBLECAST_DUMP, " ");
974  for (auto cur : m_players) {
975  _log( DESTINY__BUBBLECAST, "Bubblecast %s event to %s(%u)", desc, cur.second->GetName(), cur.first );
976  PyIncRef(*payload);
977  cur.second->QueueDestinyEvent(payload);
978  }
979 }
#define _log(type, fmt,...)
Definition: logsys.h:124
#define is_log_enabled(type)
Definition: logsys.h:78
std::map< uint32, Client * > m_players
Definition: SystemBubble.h:192
#define PyIncRef(op)
Definition: PyRep.h:56
void SystemBubble::BubblecastDestinyUpdate ( std::vector< PyTuple * > &  updates,
const char *  desc 
) const

Definition at line 932 of file SystemBubble.cpp.

Referenced by BubblecastDestiny(), WreckContainer::MakeSlimItemChange(), RemoveBall(), and DroneSE::StateChange().

932  {
933  for (std::vector<PyTuple *>::iterator cur = updates.begin(); cur != updates.end(); ++cur)
934  BubblecastDestinyUpdate(&(*cur), desc);
935 
936  updates.clear();
937 }
void BubblecastDestinyUpdate(std::vector< PyTuple * > &updates, const char *desc) const

Here is the caller graph for this function:

void SystemBubble::BubblecastDestinyUpdate ( PyTuple **  payload,
const char *  desc 
) const

Definition at line 946 of file SystemBubble.cpp.

References _log, is_log_enabled, m_players, and PyIncRef.

947 {
948  if (is_log_enabled(DESTINY__BUBBLECAST_DUMP))
949  (*payload)->Dump(DESTINY__BUBBLECAST_DUMP, " ");
950  for (auto cur : m_players) {
951  _log( DESTINY__BUBBLECAST, "Bubblecast %s update to %s(%u)", desc, cur.second->GetName(), cur.first );
952  PyIncRef(*payload);
953  cur.second->QueueDestinyUpdate(payload);
954  }
955 }
#define _log(type, fmt,...)
Definition: logsys.h:124
#define is_log_enabled(type)
Definition: logsys.h:78
std::map< uint32, Client * > m_players
Definition: SystemBubble.h:192
#define PyIncRef(op)
Definition: PyRep.h:56
void SystemBubble::BubblecastDestinyUpdateExclusive ( PyTuple **  payload,
const char *  desc,
SystemEntity pSE 
) const

Definition at line 957 of file SystemBubble.cpp.

References _log, m_players, and PyIncRef.

Referenced by AddBallExclusive(), and RemoveBallExclusive().

958 {
959  for (auto cur : m_players) {
960  // Only queue a Destiny update for this bubble if the current SystemEntity is not 'pSE':
961  // (this is an update to all client objects in the bubble EXCLUDING 'pSE')
962  if (cur.second->GetShipSE() != pSE) {
963  _log( DESTINY__BUBBLECAST, "Exclusive Bubblecast %s update to %s(%u)", desc, cur.second->GetName(), cur.first );
964  PyIncRef(*payload);
965  cur.second->QueueDestinyUpdate(payload);
966  }
967  }
968 }
#define _log(type, fmt,...)
Definition: logsys.h:124
std::map< uint32, Client * > m_players
Definition: SystemBubble.h:192
#define PyIncRef(op)
Definition: PyRep.h:56

Here is the caller graph for this function:

void SystemBubble::BubblecastSendNotification ( const char *  notifyType,
const char *  idType,
PyTuple **  payload,
bool  seq = true 
)

Definition at line 981 of file SystemBubble.cpp.

References _log, m_players, and PyIncRef.

Referenced by InventoryItem::Rename().

982 {
983  for (auto cur : m_players) {
984  _log( DESTINY__BUBBLECAST, "BubblecastNotify %s to %s(%u)", notifyType, cur.second->GetName(), cur.first );
985  PyIncRef(*payload);
986  cur.second->SendNotification( notifyType, idType, payload, seq );
987  }
988 }
#define _log(type, fmt,...)
Definition: logsys.h:124
std::map< uint32, Client * > m_players
Definition: SystemBubble.h:192
#define PyIncRef(op)
Definition: PyRep.h:56

Here is the caller graph for this function:

void SystemBubble::clear ( )

Definition at line 87 of file SystemBubble.cpp.

References m_anomaly, m_belt, m_dynamicEntities, m_entities, m_gate, m_hasBubble, m_hasMarkers, m_ice, m_incursion, m_markers, m_mission, m_players, m_spawned, and SafeDelete().

87  {
88  if (m_hasMarkers)
89  for (auto cur : m_markers) {
90  cur.second->Delete(); // delete marker cans here
91  SafeDelete(cur.second);
92  }
93 
94  m_ice = false;
95  m_belt = false;
96  m_gate = false;
97  m_anomaly = false;
98  m_mission = false;
99  m_spawned = false;
100  m_incursion = false;
101  m_hasBubble = false;
102  m_hasMarkers = false;
103 
104  m_markers.clear();
105  m_players.clear();
106  m_entities.clear();
107  m_dynamicEntities.clear();
108 }
std::map< uint32, SystemEntity * > m_dynamicEntities
Definition: SystemBubble.h:194
std::map< uint32, SystemEntity * > m_markers
Definition: SystemBubble.h:193
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
std::map< uint32, Client * > m_players
Definition: SystemBubble.h:192
std::map< uint32, SystemEntity * > m_entities
Definition: SystemBubble.h:195

Here is the call graph for this function:

void SystemBubble::CmdDropLoot ( )

Definition at line 797 of file SystemBubble.cpp.

References m_dynamicEntities.

798 {
799  for (auto dse : m_dynamicEntities) {
800  if (dse.second->IsNPCSE())
801  dse.second->GetNPCSE()->CmdDropLoot();
802  }
803 }
std::map< uint32, SystemEntity * > m_dynamicEntities
Definition: SystemBubble.h:194
uint32 SystemBubble::CountDynamics ( )
inline

Definition at line 81 of file SystemBubble.h.

References m_dynamicEntities.

Referenced by Command_bubblelist().

81 { return m_dynamicEntities.size(); }
std::map< uint32, SystemEntity * > m_dynamicEntities
Definition: SystemBubble.h:194

Here is the caller graph for this function:

uint32 SystemBubble::CountNPCs ( )

Definition at line 417 of file SystemBubble.cpp.

References m_dynamicEntities.

Referenced by Command_bubblelist(), SpawnMgr::MoveSpawn(), and SpawnMgr::SpawnKilled().

417  {
418  uint32 count = 0;
419  for (auto cur : m_dynamicEntities)
420  if (cur.second->IsNPCSE())
421  ++count;
422 
423  return count;
424 }
std::map< uint32, SystemEntity * > m_dynamicEntities
Definition: SystemBubble.h:194
unsigned __int32 uint32
Definition: eve-compat.h:50

Here is the caller graph for this function:

uint32 SystemBubble::CountPlayers ( )
inline

Definition at line 80 of file SystemBubble.h.

References m_players.

Referenced by Command_bubblelist().

80 { return m_players.size(); }
std::map< uint32, Client * > m_players
Definition: SystemBubble.h:192

Here is the caller graph for this function:

void SystemBubble::GetAllEntities ( std::map< uint32, SystemEntity * > &  into) const

Definition at line 368 of file SystemBubble.cpp.

References m_dynamicEntities.

369 {
370  if (m_dynamicEntities.empty())
371  return;
372 
373  for (auto cur : m_dynamicEntities)
374  into.emplace(cur.first, cur.second);
375 }
std::map< uint32, SystemEntity * > m_dynamicEntities
Definition: SystemBubble.h:194
GPoint SystemBubble::GetCenter ( )
inline

Definition at line 93 of file SystemBubble.h.

References m_center.

Referenced by SpawnMgr::MakeSpawn(), SpawnMgr::ReSpawn(), SystemManager::SendStaticBall(), BeltMgr::SpawnBelt(), SpawnMgr::WarpOutSpawn(), and DestinyManager::WarpUpdate().

93 { return m_center; }
const GPoint m_center
Definition: SystemBubble.h:167

Here is the caller graph for this function:

ContainerSE* SystemBubble::GetCenterMarker ( )
inline

Definition at line 94 of file SystemBubble.h.

References m_centerSE.

94 { return m_centerSE; }
ContainerSE * m_centerSE
Definition: SystemBubble.h:184
PyObject * SystemBubble::GetDroneState ( ) const

Definition at line 752 of file SystemBubble.cpp.

References PyList::AddItem(), m_drones, PyList::SetItem(), PyList::SetItemString(), and PyDict::SetItemString().

Referenced by SystemManager::MakeSetState().

753 {
754  PyList* header = new PyList(7);
755  header->SetItemString(0, "droneID");
756  header->SetItemString(1, "ownerID");
757  header->SetItemString(2, "controllerID");
758  header->SetItemString(3, "activityState");
759  header->SetItemString(4, "typeID");
760  header->SetItemString(5, "controllerOwnerID");
761  header->SetItemString(6, "targetID");
762  PyList* lines = new PyList();
763  for (auto cur : m_drones) {
764  PyList* line = new PyList(7);
765  line->SetItem(0, new PyInt(cur.first));
766  line->SetItem(1, new PyInt(cur.second->GetOwnerID()));
767  line->SetItem(2, new PyInt(cur.second->GetControllerID()));
768  line->SetItem(3, new PyInt(cur.second->GetState()));
769  line->SetItem(4, new PyInt(cur.second->GetSelf()->typeID()));
770  line->SetItem(5, new PyInt(cur.second->GetControllerOwnerID()));
771  line->SetItem(6, new PyInt(cur.second->GetTargetID()));
772  lines->AddItem(line);
773  }
774 
775  PyDict* dict = new PyDict();
776  dict->SetItemString("header", header);
777  dict->SetItemString("RowClass", new PyToken("util.Row"));
778  dict->SetItemString("lines", lines);
779 
780  return new PyObject("util.Rowset", dict);
781 }
Python's dictionary.
Definition: PyRep.h:719
void SetItemString(size_t index, const char *str)
Stores Python string.
Definition: PyRep.h:699
std::map< uint32, DroneSE * > m_drones
Definition: SystemBubble.h:196
void AddItem(PyRep *i)
Definition: PyRep.h:701
Python object.
Definition: PyRep.h:826
Python integer.
Definition: PyRep.h:231
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:682
Python token (eg. class name).
Definition: PyRep.h:522
Python list.
Definition: PyRep.h:639
void SetItemString(const char *key, PyRep *value)
SetItemString adds or sets a database entry.
Definition: PyRep.h:812

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemBubble::GetEntities ( std::map< uint32, SystemEntity * > &  into) const

Definition at line 351 of file SystemBubble.cpp.

References m_dynamicEntities.

Referenced by Command_bubblelist(), Command_killallnpcs(), Command_unspawn(), and SystemManager::MakeSetState().

351  {
352  /* updated to send non-cloaked dynamic entities to the following: -allan 14Feb15
353  * SystemManager::MakeSetState() --for player entering new system
354  * Command_killallnpcs() --GM command
355  * StructureSE::InitData() --Get TowerSE for pos items
356  */
357  if (m_dynamicEntities.empty())
358  return;
359 
360  for (auto cur : m_dynamicEntities) {
361  if (cur.second->DestinyMgr() != nullptr)
362  if (cur.second->DestinyMgr()->IsCloaked())
363  continue;
364  into.emplace(cur.first, cur.second);
365  }
366 }
std::map< uint32, SystemEntity * > m_dynamicEntities
Definition: SystemBubble.h:194

Here is the caller graph for this function:

SystemEntity *const SystemBubble::GetEntity ( uint32  entityID) const

Definition at line 340 of file SystemBubble.cpp.

References m_dynamicEntities.

340  {
341  /* updated to send ONLY dynamic entities to the following: -allan 17Apr15
342  * ModuleManager::Activate() --for module activation (with a target)
343  */
344  std::map<uint32, SystemEntity*>::const_iterator itr = m_dynamicEntities.find(entityID);
345  if (itr != m_dynamicEntities.end())
346  return itr->second;
347 
348  return nullptr;
349 }
std::map< uint32, SystemEntity * > m_dynamicEntities
Definition: SystemBubble.h:194
void SystemBubble::GetEntityVec ( std::vector< SystemEntity * > &  into) const

Definition at line 378 of file SystemBubble.cpp.

References m_dynamicEntities, and m_players.

379 {
380  if (m_players.empty())
381  return;
382 
383  for (auto cur : m_dynamicEntities)
384  into.push_back(cur.second);
385 }
std::map< uint32, SystemEntity * > m_dynamicEntities
Definition: SystemBubble.h:194
std::map< uint32, Client * > m_players
Definition: SystemBubble.h:192
IHubSE* SystemBubble::GetIHubSE ( )
inline

Definition at line 155 of file SystemBubble.h.

References m_ihubSE.

155 { return m_ihubSE; }
IHubSE * m_ihubSE
Definition: SystemBubble.h:181
void SystemBubble::GetPlayers ( std::vector< Client * > &  into) const

Definition at line 387 of file SystemBubble.cpp.

References m_players.

Referenced by DestinyManager::CheckBump(), SentryAI::Process(), and NPCAIMgr::Process().

387  {
388  /* updated to send ONLY players to the following: -allan 14Feb15
389  * NPCAIMgr::Process() --for npc targeting
390  * SpawnEntry::Process() --for npc spawning
391  *
392  * this will also send player drones once that system is completed
393  */
394  into.clear();
395  if (m_players.empty())
396  return;
397 
398  for (auto cur : m_players)
399  into.push_back(cur.second);
400 }
std::map< uint32, Client * > m_players
Definition: SystemBubble.h:192

Here is the caller graph for this function:

SystemEntity * SystemBubble::GetRandomEntity ( )

Definition at line 402 of file SystemBubble.cpp.

References if(), and m_dynamicEntities.

Referenced by NPCAIMgr::SetWander().

403 {
404  // this is used for idle npc's as a orbit target while waiting for something to pewpew
405  if (m_dynamicEntities.empty())
406  return nullptr;
407 
408  for (auto cur : m_dynamicEntities) {
409  if (cur.second->IsWreckSE())
410  return cur.second;
411  if (cur.second->IsObjectEntity())
412  return cur.second;
413  }
414  return nullptr;
415 }
std::map< uint32, SystemEntity * > m_dynamicEntities
Definition: SystemBubble.h:194
if(sConfig.world.saveOnMove)

Here is the call graph for this function:

Here is the caller graph for this function:

SBUSE* SystemBubble::GetSBUSE ( )
inline

Definition at line 151 of file SystemBubble.h.

References m_sbuSE.

151 { return m_sbuSE; }
SBUSE * m_sbuSE
Definition: SystemBubble.h:180
SystemManager* const SystemBubble::GetSystem ( ) const
inline

Definition at line 55 of file SystemBubble.h.

References m_system.

55 { return m_system; }
SystemManager * m_system
Definition: SystemBubble.h:183
uint32 SystemBubble::GetSystemID ( )
inline

Definition at line 92 of file SystemBubble.h.

References m_systemID.

Referenced by BubbleManager::Add().

92 { return m_systemID; }
uint32 m_systemID
Definition: SystemBubble.h:190

Here is the caller graph for this function:

TCUSE* SystemBubble::GetTCUSE ( )
inline

Definition at line 147 of file SystemBubble.h.

References m_tcuSE.

147 { return m_tcuSE; }
TCUSE * m_tcuSE
Definition: SystemBubble.h:179
TowerSE* SystemBubble::GetTowerSE ( )
inline

Definition at line 142 of file SystemBubble.h.

References m_towerSE.

Referenced by Client::Board(), CynoModule::CanActivate(), Client::Eject(), and StructureSE::InitData().

142 { return m_towerSE; }
TowerSE * m_towerSE
Definition: SystemBubble.h:182

Here is the caller graph for this function:

bool SystemBubble::HasDynamics ( ) const
inline

Definition at line 87 of file SystemBubble.h.

References m_dynamicEntities.

Referenced by NPCAIMgr::SetWander().

87 { return !m_dynamicEntities.empty(); }
std::map< uint32, SystemEntity * > m_dynamicEntities
Definition: SystemBubble.h:194

Here is the caller graph for this function:

bool SystemBubble::HasIHub ( )
inline

Definition at line 154 of file SystemBubble.h.

References m_ihubSE.

154 { return (m_ihubSE != nullptr); }
IHubSE * m_ihubSE
Definition: SystemBubble.h:181
bool SystemBubble::HasPlayers ( ) const
inline

Definition at line 85 of file SystemBubble.h.

References m_players.

Referenced by DestinyManager::MoveObject(), SentryAI::Process(), and ConcordAI::Process().

85 { return !m_players.empty(); }
std::map< uint32, Client * > m_players
Definition: SystemBubble.h:192

Here is the caller graph for this function:

bool SystemBubble::HasSBU ( )
inline

Definition at line 150 of file SystemBubble.h.

References m_sbuSE.

150 { return (m_sbuSE != nullptr); }
SBUSE * m_sbuSE
Definition: SystemBubble.h:180
bool SystemBubble::HasStatics ( ) const
inline

Definition at line 86 of file SystemBubble.h.

References m_entities.

86 { return !m_entities.empty(); }
std::map< uint32, SystemEntity * > m_entities
Definition: SystemBubble.h:195
bool SystemBubble::HasTCU ( )
inline

Definition at line 146 of file SystemBubble.h.

References m_tcuSE.

146 { return (m_tcuSE != nullptr); }
TCUSE * m_tcuSE
Definition: SystemBubble.h:179
bool SystemBubble::HasTower ( )
inline

Definition at line 141 of file SystemBubble.h.

References m_towerSE.

Referenced by Client::Board(), CynoModule::CanActivate(), Client::Eject(), and StructureSE::InitData().

141 { return (m_towerSE != nullptr); }
TowerSE * m_towerSE
Definition: SystemBubble.h:182

Here is the caller graph for this function:

bool SystemBubble::HasWarpBubble ( )
inline

Definition at line 128 of file SystemBubble.h.

References m_hasBubble.

Referenced by DestinyManager::WarpTo().

128 { return m_hasBubble; }

Here is the caller graph for this function:

bool SystemBubble::InBubble ( const GPoint pt,
bool  inWarp = false 
) const

Definition at line 426 of file SystemBubble.cpp.

References _log, Ga::GaVec3::distance(), is_log_enabled, m_bubbleID, m_center, m_radius, Ga::GaVec3::x, Ga::GaVec3::y, and Ga::GaVec3::z.

Referenced by BubbleManager::Add(), SentryAI::Attack(), DroneAIMgr::Attack(), NPCAIMgr::Attack(), ConcordAI::Attack(), BubbleManager::CheckBubble(), ProcessWander(), and DestinyManager::WarpUpdate().

427 {
428  if (is_log_enabled(DESTINY__BUBBLE_DEBUG)) {
429  float distance = m_center.distance(pt);
430  bool check = false;
431  if (distance < m_radius + 5000) // 5k is the grey area between bubbles
432  check = true;
433 
434  _log(DESTINY__BUBBLE_DEBUG, "SystemBubble::InBubble(%u) - center: %.1f,%.1f,%.1f - distance: %.1f, check: %s", \
435  m_center.x, m_center.y, m_center.z, m_bubbleID, distance, check?"true":"false");
436  return check;
437  }
438 
439  return (m_center.distance(pt) < m_radius);
440 }
const GPoint m_center
Definition: SystemBubble.h:167
uint16 m_bubbleID
Definition: SystemBubble.h:189
#define _log(type, fmt,...)
Definition: logsys.h:124
const double m_radius
Definition: SystemBubble.h:168
GaFloat x
Definition: GaTypes.h:207
#define is_log_enabled(type)
Definition: logsys.h:78
GaFloat y
Definition: GaTypes.h:207
GaExpInl GaFloat distance(const GaVec3 &oth) const
Definition: GaTypes.h:158
GaFloat z
Definition: GaTypes.h:207

Here is the call graph for this function:

Here is the caller graph for this function:

bool SystemBubble::IsAnomaly ( )
inline

Definition at line 66 of file SystemBubble.h.

References m_anomaly.

Referenced by NPCAIMgr::SetIdle(), NPCAIMgr::SetWander(), and SpawnMgr::SpawnKilled().

66 { return m_anomaly; }

Here is the caller graph for this function:

bool SystemBubble::IsBelt ( )
inline

Definition at line 64 of file SystemBubble.h.

References m_belt.

Referenced by ActiveModule::DeactivateCycle(), SpawnMgr::DoSpawnForBubble(), SpawnMgr::PrepSpawn(), SystemManager::RemoveSpawnBubble(), NPCAIMgr::SetWander(), and SpawnMgr::SpawnKilled().

64 { return m_belt; }

Here is the caller graph for this function:

bool SystemBubble::IsEmpty ( ) const
inline

Definition at line 84 of file SystemBubble.h.

References m_dynamicEntities, and m_entities.

84 { return (m_entities.empty() ? m_dynamicEntities.empty() : false); }
std::map< uint32, SystemEntity * > m_dynamicEntities
Definition: SystemBubble.h:194
std::map< uint32, SystemEntity * > m_entities
Definition: SystemBubble.h:195
bool SystemBubble::IsGate ( )
inline

Definition at line 65 of file SystemBubble.h.

References m_gate.

Referenced by SpawnMgr::DoSpawnForBubble(), SystemManager::DoSpawnForBubble(), SpawnMgr::PrepSpawn(), SystemManager::RemoveSpawnBubble(), and SpawnMgr::SpawnKilled().

65 { return m_gate; }

Here is the caller graph for this function:

bool SystemBubble::IsIce ( )
inline

Definition at line 63 of file SystemBubble.h.

References m_ice.

Referenced by ActiveModule::DeactivateCycle().

63 { return m_ice; }

Here is the caller graph for this function:

bool SystemBubble::IsIncursion ( )
inline

Definition at line 68 of file SystemBubble.h.

References m_incursion.

Referenced by NPCAIMgr::SetIdle(), NPCAIMgr::SetWander(), and SpawnMgr::SpawnKilled().

68 { return m_incursion; }

Here is the caller graph for this function:

bool SystemBubble::IsMission ( )
inline

Definition at line 67 of file SystemBubble.h.

References m_mission.

Referenced by NPCAIMgr::SetIdle(), NPCAIMgr::SetWander(), and SpawnMgr::SpawnKilled().

67 { return m_mission; }

Here is the caller graph for this function:

bool SystemBubble::IsOverlap ( const GPoint pt) const

Definition at line 442 of file SystemBubble.cpp.

References _log, Ga::GaVec3::distance(), is_log_enabled, m_bubbleID, m_center, m_radius, Ga::GaVec3::x, Ga::GaVec3::y, and Ga::GaVec3::z.

443 {
444  if (is_log_enabled(DESTINY__BUBBLE_DEBUG)) {
445  float distance = m_center.distance(pt);
446  bool check = false;
447  if (distance < m_radius * 2 + 10)
448  check = true;
449 
450  _log(DESTINY__BUBBLE_DEBUG, "SystemBubble::IsOverlap(%u) - center: %.1f,%.1f,%.1f - distance: %.1f, check: %s", \
451  m_center.x, m_center.y, m_center.z, m_bubbleID, distance, check?"true":"false");
452  return check;
453  }
454 
455  return (m_center.distance(pt) < (m_radius * 2));
456 }
const GPoint m_center
Definition: SystemBubble.h:167
uint16 m_bubbleID
Definition: SystemBubble.h:189
#define _log(type, fmt,...)
Definition: logsys.h:124
const double m_radius
Definition: SystemBubble.h:168
GaFloat x
Definition: GaTypes.h:207
#define is_log_enabled(type)
Definition: logsys.h:78
GaFloat y
Definition: GaTypes.h:207
GaExpInl GaFloat distance(const GaVec3 &oth) const
Definition: GaTypes.h:158
GaFloat z
Definition: GaTypes.h:207

Here is the call graph for this function:

bool SystemBubble::IsSpawned ( )
inline

Definition at line 69 of file SystemBubble.h.

References m_spawned.

69 { return m_spawned; }
void SystemBubble::MarkBubble ( const GPoint position,
std::string &  name,
std::string &  desc,
bool  center = false 
)
protected

Definition at line 895 of file SystemBubble.cpp.

References _log, SystemManager::AddEntity(), ContainerSE::AnchorContainer(), flagNone, SystemManager::GetServiceMgr(), m_centerSE, m_markers, m_system, m_systemID, ownerSystem, ContainerSE::SetGlobal(), InventoryItem::SpawnTemp(), and RefPtr< X >::StaticCast().

Referenced by MarkCenter().

896 {
897  // create new container item
898  ItemData idata(23, ownerSystem, m_systemID, flagNone, name.c_str(), position, desc.c_str());
900  if ( cRef.get() == nullptr) {
901  _log(DESTINY__WARNING, "MarkBubble() could not create Item for %s (%s)", name.c_str(), desc.c_str());
902  return;
903  }
904 
905  // create SE for item
906  FactionData jetcanData = FactionData();
907  ContainerSE* cSE = new ContainerSE( cRef, *(m_system->GetServiceMgr()), m_system, jetcanData);
908  if (cSE == nullptr) {
909  _log(DESTINY__WARNING, "MarkBubble() could not create SE for %s (%s)", name.c_str(), desc.c_str());
910  return;
911  }
912  cRef->SetMySE(cSE);
913  cSE->AnchorContainer();
914  if (center) {
915  // only setting centers as global
916  cSE->SetGlobal(true);
917  m_centerSE = cSE;
918  }
919  m_markers.emplace( cRef->itemID(), cSE);
920  m_system->AddEntity(cSE, center);
921 }
void SetGlobal(bool set=false)
Definition: Container.h:166
void AddEntity(SystemEntity *pSE, bool addSignal=true)
std::map< uint32, SystemEntity * > m_markers
Definition: SystemBubble.h:193
#define _log(type, fmt,...)
Definition: logsys.h:124
void AnchorContainer()
Definition: Container.cpp:305
static InventoryItemRef SpawnTemp(ItemData &data)
static RefPtr StaticCast(const RefPtr< Y > &oth)
Acts as static_cast from one RefPtr to another.
Definition: RefPtr.h:238
PyServiceMgr * GetServiceMgr()
Definition: SystemManager.h:88
uint32 m_systemID
Definition: SystemBubble.h:190
ContainerSE * m_centerSE
Definition: SystemBubble.h:184
SystemManager * m_system
Definition: SystemBubble.h:183
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:

void SystemBubble::MarkCenter ( )

Definition at line 820 of file SystemBubble.cpp.

References BUBBLE_RADIUS_METERS, SystemManager::IsLoaded(), m_bubbleID, m_center, m_hasMarkers, m_system, MarkBubble(), Ga::GaVec3::x, Ga::GaVec3::y, and Ga::GaVec3::z.

Referenced by Command_bubbletrack(), and BubbleManager::MakeBubble().

821 {
822  // we are not creating markers on system boot.
823  if (!m_system->IsLoaded())
824  return;
825  if (m_hasMarkers)
826  return;
827  // create jetcan to mark bubble center
828  std::string str = "Center Marker for Bubble #", desc = "Bubble Center"; //std::to_string(m_bubbleID);
829  str += std::to_string(m_bubbleID);
830  MarkBubble(m_center, str, desc, true);
831 
832  // create jetcan to mark bubble x
833  GPoint center = m_center;
834  center.x += BUBBLE_RADIUS_METERS - 5;
835  str.clear();
836  str = "Bubble #";
837  str += std::to_string(m_bubbleID);
838  str += " +X";
839  desc = "Bubble x";
840  MarkBubble(center, str, desc);
841 
842  // create jetcan to mark bubble -x
843  center = m_center;
844  center.x -= BUBBLE_RADIUS_METERS - 5;
845  str.clear();
846  str = "Bubble #";
847  str += std::to_string(m_bubbleID);
848  str += " -X";
849  desc = "Bubble -x";
850  MarkBubble(center, str, desc);
851 
852  // create jetcan to mark bubble y
853  center = m_center;
854  center.y += BUBBLE_RADIUS_METERS - 5;
855  str.clear();
856  str = "Bubble #";
857  str += std::to_string(m_bubbleID);
858  str += " +Y";
859  desc = "Bubble y";
860  MarkBubble(center, str, desc);
861 
862  // create jetcan to mark bubble -y
863  center = m_center;
864  center.y -= BUBBLE_RADIUS_METERS - 5;
865  str.clear();
866  str = "Bubble #";
867  str += std::to_string(m_bubbleID);
868  str += " -Y";
869  desc = "Bubble -y";
870  MarkBubble(center, str, desc);
871 
872  // create jetcan to mark bubble z
873  center = m_center;
874  center.z += BUBBLE_RADIUS_METERS - 5;
875  str.clear();
876  str = "Bubble #";
877  str += std::to_string(m_bubbleID);
878  str += " +Z";
879  desc = "Bubble z";
880  MarkBubble(center, str, desc);
881 
882  // create jetcan to mark bubble -z
883  center = m_center;
884  center.z -= BUBBLE_RADIUS_METERS - 5;
885  str.clear();
886  str = "Bubble #";
887  str += std::to_string(m_bubbleID);
888  str += " -Z";
889  desc = "Bubble -z";
890  MarkBubble(center, str, desc);
891 
892  m_hasMarkers = true;
893 }
const GPoint m_center
Definition: SystemBubble.h:167
void MarkBubble(const GPoint &position, std::string &name, std::string &desc, bool center=false)
uint16 m_bubbleID
Definition: SystemBubble.h:189
GaFloat x
Definition: GaTypes.h:207
Definition: gpoint.h:33
GaFloat y
Definition: GaTypes.h:207
SystemManager * m_system
Definition: SystemBubble.h:183
GaFloat z
Definition: GaTypes.h:207
static const float BUBBLE_RADIUS_METERS
Definition: BubbleManager.h:32

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemBubble::PrintEntityList ( )

Definition at line 458 of file SystemBubble.cpp.

References m_dynamicEntities, and sLog.

Referenced by SendAddBalls(), and SendAddBalls2().

458  {
459  bool found = false;
460  for (auto cur : m_dynamicEntities) {
461  found = false;
462  if (cur.second->isGlobal()) //this should only hit beacons and cynos as global AND not static
463  sLog.Warning( "SystemBubble::PrintEntityList()", "entity %s(%u) is Global.", cur.second->GetName(), cur.second->GetID() );
464  if (cur.second->IsShipSE()) {
465  if (cur.second->HasPilot()) {
466  sLog.Warning( "SystemBubble::PrintEntityList()", "entity %s(%u) is Player Ship.", cur.second->GetName(), cur.second->GetID() ); found = true;
467  } else {
468  sLog.Warning( "SystemBubble::PrintEntityList()", "entity %s(%u) is Empty Player Ship.", cur.second->GetName(), cur.second->GetID() ); found = true;
469  }
470  }
471  if (cur.second->IsNPCSE()) {
472  sLog.Warning( "SystemBubble::PrintEntityList()", "entity %s(%u) is NPC.", cur.second->GetName(), cur.second->GetID() ); found = true;
473  }
474  if (cur.second->IsJumpBridgeSE()) {
475  sLog.Warning( "SystemBubble::PrintEntityList()", "entity %s(%u) is JumpBridge.", cur.second->GetName(), cur.second->GetID() ); found = true;
476  }
477  if (cur.second->IsTCUSE()) {
478  sLog.Warning( "SystemBubble::PrintEntityList()", "entity %s(%u) is TCU.", cur.second->GetName(), cur.second->GetID() ); found = true;
479  }
480  if (cur.second->IsSBUSE()) {
481  sLog.Warning( "SystemBubble::PrintEntityList()", "entity %s(%u) is SBU.", cur.second->GetName(), cur.second->GetID() ); found = true;
482  }
483  if (cur.second->IsIHubSE()) {
484  sLog.Warning( "SystemBubble::PrintEntityList()", "entity %s(%u) is IHub.", cur.second->GetName(), cur.second->GetID() ); found = true;
485  }
486  if (cur.second->IsCOSE()) {
487  sLog.Warning( "SystemBubble::PrintEntityList()", "entity %s(%u) is Customs Office.", cur.second->GetName(), cur.second->GetID() ); found = true;
488  }
489  if (cur.second->IsTowerSE()) {
490  sLog.Warning( "SystemBubble::PrintEntityList()", "entity %s(%u) is Tower.", cur.second->GetName(), cur.second->GetID() ); found = true;
491  }
492  if (cur.second->IsPOSSE() and !found) {
493  sLog.Warning( "SystemBubble::PrintEntityList()", "entity %s(%u) is other POS.", cur.second->GetName(), cur.second->GetID() ); found = true;
494  }
495  if (cur.second->IsContainerSE()) {
496  sLog.Warning( "SystemBubble::PrintEntityList()", "entity %s(%u) is Container.", cur.second->GetName(), cur.second->GetID() ); found = true;
497  }
498  if (cur.second->IsWreckSE()) {
499  sLog.Warning( "SystemBubble::PrintEntityList()", "entity %s(%u) is Wreck.", cur.second->GetName(), cur.second->GetID() ); found = true;
500  }
501  if (cur.second->IsOutpostSE()) {
502  sLog.Warning( "SystemBubble::PrintEntityList()", "entity %s(%u) is Outpost.", cur.second->GetName(), cur.second->GetID() ); found = true;
503  }
504  if (cur.second->IsAsteroidSE()) {
505  sLog.Warning( "SystemBubble::PrintEntityList()", "entity %s(%u) is Asteroid.", cur.second->GetName(), cur.second->GetID() ); found = true;
506  }
507  if (cur.second->IsDeployableSE()) {
508  sLog.Warning( "SystemBubble::PrintEntityList()", "entity %s(%u) is Deployable.", cur.second->GetName(), cur.second->GetID() ); found = true;
509  }
510  if (cur.second->IsStaticEntity() and !found) {
511  sLog.Warning( "SystemBubble::PrintEntityList()", "entity %s(%u) is Static.", cur.second->GetName(), cur.second->GetID() ); found = true;
512  }
513  if (cur.second->IsItemEntity() and !found) {
514  sLog.Warning( "SystemBubble::PrintEntityList()", "entity %s(%u) is Item.", cur.second->GetName(), cur.second->GetID() ); found = true;
515  }
516  if (cur.second->IsObjectEntity() and !found) {
517  sLog.Warning( "SystemBubble::PrintEntityList()", "entity %s(%u) is Object.", cur.second->GetName(), cur.second->GetID() ); found = true;
518  }
519  if (cur.second->IsDynamicEntity() and !found) {
520  sLog.Warning( "SystemBubble::PrintEntityList()", "entity %s(%u) is Dynamic.", cur.second->GetName(), cur.second->GetID() ); found = true;
521  }
522  if (!found)
523  sLog.Warning( "SystemBubble::PrintEntityList()", "entity %s(%u) is None of the Above.", cur.second->GetName(), cur.second->GetID() );
524  }
525 }
std::map< uint32, SystemEntity * > m_dynamicEntities
Definition: SystemBubble.h:194
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250

Here is the caller graph for this function:

void SystemBubble::Process ( )

Definition at line 110 of file SystemBubble.cpp.

References Timer::Check(), Timer::Disable(), SystemManager::DoSpawnForBubble(), Timer::Enabled(), SystemManager::GetSystemSecurityRating(), m_belt, m_players, m_spawned, m_spawnTimer, and m_system.

111 {
112  /* this will need to process:
113  * belt and gate for spawn/respawn
114  * missions for ??
115  * incursions for ??
116  */
117  if (m_belt and (m_system->GetSystemSecurityRating() > 0.90)) // make config option here to spawn rats in secure empire space? nope.
118  return;
119  if (m_spawned) {
121  return;
122  }
123 
124  // this must run a second time for spawn to actually hit. first time only sets main system spawn timer.
125  // may be nuts, but will remain enabled as long as player in bubble and bubble has no rats.
126  if (m_spawnTimer.Enabled()) {
127  if (m_spawnTimer.Check()) {
128  if (!m_players.empty()) {
129  m_system->DoSpawnForBubble(this);
130  } else {
132  }
133  }
134  }
135 }
void Disable()
Definition: timer.h:39
const float GetSystemSecurityRating()
Definition: SystemManager.h:86
bool Enabled() const
Definition: timer.h:41
Timer m_spawnTimer
Definition: SystemBubble.h:199
bool Check(bool reset=true)
Definition: timer.cpp:62
std::map< uint32, Client * > m_players
Definition: SystemBubble.h:192
void DoSpawnForBubble(SystemBubble *pBubble)
SystemManager * m_system
Definition: SystemBubble.h:183

Here is the call graph for this function:

void SystemBubble::ProcessWander ( std::vector< SystemEntity * > &  wanderers)

Definition at line 141 of file SystemBubble.cpp.

References _log, SystemEntity::DestinyMgr(), SystemManager::GetID(), SystemEntity::GetID(), SystemEntity::GetPosition(), InBubble(), DestinyManager::IsWarping(), m_bubbleID, m_dynamicEntities, m_players, m_spawned, m_systemID, ResetBubbleRatSpawn(), and SystemEntity::SystemMgr().

141  {
142  DynamicSystemEntity* pDSE(nullptr);
143  std::map<uint32, SystemEntity*>::iterator itr = m_dynamicEntities.begin();
144  while (itr != m_dynamicEntities.end()) {
145  if (itr->second == nullptr) {
146  itr = m_dynamicEntities.erase(itr);
147  continue;
148  }
149  pDSE = itr->second->GetDynamicSE();
150  if (pDSE == nullptr) {
151  itr = m_dynamicEntities.erase(itr);
152  continue;
153  }
154  if ((pDSE->DestinyMgr() == nullptr) or pDSE->DestinyMgr()->IsWarping()) {
155  ++itr;
156  continue;
157  }
158  // is this shit really needed??
159  if (pDSE->SystemMgr()->GetID() != m_systemID) {
160  // this entity is in a different system! this shouldnt happen....
161  // remove this entity, insert into wanderers, and continue
162  wanderers.push_back(pDSE);
163  _log(DESTINY__WARNING, "SystemBubble::ProcessWander() - entity %u is in %u but this is %u.", \
164  pDSE->GetID(), pDSE->SystemMgr()->GetID(), m_systemID);
165  itr = m_dynamicEntities.erase(itr);
166  pDSE = nullptr;
167  continue;
168  }
169  if (!InBubble(pDSE->GetPosition())) {
170  wanderers.push_back(pDSE);
171  //17:38:57 [DestinyWarning] SystemBubble::ProcessWander() - entity 140006173(sys:30002507) not in bubble 1 for systemID 30002510.
172  _log(DESTINY__WARNING, "SystemBubble::ProcessWander() - entity %u(sys:%u) not in bubble %u for systemID %u.", \
173  pDSE->GetID(), pDSE->SystemMgr()->GetID(), m_bubbleID, m_systemID);
174  itr = m_dynamicEntities.erase(itr);
175  pDSE = nullptr;
176  continue;
177  }
178  ++itr;
179  }
180  pDSE = nullptr;
181 
182  if (!m_players.empty() and m_spawned)
184 }
std::map< uint32, SystemEntity * > m_dynamicEntities
Definition: SystemBubble.h:194
uint16 m_bubbleID
Definition: SystemBubble.h:189
#define _log(type, fmt,...)
Definition: logsys.h:124
bool InBubble(const GPoint &pt, bool inWarp=false) const
std::map< uint32, Client * > m_players
Definition: SystemBubble.h:192
void ResetBubbleRatSpawn()
uint32 m_systemID
Definition: SystemBubble.h:190

Here is the call graph for this function:

void SystemBubble::Remove ( SystemEntity pSE)

Definition at line 255 of file SystemBubble.cpp.

References _log, Client::GetCharacterID(), SystemEntity::GetID(), SystemEntity::GetPilot(), SystemEntity::HasPilot(), is_log_enabled, SystemEntity::IsDroneSE(), SystemEntity::m_bubble, m_bubbleID, m_drones, m_dynamicEntities, m_entities, m_players, RemoveBall(), RemoveBalls(), sConfig, sLog, and EvE::traceStack().

Referenced by BubbleManager::Add(), BubbleManager::CheckBubble(), BubbleManager::Remove(), ProbeSE::SendWarpStart(), and DestinyManager::WarpAccel().

255  {
256  //assume that the entity is properly registered for its ID
257  if (pSE->m_bubble == nullptr) {
258  if (sConfig.debug.StackTrace)
259  EvE::traceStack();
260  return;
261  }
262 
263  _log(DESTINY__BUBBLE_TRACE, "SystemBubble::Remove() - Removing entity %u from bubble %u", pSE->GetID(), m_bubbleID);
264 
265  m_entities.erase(pSE->GetID());
266  m_dynamicEntities.erase(pSE->GetID());
267 
268  if (pSE->HasPilot()) {
269  m_players.erase(pSE->GetPilot()->GetCharacterID());
270  RemoveBalls(pSE);
271  }
272 
273  //notify everybody else in the bubble of the removal.
274  if (!m_players.empty())
275  RemoveBall(pSE);
276 
277  if (pSE->IsDroneSE())
278  m_drones.erase(pSE->GetID());
279 
280  if (is_log_enabled(DESTINY__BUBBLE_DEBUG))
281  sLog.Warning("SystemBubble::Remove()", "Removing entity %u from bubble %u", pSE->GetID(), m_bubbleID);
282 
283  pSE->m_bubble = nullptr;
284 }
#define sConfig
A macro for easier access to the singleton.
std::map< uint32, SystemEntity * > m_dynamicEntities
Definition: SystemBubble.h:194
uint16 m_bubbleID
Definition: SystemBubble.h:189
#define _log(type, fmt,...)
Definition: logsys.h:124
virtual bool HasPilot()
Definition: SystemEntity.h:258
virtual Client * GetPilot()
Definition: SystemEntity.h:259
SystemBubble * m_bubble
Definition: SystemEntity.h:262
int32 GetCharacterID() const
Definition: Client.h:113
std::map< uint32, DroneSE * > m_drones
Definition: SystemBubble.h:196
#define is_log_enabled(type)
Definition: logsys.h:78
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
uint32 GetID()
Definition: SystemEntity.h:207
std::map< uint32, Client * > m_players
Definition: SystemBubble.h:192
void RemoveBall(SystemEntity *about_who)
std::map< uint32, SystemEntity * > m_entities
Definition: SystemBubble.h:195
void RemoveBalls(SystemEntity *to_who)
void traceStack(void)
Definition: misc.cpp:169
virtual bool IsDroneSE()
Definition: SystemEntity.h:187

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemBubble::RemoveBall ( SystemEntity about_who)
protected

Definition at line 690 of file SystemBubble.cpp.

References _log, BubblecastDestinyUpdate(), SystemEntity::GetID(), is_log_enabled, SystemManager::IsLoaded(), m_system, and PySafeDecRef.

Referenced by Remove().

690  {
691  // RemoveBallFromBP removeball;
692  // removeball.entityID = about_who->GetID();
693  // using RemoveBalls instead of RemoveBall because client
694  // seems not to trigger explosion on RemoveBall
695  if (!m_system->IsLoaded())
696  return;
697  RemoveBallsFromBP removeball;
698  removeball.balls.push_back(about_who->GetID());
699 
700  _log(DESTINY__MESSAGE, "SystemBubble::RemoveBall()");
701  if (is_log_enabled(DESTINY__BALL_DUMP))
702  removeball.Dump( DESTINY__BALL_DUMP, " " );
703 
704  PyTuple *tmp = removeball.Encode();
705  BubblecastDestinyUpdate(&tmp, "RemoveBall");
706  PySafeDecRef( tmp );
707 }
#define _log(type, fmt,...)
Definition: logsys.h:124
Python tuple.
Definition: PyRep.h:567
#define is_log_enabled(type)
Definition: logsys.h:78
uint32 GetID()
Definition: SystemEntity.h:207
#define PySafeDecRef(op)
Definition: PyRep.h:61
SystemManager * m_system
Definition: SystemBubble.h:183
void BubblecastDestinyUpdate(std::vector< PyTuple * > &updates, const char *desc) const

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemBubble::RemoveBallExclusive ( SystemEntity about_who)
protected

Definition at line 710 of file SystemBubble.cpp.

References _log, BubblecastDestinyUpdateExclusive(), SystemEntity::GetID(), is_log_enabled, and PySafeDecRef.

Referenced by RemoveExclusive().

710  {
711  RemoveBallFromBP removeball;
712  removeball.entityID = about_who->GetID();
713  // RemoveBalls removeball;
714  //removeball.balls.push_back(about_who->GetID());
715 
716  _log(DESTINY__MESSAGE, "SystemBubble::RemoveBallExclusive()");
717  if (is_log_enabled(DESTINY__BALL_DUMP))
718  removeball.Dump( DESTINY__BALL_DUMP, " " );
719 
720  PyTuple *tmp = removeball.Encode();
721  BubblecastDestinyUpdateExclusive(&tmp, "RemoveBall", about_who);
722  PySafeDecRef( tmp );
723 }
void BubblecastDestinyUpdateExclusive(PyTuple **payload, const char *desc, SystemEntity *pSE) const
#define _log(type, fmt,...)
Definition: logsys.h:124
Python tuple.
Definition: PyRep.h:567
#define is_log_enabled(type)
Definition: logsys.h:78
uint32 GetID()
Definition: SystemEntity.h:207
#define PySafeDecRef(op)
Definition: PyRep.h:61

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemBubble::RemoveBalls ( SystemEntity to_who)
protected

Definition at line 725 of file SystemBubble.cpp.

References _log, Client::GetName(), SystemEntity::GetPilot(), SystemEntity::HasPilot(), is_log_enabled, Client::IsDock(), Client::IsDocked(), SystemManager::IsLoaded(), m_dynamicEntities, m_system, Client::QueueDestinyUpdate(), and SystemEntity::SysBubble().

Referenced by Remove().

725  {
726  if (!m_system->IsLoaded())
727  return;
728  if (m_dynamicEntities.empty())
729  return;
730  if ((!to_who->HasPilot()) or (to_who->SysBubble() == nullptr))
731  return;
732  Client* pClient = to_who->GetPilot();
733  if ((pClient == nullptr) or pClient->IsDock() or pClient->IsDocked())
734  return;
735 
736  RemoveBallsFromBP remove_balls;
737 
738  for (auto cur : m_dynamicEntities)
739  remove_balls.balls.push_back(cur.first);
740 
741  if (remove_balls.balls.empty())
742  return;
743 
744  _log( DESTINY__MESSAGE, "SystemBubble::RemoveBalls() - sending to %s", pClient->GetName());
745  if (is_log_enabled(DESTINY__BALL_DUMP))
746  remove_balls.Dump( DESTINY__BALL_DUMP, " " );
747 
748  PyTuple* tmp = remove_balls.Encode();
749  pClient->QueueDestinyUpdate( &tmp );
750 }
std::map< uint32, SystemEntity * > m_dynamicEntities
Definition: SystemBubble.h:194
#define _log(type, fmt,...)
Definition: logsys.h:124
SystemBubble * SysBubble()
Definition: SystemEntity.h:195
virtual bool HasPilot()
Definition: SystemEntity.h:258
virtual Client * GetPilot()
Definition: SystemEntity.h:259
Python tuple.
Definition: PyRep.h:567
#define is_log_enabled(type)
Definition: logsys.h:78
bool IsDocked()
Definition: Client.h:229
const char * GetName() const
Definition: Client.h:94
void QueueDestinyUpdate(PyTuple **update, bool DoPackage=false, bool IsSetState=false)
Definition: Client.cpp:2131
Definition: Client.h:66
bool IsDock()
Definition: Client.h:230
SystemManager * m_system
Definition: SystemBubble.h:183

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemBubble::RemoveExclusive ( SystemEntity pSE)

Definition at line 286 of file SystemBubble.cpp.

References _log, SystemEntity::GetID(), SystemEntity::m_bubble, m_bubbleID, and RemoveBallExclusive().

Referenced by DestinyManager::Cloak(), and DestinyManager::Jump().

286  {
287  if (pSE->m_bubble == nullptr)
288  return;
289 
290  _log(DESTINY__BUBBLE_TRACE, "SystemBubble::RemoveExclusive() - Removing entity %u from bubble %u", pSE->GetID(), m_bubbleID);
291  RemoveBallExclusive(pSE);
292 }
uint16 m_bubbleID
Definition: SystemBubble.h:189
#define _log(type, fmt,...)
Definition: logsys.h:124
SystemBubble * m_bubble
Definition: SystemEntity.h:262
void RemoveBallExclusive(SystemEntity *about_who)
uint32 GetID()
Definition: SystemEntity.h:207

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemBubble::RemoveMarkers ( )

Definition at line 806 of file SystemBubble.cpp.

References m_centerSE, m_hasMarkers, m_markers, m_system, SystemManager::RemoveEntity(), and SafeDelete().

Referenced by Command_bubbletrack().

807 {
808  if (m_hasMarkers)
809  for (auto cur : m_markers) {
810  m_system->RemoveEntity(cur.second);
811  cur.second->Delete(); // delete marker cans here
812  SafeDelete(cur.second);
813  }
814  m_markers.clear();
815  m_centerSE = nullptr;
816  m_hasMarkers = false;
817 }
std::map< uint32, SystemEntity * > m_markers
Definition: SystemBubble.h:193
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
void RemoveEntity(SystemEntity *pSE)
ContainerSE * m_centerSE
Definition: SystemBubble.h:184
SystemManager * m_system
Definition: SystemBubble.h:183

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemBubble::ResetBubbleRatSpawn ( )

Definition at line 294 of file SystemBubble.cpp.

References Timer::Enabled(), m_belt, m_gate, m_spawned, m_spawnTimer, sConfig, and SetSpawnTimer().

Referenced by ProcessWander(), and SpawnMgr::SpawnKilled().

295 {
296  /* the current spawn in this bubble was killed off, so reset timers accordingly
297  * once the timer hits, it will do all needed checks for players and respawn as needed.
298  * this enables creating a new spawn after previous group was killed off
299  */
300  m_spawned = false;
301  if (m_belt and sConfig.npc.RoamingSpawns)
302  if (!m_spawnTimer.Enabled())
303  SetSpawnTimer(true);
304  if (m_gate and sConfig.npc.StaticSpawns) /* m_gate = false. will fix when gate spawns are finished */
305  if (!m_spawnTimer.Enabled())
306  SetSpawnTimer(false);
307 }
#define sConfig
A macro for easier access to the singleton.
bool Enabled() const
Definition: timer.h:41
Timer m_spawnTimer
Definition: SystemBubble.h:199
void SetSpawnTimer(bool isBelt=false)

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemBubble::SendAddBalls ( SystemEntity to_who)

Definition at line 527 of file SystemBubble.cpp.

References _log, Buffer::Append(), Destiny::DumpUpdate(), Client::GetName(), SystemEntity::GetPilot(), SystemEntity::HasPilot(), is_log_enabled, SystemManager::IsLoaded(), m_dynamicEntities, m_system, Destiny::AddBall_header::packet_type, PrintEntityList(), Client::QueueDestinyUpdate(), SafeDelete(), sEntityList, and Destiny::AddBall_header::stamp.

Referenced by Add(), Command_addball(), and Command_update().

527  {
528  if (!m_system->IsLoaded())
529  return;
530  if (m_dynamicEntities.empty())
531  return;
532  if (!to_who->HasPilot())
533  return;
534  Client* pClient = to_who->GetPilot();
535  if (pClient == nullptr)
536  return;
537  if (is_log_enabled(DESTINY__BUBBLE_DEBUG))
538  PrintEntityList();
539 
540  Buffer* destinyBuffer = new Buffer();
541 
543  head.packet_type = 1; // 0 = full state 1 = balls
544  head.stamp = sEntityList.GetStamp();
545  destinyBuffer->Append(head);
546 
547  AddBalls addballs;
548  addballs.slims = new PyList();
549 
550  for (auto cur : m_dynamicEntities) {
551  if (cur.second->DestinyMgr() != nullptr)
552  if (cur.second->DestinyMgr()->IsCloaked())
553  continue;
554  if (!cur.second->IsMissileSE() or !cur.second->IsFieldSE())
555  addballs.damageDict[cur.first] = cur.second->MakeDamageState();
556  addballs.slims->AddItem( new PyObject( "foo.SlimItem", cur.second->MakeSlimItem() ) );
557  cur.second->EncodeDestiny( *destinyBuffer );
558  }
559 
560  if (addballs.slims->empty()) {
561  SafeDelete( destinyBuffer );
562  return;
563  }
564 
565  addballs.state = new PyBuffer( &destinyBuffer );
566 
567  _log(DESTINY__MESSAGE, "SystemBubble::SendAddBalls() to %s", pClient->GetName());
568  if (is_log_enabled(DESTINY__BALL_DUMP))
569  addballs.Dump( DESTINY__BALL_DUMP, " " );
570  _log( DESTINY__BALL_DECODE, " Ball Decoded:" );
571  if (is_log_enabled(DESTINY__BALL_DECODE))
572  Destiny::DumpUpdate( DESTINY__BALL_DECODE, &( addballs.state->content() )[0], (uint32)addballs.state->content().size() );
573  PyTuple* t = addballs.Encode();
574  pClient->QueueDestinyUpdate( &t ); //consumed
575 }
void Append(const T &value)
Appends a single value to buffer.
Definition: Buffer.h:437
std::map< uint32, SystemEntity * > m_dynamicEntities
Definition: SystemBubble.h:194
#define _log(type, fmt,...)
Definition: logsys.h:124
void PrintEntityList()
virtual bool HasPilot()
Definition: SystemEntity.h:258
virtual Client * GetPilot()
Definition: SystemEntity.h:259
#define sEntityList
Definition: EntityList.h:208
Python tuple.
Definition: PyRep.h:567
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
#define is_log_enabled(type)
Definition: logsys.h:78
Generic class for buffers.
Definition: Buffer.h:40
Python object.
Definition: PyRep.h:826
const char * GetName() const
Definition: Client.h:94
Definition: Client.h:66
unsigned __int32 uint32
Definition: eve-compat.h:50
void DumpUpdate(LogType into, const uint8 *data, uint32 len)
SystemManager * m_system
Definition: SystemBubble.h:183
Python buffer.
Definition: PyRep.h:382
entityID heal the character with the entityID note giving you detailed ship status information gives a list of all dynamic entities and players and their destinyState in this bubble shows some current destiny variables save all kick all and halt server immediate command list all items in current location s gives list of cargo contents and volumes in all holds list current session values show current ship DNA show current objects in their destiny state
Python list.
Definition: PyRep.h:639

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemBubble::SendAddBalls2 ( SystemEntity to_who)

Definition at line 577 of file SystemBubble.cpp.

References _log, Buffer::Append(), Destiny::DumpUpdate(), Client::GetName(), SystemEntity::GetPilot(), SystemEntity::HasPilot(), is_log_enabled, SystemManager::IsLoaded(), m_dynamicEntities, m_system, Destiny::AddBall_header::packet_type, PrintEntityList(), Client::QueueDestinyUpdate(), SafeDelete(), sEntityList, PyTuple::SetItem(), and Destiny::AddBall_header::stamp.

Referenced by Command_addball2().

577  {
578  if (!m_system->IsLoaded())
579  return;
580  if (m_dynamicEntities.empty())
581  return;
582  if (!to_who->HasPilot())
583  return;
584  Client* pClient = to_who->GetPilot();
585  if (pClient == nullptr)
586  return;
587  if (is_log_enabled(DESTINY__BUBBLE_TRACE))
588  PrintEntityList();
589 
590  Buffer* destinyBuffer = new Buffer();
591 
593  head.packet_type = 1; // 0 = full state 1 = balls
594  head.stamp = sEntityList.GetStamp();
595  destinyBuffer->Append(head);
596 
597  AddBalls2 addballs2;
598  addballs2.stateStamp = sEntityList.GetStamp();
599  addballs2.extraBallData = new PyList();
600 
601  for (auto cur : m_dynamicEntities) {
602  if (cur.second->IsMissileSE() or cur.second->IsContainerSE()) {
603  addballs2.extraBallData->AddItem(cur.second->MakeSlimItem());
604  } else {
605  PyTuple* balls = new PyTuple(2);
606  balls->SetItem(0, cur.second->MakeSlimItem());
607  balls->SetItem(1, cur.second->MakeDamageState());
608  addballs2.extraBallData->AddItem(balls);
609  }
610  cur.second->EncodeDestiny(*destinyBuffer);
611  }
612 
613  if (addballs2.extraBallData->size() < 1) {
614  SafeDelete( destinyBuffer );
615  return;
616  }
617 
618  addballs2.state = new PyBuffer(&destinyBuffer); //consumed
619  SafeDelete( destinyBuffer );
620 
621  _log( DESTINY__MESSAGE, "SystemBubble::SendAddBalls2() to %s", pClient->GetName());
622  if (is_log_enabled(DESTINY__BALL_DUMP))
623  addballs2.Dump( DESTINY__BALL_DUMP, " " );
624  //_log( DESTINY__TRACE, " Ball Binary:" );
625  //_hex( DESTINY__TRACE, &( addballs2.state->content() )[0], (uint32)addballs2.state->content().size() );
626  /* note: this shows up in valgrind as an uninitialized value -allan 24Mar16
627  * Conditional jump or move depends on uninitialised value(s) SystemBubble.cpp:484 (uncorrected line#)
628  * Uninitialised value was created by a heap allocation SystemBubble.cpp:472
629  */
630  _log( DESTINY__BALL_DECODE, " Ball Decoded:" );
631  if (is_log_enabled(DESTINY__BALL_DECODE))
632  Destiny::DumpUpdate( DESTINY__BALL_DECODE, &( addballs2.state->content() )[0], (uint32)addballs2.state->content().size() );
633  PyTuple* t = addballs2.Encode();
634  pClient->QueueDestinyUpdate(&t, true); //consumed
635 }
void Append(const T &value)
Appends a single value to buffer.
Definition: Buffer.h:437
std::map< uint32, SystemEntity * > m_dynamicEntities
Definition: SystemBubble.h:194
#define _log(type, fmt,...)
Definition: logsys.h:124
void PrintEntityList()
virtual bool HasPilot()
Definition: SystemEntity.h:258
virtual Client * GetPilot()
Definition: SystemEntity.h:259
#define sEntityList
Definition: EntityList.h:208
Python tuple.
Definition: PyRep.h:567
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
#define is_log_enabled(type)
Definition: logsys.h:78
Generic class for buffers.
Definition: Buffer.h:40
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610
const char * GetName() const
Definition: Client.h:94
Definition: Client.h:66
unsigned __int32 uint32
Definition: eve-compat.h:50
void DumpUpdate(LogType into, const uint8 *data, uint32 len)
SystemManager * m_system
Definition: SystemBubble.h:183
Python buffer.
Definition: PyRep.h:382
entityID heal the character with the entityID note giving you detailed ship status information gives a list of all dynamic entities and players and their destinyState in this bubble shows some current destiny variables save all kick all and halt server immediate command list all items in current location s gives list of cargo contents and volumes in all holds list current session values show current ship DNA show current objects in their destiny state
Python list.
Definition: PyRep.h:639

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemBubble::SetAnomaly ( bool  set = true)
inline

Definition at line 72 of file SystemBubble.h.

References m_anomaly.

Referenced by SpawnMgr::DoSpawnForAnomaly().

72 { m_anomaly = set; }

Here is the caller graph for this function:

void SystemBubble::SetBelt ( InventoryItemRef  itemRef)

Definition at line 325 of file SystemBubble.cpp.

References SystemManager::GetBeltMgr(), InventoryItem::itemID(), m_belt, m_bubbleID, m_ice, m_system, BeltMgr::RegisterBelt(), sBubbleMgr, and InventoryItem::typeID().

Referenced by BeltMgr::Create(), and BeltSE::LoadExtras().

326 {
327  m_belt = true;
328  sBubbleMgr.AddSpawnID(m_bubbleID, itemRef->itemID());
329  m_system->GetBeltMgr()->RegisterBelt(itemRef);
330  if (itemRef->typeID() == 17774)
331  m_ice = true;
332 }
uint16 m_bubbleID
Definition: SystemBubble.h:189
BeltMgr * GetBeltMgr()
SystemManager * m_system
Definition: SystemBubble.h:183
void RegisterBelt(InventoryItemRef itemRef)
Definition: BeltMgr.cpp:57
#define sBubbleMgr
uint16 typeID() const
uint32 itemID() const
Definition: InventoryItem.h:98

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemBubble::SetGate ( uint32  gateID)

Definition at line 334 of file SystemBubble.cpp.

References m_bubbleID, m_gate, and sBubbleMgr.

Referenced by StargateSE::LoadExtras().

335 {
336  m_gate = true;
337  sBubbleMgr.AddSpawnID(m_bubbleID, gateID);
338 }
uint16 m_bubbleID
Definition: SystemBubble.h:189
#define sBubbleMgr

Here is the caller graph for this function:

void SystemBubble::SetIHubSE ( IHubSE pIHub)
inline

Definition at line 156 of file SystemBubble.h.

References m_ihubSE.

Referenced by IHubSE::Init().

156 { m_ihubSE = pIHub; }
IHubSE * m_ihubSE
Definition: SystemBubble.h:181

Here is the caller graph for this function:

void SystemBubble::SetIncursion ( bool  set = true)
inline

Definition at line 74 of file SystemBubble.h.

References m_incursion.

Referenced by SpawnMgr::DoSpawnForIncursion().

74 { m_incursion = set; }

Here is the caller graph for this function:

void SystemBubble::SetMission ( bool  set = true)
inline

Definition at line 73 of file SystemBubble.h.

References m_mission.

Referenced by SpawnMgr::DoSpawnForMission().

73 { m_mission = set; }

Here is the caller graph for this function:

void SystemBubble::SetSBUSE ( SBUSE pSBU)
inline

Definition at line 152 of file SystemBubble.h.

References m_sbuSE.

Referenced by SBUSE::Init().

152 { m_sbuSE = pSBU; }
SBUSE * m_sbuSE
Definition: SystemBubble.h:180

Here is the caller graph for this function:

void SystemBubble::SetSpawned ( bool  set = true)
inline

Definition at line 75 of file SystemBubble.h.

References m_spawned.

Referenced by SpawnMgr::DoSpawnForBubble(), SpawnMgr::MoveSpawn(), SpawnMgr::SpawnKilled(), and SpawnMgr::WarpOutSpawn().

75 { m_spawned = set; }

Here is the caller graph for this function:

void SystemBubble::SetSpawnTimer ( bool  isBelt = false)

Definition at line 309 of file SystemBubble.cpp.

References SystemManager::GetSystemSecurityRating(), m_spawnTimer, m_system, MakeRandomInt(), sConfig, and Timer::Start().

Referenced by Add(), and ResetBubbleRatSpawn().

310 {
311  if (m_system->GetSystemSecurityRating() > 0.90)
312  return;
313  if (sConfig.debug.SpawnTest) {
314  m_spawnTimer.Start(5000); /* 5s for testing */
315  } else {
316  // these randoms should be changed to reflect this npc's faction presence in system
317  if (isBelt) {
318  m_spawnTimer.Start(MakeRandomInt(30, sConfig.npc.RoamingTimer) *1000);
319  } else {
320  m_spawnTimer.Start(MakeRandomInt(60, sConfig.npc.StaticTimer) *1000);
321  }
322  }
323 }
#define sConfig
A macro for easier access to the singleton.
const float GetSystemSecurityRating()
Definition: SystemManager.h:86
Timer m_spawnTimer
Definition: SystemBubble.h:199
int64 MakeRandomInt(int64 low, int64 high)
Generates random integer from interval [low; high].
Definition: misc.cpp:109
SystemManager * m_system
Definition: SystemBubble.h:183
void Start(uint32 setTimerTime=0, bool changeResetTimer=true)
Definition: timer.cpp:81

Here is the call graph for this function:

Here is the caller graph for this function:

void SystemBubble::SetTCUSE ( TCUSE pTCU)
inline

Definition at line 148 of file SystemBubble.h.

References m_tcuSE.

Referenced by TCUSE::Init().

148 { m_tcuSE = pTCU; }
TCUSE * m_tcuSE
Definition: SystemBubble.h:179

Here is the caller graph for this function:

void SystemBubble::SetTowerSE ( TowerSE pTower)
inline

Definition at line 143 of file SystemBubble.h.

References m_towerSE.

Referenced by TowerSE::Init(), StructureSE::Killed(), and StructureSE::PullAnchor().

143 { m_towerSE = pTower; }
TowerSE * m_towerSE
Definition: SystemBubble.h:182

Here is the caller graph for this function:

void SystemBubble::SetWarpBubble ( bool  set = false)
inline

Definition at line 129 of file SystemBubble.h.

References m_hasBubble.

129 { m_hasBubble = set; }
void SystemBubble::SyncPos ( )

Definition at line 783 of file SystemBubble.cpp.

References m_dynamicEntities, and m_players.

Referenced by Command_syncpos().

783  {
784  // send positions of all dSE in bubble to all players in bubble
785  for (auto player : m_players)
786  for (auto dse : m_dynamicEntities) {
787  SetBallPosition du;
788  du.entityID = dse.first;
789  du.x = dse.second->GetPosition().x;
790  du.y = dse.second->GetPosition().y;
791  du.z = dse.second->GetPosition().z;
792  PyTuple* up = du.Encode();
793  player.second->GetShipSE()->DestinyMgr()->SendSingleDestinyUpdate(&up);
794  }
795 }
std::map< uint32, SystemEntity * > m_dynamicEntities
Definition: SystemBubble.h:194
Python tuple.
Definition: PyRep.h:567
std::map< uint32, Client * > m_players
Definition: SystemBubble.h:192

Here is the caller graph for this function:

double SystemBubble::x ( ) const
inline

Definition at line 88 of file SystemBubble.h.

References m_center, and Ga::GaVec3::x.

Referenced by BubbleManager::CheckBubble().

88 { return m_center.x; }
const GPoint m_center
Definition: SystemBubble.h:167
GaFloat x
Definition: GaTypes.h:207

Here is the caller graph for this function:

double SystemBubble::y ( ) const
inline

Definition at line 89 of file SystemBubble.h.

References m_center, and Ga::GaVec3::y.

Referenced by BubbleManager::CheckBubble().

89 { return m_center.y; }
const GPoint m_center
Definition: SystemBubble.h:167
GaFloat y
Definition: GaTypes.h:207

Here is the caller graph for this function:

double SystemBubble::z ( ) const
inline

Definition at line 90 of file SystemBubble.h.

References m_center, and Ga::GaVec3::z.

Referenced by BubbleManager::CheckBubble().

90 { return m_center.z; }
const GPoint m_center
Definition: SystemBubble.h:167
GaFloat z
Definition: GaTypes.h:207

Here is the caller graph for this function:

Member Data Documentation

bool SystemBubble::m_anomaly
private

Definition at line 203 of file SystemBubble.h.

Referenced by clear(), IsAnomaly(), SetAnomaly(), and SystemBubble().

bool SystemBubble::m_belt
private

Definition at line 201 of file SystemBubble.h.

Referenced by Add(), clear(), IsBelt(), Process(), ResetBubbleRatSpawn(), SetBelt(), and SystemBubble().

uint16 SystemBubble::m_bubbleID
private
const GPoint SystemBubble::m_center
protected

Definition at line 167 of file SystemBubble.h.

Referenced by Add(), GetCenter(), InBubble(), IsOverlap(), MarkCenter(), SystemBubble(), x(), y(), and z().

ContainerSE* SystemBubble::m_centerSE
private

Definition at line 184 of file SystemBubble.h.

Referenced by GetCenterMarker(), MarkBubble(), and RemoveMarkers().

std::map<uint32, DroneSE*> SystemBubble::m_drones
private

Definition at line 196 of file SystemBubble.h.

Referenced by Add(), GetDroneState(), and Remove().

std::map<uint32, SystemEntity*> SystemBubble::m_entities
private

Definition at line 195 of file SystemBubble.h.

Referenced by Add(), clear(), HasStatics(), IsEmpty(), Remove(), and SystemBubble().

bool SystemBubble::m_gate
private

Definition at line 202 of file SystemBubble.h.

Referenced by Add(), clear(), IsGate(), ResetBubbleRatSpawn(), SetGate(), and SystemBubble().

bool SystemBubble::m_hasBubble
private

Definition at line 187 of file SystemBubble.h.

Referenced by clear(), HasWarpBubble(), SetWarpBubble(), and SystemBubble().

bool SystemBubble::m_hasMarkers
private

Definition at line 186 of file SystemBubble.h.

Referenced by clear(), MarkCenter(), RemoveMarkers(), SystemBubble(), and ~SystemBubble().

bool SystemBubble::m_ice
private

Definition at line 200 of file SystemBubble.h.

Referenced by clear(), IsIce(), SetBelt(), and SystemBubble().

IHubSE* SystemBubble::m_ihubSE
private

Definition at line 181 of file SystemBubble.h.

Referenced by GetIHubSE(), HasIHub(), and SetIHubSE().

bool SystemBubble::m_incursion
private

Definition at line 205 of file SystemBubble.h.

Referenced by clear(), IsIncursion(), SetIncursion(), and SystemBubble().

std::map<uint32, SystemEntity*> SystemBubble::m_markers
private

Definition at line 193 of file SystemBubble.h.

Referenced by clear(), MarkBubble(), RemoveMarkers(), SystemBubble(), and ~SystemBubble().

bool SystemBubble::m_mission
private

Definition at line 204 of file SystemBubble.h.

Referenced by clear(), IsMission(), SetMission(), and SystemBubble().

const double SystemBubble::m_radius
protected

Definition at line 168 of file SystemBubble.h.

Referenced by InBubble(), IsOverlap(), and SystemBubble().

SBUSE* SystemBubble::m_sbuSE
private

Definition at line 180 of file SystemBubble.h.

Referenced by GetSBUSE(), HasSBU(), and SetSBUSE().

bool SystemBubble::m_spawned
private
Timer SystemBubble::m_spawnTimer
private

Definition at line 199 of file SystemBubble.h.

Referenced by Add(), Process(), ResetBubbleRatSpawn(), and SetSpawnTimer().

uint32 SystemBubble::m_systemID
private

Definition at line 190 of file SystemBubble.h.

Referenced by GetSystemID(), MarkBubble(), ProcessWander(), and SystemBubble().

TCUSE* SystemBubble::m_tcuSE
private

Definition at line 179 of file SystemBubble.h.

Referenced by GetTCUSE(), HasTCU(), and SetTCUSE().

TowerSE* SystemBubble::m_towerSE
private

Definition at line 182 of file SystemBubble.h.

Referenced by GetTowerSE(), HasTower(), and SetTowerSE().


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