61 sLog.Blue(
" BubbleMgr",
"Bubble Manager Initialized.");
69 sLog.Warning(
" BubbleMgr",
"Bubble Manager has been closed." );
77 if (cur->IsBelt() or cur->IsGate())
80 if (cur->IsMission() or cur->IsIncursion())
86 std::list<SystemBubble*>::iterator itr = m_bubbles.begin();
87 while (itr != m_bubbles.end()) {
88 if (*itr ==
nullptr) {
89 itr = m_bubbles.erase(itr);
92 if ((*itr)->HasDynamics())
100 if (cur->GetPosition().isNaN() or cur->GetPosition().isInf() or cur->GetPosition().isZero()) {
103 cur->GetPilot()->SendErrorMsg(
"Internal Server Error. Ref: ServerError 35148<br>Please either dock or relog.");
106 _log(DESTINY__WARNING,
"BubbleManager::Process() - Wanderer %s(%u) in system %s(%u) is being added to a bubble.", \
107 cur->GetName(), cur->GetID(), cur->SystemMgr()->GetName(), cur->SystemMgr()->GetID());
117 if (
sConfig.debug.UseProfiling)
123 if (pBubble !=
nullptr) {
125 _log(DESTINY__BUBBLE_DEBUG,
"BubbleManager::CheckBubble() - Entity '%s'(%u) at (%.2f,%.2f,%.2f) is still located in bubble %u at %.2f,%.2f,%.2f.",\
127 pBubble->GetID(), pBubble->
x(), pBubble->
y(), pBubble->
z());
131 _log(DESTINY__BUBBLE_DEBUG,
"BubbleManager::CheckBubble() - Entity '%s'(%u) at (%.2f,%.2f,%.2f) is no longer located in bubble %u at %.2f,%.2f,%.2f. Removing...",\
133 pBubble->GetID(), pBubble->
x(), pBubble->
y(), pBubble->
z());
137 _log(DESTINY__BUBBLE_DEBUG,
"BubbleManager::CheckBubble() - SystemEntity '%s'(%u) not currently in any Bubble...adding", pSE->
GetName(), pSE->
GetID() );
143 std::list<SystemBubble*>::iterator itr =
m_bubbles.begin();
145 if ((*itr)->IsEmpty()) {
146 _log(DESTINY__BUBBLE_DEBUG,
"BubbleManager::RemoveEmpty() - Bubble %u is empty and is being deleted from the system.", (*itr)->GetID() );
171 if (pBubble !=
nullptr) {
177 }
else if (pSE->
SysBubble() != pBubble) {
178 _log(DESTINY__BUBBLE_TRACE,
"BubbleManager::Add(): bubbleID %u != pSE bubbleID %u", pBubble->
GetID(), pSE->
SysBubble()->
GetID() );
181 _log(DESTINY__BUBBLE_TRACE,
"BubbleManager::Add(): Entity %s(%u) still in Bubble %u", pSE->
GetName(), pSE->
GetID(), pBubble->
GetID() );
185 _log(DESTINY__BUBBLE_TRACE,
"BubbleManager::Add(): Entity %s(%u) being added to Bubble %u", pSE->
GetName(), pSE->
GetID(), pBubble->
GetID() );
188 _log(DESTINY__ERROR,
"BubbleManager::Add(): GetBubble() returned nullptr for %s:%u, at (%.2f, %.2f, %.2f).", \
203 _log(DESTINY__BUBBLE_TRACE,
"BubbleManager::Remove(): Entity %s(%u) being removed from Bubble %u", ent->
GetName(), ent->
GetID(), ent->
SysBubble()->
GetID() );
222 _log(DESTINY__BUBBLE_DEBUG,
"BubbleManager::FindBubble() - Searching point %.1f, %.1f, %.1f in system %u.", \
223 pos.
x, pos.
y, pos.
z, systemID);
226 for (
auto itr = range.first; itr != range.second; ++itr )
227 if (itr->second->InBubble(pos))
237 if (pBubble ==
nullptr)
246 for (
auto itr = range.first; itr != range.second; ++itr )
247 if (itr->second->IsOverlap(pos)) {
248 GVector dir(itr->second->GetCenter(), pos);
250 _log(DESTINY__BUBBLE_DEBUG,
"BubbleManager::MakeBubble()::IsOverlap() - dir: %.3f,%.3f,%.3f", dir.x, dir.y, dir.z);
257 if (pBubble !=
nullptr) {
269 std::map<uint32, SystemBubble*>::iterator itr =
m_bubbleIDMap.find(bubbleID);
278 for (
auto itr = range.first; itr != range.second; ++itr){
289 for (
auto itr = range.first; itr != range.second; ++itr)
290 if (itr->second == pSB) {
308 auto range =
m_spawnIDs.equal_range(bubbleID);
309 for (
auto itr = range.first; itr != range.second; ++itr )
310 if (itr->second == spawnID) {
318 std::map<uint16, uint32>::iterator itr =
m_spawnIDs.find(bubbleID);
327 for (
auto itr = range.first; itr != range.second; ++itr)
335 cSE = cur.second->GetCenterMarker();
358 for (
auto itr = range.first; itr != range.second; ++itr) {
359 cSE = itr->second->GetCenterMarker();
382 cur.second->MarkCenter();
387 cur.second->RemoveMarkers();
392 for (
auto itr = range.first; itr != range.second; ++itr)
393 itr->second->MarkCenter();
398 for (
auto itr = range.first; itr != range.second; ++itr)
399 itr->second->RemoveMarkers();
#define sConfig
A macro for easier access to the singleton.
SystemBubble * MakeBubble(SystemManager *sysMgr, GPoint pos)
void RemoveBubble(uint32 systemID, SystemBubble *pSB)
#define _log(type, fmt,...)
SystemBubble * SysBubble()
bool InBubble(const GPoint &pt, bool inWarp=false) const
const std::string & customInfo() const
std::vector< SystemEntity * > m_wanderers
SystemBubble * FindBubbleByID(uint16 bubbleID)
void RemoveSpawnID(uint16 bubbleID, uint32 spawnID)
void AddSpawnID(uint16 bubbleID, uint32 spawnID)
const GPoint & GetPosition() const
void GetBubbleCenterMarkers(std::vector< CosmicSignature > &anom)
const GVector & GetVelocity()
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
const GPoint GetRandPointOnPlanet(uint32 systemID)
GaExpInl GaFloat normalize()
#define sLog
Evaluates to a NewLog instance.
std::map< uint32, SystemBubble * > m_bubbleIDMap
DestinyManager * DestinyMgr()
SystemManager * SystemMgr()
InventoryItemRef GetSelf()
SystemBubble * FindBubble(SystemEntity *ent) const
void ClearSystemBubbles(uint32 systemID)
void NewBubbleCenter(GVector shipVelocity, GPoint &newBubbleCenter)
void Remove(SystemEntity *ent)
bool Check(bool reset=true)
const char * GetName() const
void SetPosition(const GPoint &pt, bool update=false)
SystemBubble * GetBubble(SystemManager *sysMgr, const GPoint &pos)
const char * GetName() const
void Remove(SystemEntity *pSE)
std::list< SystemBubble * > m_bubbles
uint32 GetBeltID(uint16 bubbleID)
void CheckBubble(SystemEntity *ent)
void Add(SystemEntity *pSE, bool isPostWarp=false)
GaExpInl bool isZero() const
std::map< uint16, uint32 > m_spawnIDs
void Add(SystemEntity *pSE)
uint32 GetBubbleCount(uint32 systemID)
std::unordered_multimap< uint32, SystemBubble * > m_sysBubbleMap
void Start(uint32 setTimerTime=0, bool changeResetTimer=true)
static const float BUBBLE_RADIUS_METERS