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

#include "EntityList.h"

Inheritance diagram for EntityList:
Collaboration diagram for EntityList:

Public Types

typedef std::set< uint32character_set
 

Public Member Functions

 EntityList ()
 
 ~EntityList ()
 
void Initialize ()
 
void Close ()
 
void Process ()
 
void Shutdown ()
 
void Add (Client *pClient)
 
void Remove (Client *pClient)
 
void AddPlayer (Client *pClient)
 
void RemovePlayer (Client *pClient)
 
void AddNPC ()
 
void RemoveNPC ()
 
void SetService (PyServiceMgr *svc)
 
void GetStationGuestList (uint32 stationID, std::vector< Client * > &result) const
 
bool HasClients ()
 
AgentGetAgent (uint32 agentID)
 
ClientFindClientByName (const char *name) const
 
ClientFindClientByCharID (uint32 charID) const
 
SystemManagerFindOrBootSystem (uint32 systemID)
 
bool IsOnline (uint32 charID)
 
PyRepPyIsOnline (uint32 charID)
 
uint32 GetNPCCount ()
 
uint32 GetClientCount () const
 
uint32 GetPlayerCount () const
 
uint32 GetSystemCount () const
 
uint32 GetStationCount () const
 
uint16 GetClientSeed ()
 
uint32 GetStamp ()
 
uint32 GetMinutes ()
 
void GetClients (std::vector< Client * > &result) const
 
void GetCorpClients (std::vector< Client * > &result, uint32 corpID) const
 
void AddStation (uint32 stationID, StationItemRef itemRef)
 
void RemoveStation (uint32 stationID)
 
StationItemRef GetStationByID (uint32 stationID)
 
void RegisterSID (int64 &sessionID)
 
void RemoveSID (int64 sessionID)
 
std::string GetAnomalyID ()
 
bool GetTracking ()
 
void SetTracking (bool set=false)
 
void ResetStartTime ()
 
int64 GetStartTime ()
 
void GetUpTime (std::string &time)
 
uint32 GetConnections ()
 
void CorpNotify (uint32 corpID, uint8 bCastType, const char *notifyType, const char *idType, PyTuple *payload) const
 
void Broadcast (const char *notifyType, const char *idType, PyTuple **payload) const
 
void Broadcast (const PyAddress &dest, EVENotificationStream &noti) const
 
void Multicast (const char *notifyType, const char *idType, PyTuple **in_payload, NotificationDestination target, uint32 target_id, bool seq=true)
 
void Multicast (const char *notifyType, const char *idType, PyTuple **payload, const MulticastTarget &mcset, bool seq=true)
 
void Multicast (const character_set &cset, const PyAddress &dest, EVENotificationStream &noti) const
 
void Multicast (const character_set &cset, const char *notifyType, const char *idType, PyTuple **payload, bool seq=true) const
 
void Unicast (uint32 charID, const char *notifyType, const char *idType, PyTuple **payload, bool seq=true)
 
void AddTargMgr (SystemEntity *pSE, TargetManager *pTM)
 
void DeleteTargMgr (SystemEntity *pSE)
 
void AddProbe (uint32 probeID, ProbeSE *pSE)
 
void RemoveProbe (uint32 probeID)
 
- Public Member Functions inherited from Singleton< EntityList >
 Singleton ()
 Primary constructor. More...
 

Protected Attributes

PyServiceMgrm_services
 
Mutex mMutex
 

Private Types

typedef std::map< Client *, int64corpRole
 

Private Attributes

Timer m_stampTimer
 
Timer m_minuteTimer
 
Timer m_targTimer
 
std::vector< Client * > m_clients
 
std::map< uint32, Client * > m_players
 
std::set< int64m_sessions
 
std::map< uint32, SystemManager * > m_systems
 
std::map< uint32, StationItemRefm_stations
 
std::vector< std::string > m_anomIDs
 
std::map< uint32, Agent * > m_agents
 
std::unordered_map
< SystemEntity
*, TargetManager * > 
m_targMgrs
 
std::map< uint32, ProbeSE * > m_probes
 
std::map< uint32, corpRolem_corpMembers
 
bool m_shipTracking
 
uint32 m_npcs
 
uint32 m_stamp
 
uint32 m_minutes
 
uint32 m_connections
 
uint16 m_clientSeedID
 
int64 m_startTime
 

Additional Inherited Members

- Static Public Member Functions inherited from Singleton< EntityList >
static EntityListget ()
 
- Static Protected Attributes inherited from Singleton< EntityList >
static std::shared_ptr
< EntityList
mInstance
 

Detailed Description

Definition at line 63 of file EntityList.h.

Member Typedef Documentation

typedef std::set<uint32> EntityList::character_set

Definition at line 70 of file EntityList.h.

typedef std::map<Client*, int64> EntityList::corpRole
private

Definition at line 193 of file EntityList.h.

Constructor & Destructor Documentation

EntityList::EntityList ( )

Definition at line 51 of file EntityList.cpp.

References m_agents, m_clients, m_corpMembers, m_players, m_probes, m_shipTracking, m_stations, m_systems, m_targMgrs, and sConfig.

52 : m_services( nullptr ),
53 m_targTimer(0, true),
54 m_stampTimer(0, true),
55 m_minuteTimer(0, true),
56 m_startTime(0),
57 m_npcs(0),
58 m_stamp(1000), /* arbitrary. start at 1k. in seconds. used for destiny and client counters */
59 m_minutes(0),
60 m_connections(0),
62 {
63  m_agents.clear();
64  m_probes.clear();
65  m_clients.clear();
66  m_players.clear();
67  m_systems.clear();
68  m_stations.clear();
69  m_targMgrs.clear();
70  m_corpMembers.clear();
71 
72  m_shipTracking = sConfig.debug.UseShipTracking;
73 }
#define sConfig
A macro for easier access to the singleton.
int64 m_startTime
Definition: EntityList.h:204
std::map< uint32, Agent * > m_agents
Definition: EntityList.h:185
std::map< uint32, SystemManager * > m_systems
Definition: EntityList.h:182
uint32 m_minutes
Definition: EntityList.h:200
std::unordered_map< SystemEntity *, TargetManager * > m_targMgrs
Definition: EntityList.h:188
std::map< uint32, ProbeSE * > m_probes
Definition: EntityList.h:190
std::map< uint32, corpRole > m_corpMembers
Definition: EntityList.h:194
uint32 m_stamp
Definition: EntityList.h:199
Timer m_minuteTimer
Definition: EntityList.h:172
uint16 m_clientSeedID
Definition: EntityList.h:202
Timer m_stampTimer
Definition: EntityList.h:171
std::map< uint32, StationItemRef > m_stations
Definition: EntityList.h:183
std::map< uint32, Client * > m_players
Definition: EntityList.h:180
PyServiceMgr * m_services
Definition: EntityList.h:166
Timer m_targTimer
Definition: EntityList.h:173
uint32 m_connections
Definition: EntityList.h:201
uint32 m_npcs
Definition: EntityList.h:198
bool m_shipTracking
Definition: EntityList.h:196
std::vector< Client * > m_clients
Definition: EntityList.h:177
EntityList::~EntityList ( )

Definition at line 75 of file EntityList.cpp.

References sLog.

75  {
76  sLog.Green(" ServerShutdown", " Complete.");
77 }
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250

Member Function Documentation

void EntityList::Add ( Client pClient)

Definition at line 140 of file EntityList.cpp.

References m_clients, and m_connections.

140  {
141  ++m_connections;
142  if (pClient != nullptr)
143  m_clients.push_back(pClient);
144 }
uint32 m_connections
Definition: EntityList.h:201
std::vector< Client * > m_clients
Definition: EntityList.h:177
void EntityList::AddNPC ( )
inline

Definition at line 82 of file EntityList.h.

References m_npcs.

82 { ++m_npcs; }
uint32 m_npcs
Definition: EntityList.h:198
void EntityList::AddPlayer ( Client pClient)

Definition at line 156 of file EntityList.cpp.

References Client::GetCharacterID(), Client::GetCharID(), Client::GetCorporationID(), Client::GetCorpRole(), IsPlayerCorp, Client::IsValidSession(), m_corpMembers, and m_players.

157 {
158  if (pClient != nullptr)
159  if (pClient->IsValidSession()) {
160  m_players.emplace(pClient->GetCharacterID(), pClient);
161  if (IsPlayerCorp(pClient->GetCorporationID())) {
162  corpRole role;
163  role.emplace(pClient, pClient->GetCorpRole());
164  m_corpMembers.emplace(pClient->GetCorporationID(), role);
165  }
166  } else {
167  m_players.emplace(pClient->GetCharID(), pClient);
168  // make note about invalid session and failure to add player to corp roles.
169  // this is nbd if player is in npc corp or in player corp with no roles
170  }
171 }
int64 GetCorpRole() const
Definition: Client.h:129
int32 GetCharacterID() const
Definition: Client.h:113
int32 GetCorporationID() const
Definition: Client.h:123
std::map< Client *, int64 > corpRole
Definition: EntityList.h:193
std::map< uint32, corpRole > m_corpMembers
Definition: EntityList.h:194
#define IsPlayerCorp(itemID)
Definition: EVE_Defines.h:241
uint32 GetCharID()
Definition: Client.h:166
std::map< uint32, Client * > m_players
Definition: EntityList.h:180
bool IsValidSession()
Definition: Client.h:103

Here is the call graph for this function:

void EntityList::AddProbe ( uint32  probeID,
ProbeSE pSE 
)
inline

Definition at line 160 of file EntityList.h.

References m_probes.

160 { m_probes[probeID] = pSE; }
std::map< uint32, ProbeSE * > m_probes
Definition: EntityList.h:190
void EntityList::AddStation ( uint32  stationID,
StationItemRef  itemRef 
)

Definition at line 302 of file EntityList.cpp.

References m_stations.

302  {
303  m_stations[stationID] = itemRef;
304 }
std::map< uint32, StationItemRef > m_stations
Definition: EntityList.h:183
void EntityList::AddTargMgr ( SystemEntity pSE,
TargetManager pTM 
)
inline

Definition at line 154 of file EntityList.h.

References m_targMgrs.

155  { m_targMgrs.emplace(pSE, pTM); }
std::unordered_map< SystemEntity *, TargetManager * > m_targMgrs
Definition: EntityList.h:188
void EntityList::Broadcast ( const char *  notifyType,
const char *  idType,
PyTuple **  payload 
) const
Todo:
this shit needs removal, after new notification methods are completed

Definition at line 610 of file EntityList.cpp.

References EVENotificationStream::args, PyAddress::bcast_idtype, PyAddress::Broadcast, EVENotificationStream::remoteObject, PyAddress::service, and PyAddress::type.

610  {
611  //build a little notification out of it.
612  EVENotificationStream notify;
613  notify.remoteObject = 1;
614  notify.args = *payload;
615  payload = nullptr; //consumed
616 
617  //now sent it to the client
618  PyAddress dest;
619  dest.type = PyAddress::Broadcast;
620  dest.service = notifyType;
621  dest.bcast_idtype = idType;
622  Broadcast(dest, notify);
623 }
void Broadcast(const char *notifyType, const char *idType, PyTuple **payload) const
Definition: EntityList.cpp:610
AddrType type
Definition: PyPacket.h:88
std::string bcast_idtype
Definition: PyPacket.h:93
std::string service
Definition: PyPacket.h:92
void EntityList::Broadcast ( const PyAddress dest,
EVENotificationStream noti 
) const

Definition at line 625 of file EntityList.cpp.

References m_players.

625  {
626  for (auto cur : m_players)
627  cur.second->SendNotification(dest, noti);
628 }
std::map< uint32, Client * > m_players
Definition: EntityList.h:180
void EntityList::Close ( )

Definition at line 108 of file EntityList.cpp.

References m_agents, m_clients, m_stations, m_systems, SafeDelete(), and sLog.

109 {
110  if (m_clients.size() > 0) {
111  sLog.Yellow(" EntityList", "Cleaning up %u clients, %u systems, %u agents, and %u stations", \
112  m_clients.size(), m_systems.size(), m_agents.size(), m_stations.size());
113  } else {
114  sLog.Green(" EntityList", "Cleaning up %u clients, %u systems, %u agents, and %u stations", \
115  m_clients.size(), m_systems.size(), m_agents.size(), m_stations.size());
116  }
117 
118  for (auto cur : m_clients)
119  SafeDelete(cur);
120 
121  for (auto cur : m_agents)
122  SafeDelete(cur.second);
123 
124  for (auto cur : m_systems) {
125  cur.second->UnloadSystem();
126  SafeDelete(cur.second);
127  }
128 
129  sLog.Warning(" EntityList", "Entity List has been closed." );
130 }
std::map< uint32, Agent * > m_agents
Definition: EntityList.h:185
std::map< uint32, SystemManager * > m_systems
Definition: EntityList.h:182
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
std::map< uint32, StationItemRef > m_stations
Definition: EntityList.h:183
std::vector< Client * > m_clients
Definition: EntityList.h:177

Here is the call graph for this function:

void EntityList::CorpNotify ( uint32  corpID,
uint8  bCastType,
const char *  notifyType,
const char *  idType,
PyTuple payload 
) const
Todo:
this works very well, and will be used as template for other notification methods

Definition at line 432 of file EntityList.cpp.

References Corp::Role::Accountant, Notify::Types::AllAnchoring, Notify::Types::AllMaintenanceBill, Notify::Types::AllStrucInvulnerable, Notify::Types::AllStructVulnerable, Notify::Types::AllWarDeclared, Notify::Types::AllWarInvalidated, Notify::Types::AllWarRetracted, Notify::Types::AllWarSurrender, Corp::Role::Auditor, Notify::Types::BillOutOfMoney, Notify::Types::BillPaidChar, Notify::Types::BillPaidCorpAll, Notify::Types::CharBill, Notify::Types::CharLeftCorp, Notify::Types::CharMedal, Notify::Types::ContactAdd, Notify::Types::ContactEdit, Notify::Types::ContainerPassword, Notify::Types::CorpAllBill, Notify::Types::CorpAppAccept, Notify::Types::CorpAppNew, Notify::Types::CorpAppReject, Notify::Types::CorpDividend, Notify::Types::CorpKicked, Notify::Types::CorpLiquidation, Notify::Types::CorpNewCEO, Notify::Types::CorpNews, Notify::Types::CorpOfficeExpiration, Notify::Types::CorpStructLost, Notify::Types::CorpTaxChange, Notify::Types::CorpVote, Notify::Types::CorpVoteCEORevoked, Notify::Types::CorpWarDeclared, Notify::Types::CorpWarFightingLegal, Notify::Types::CorpWarInvalidated, Notify::Types::CorpWarRetracted, Notify::Types::CorpWarSurrender, Notify::Types::FactoryJob, Corp::Role::FactoryManager, Notify::Types::FacWarCorpJoinRequest, Notify::Types::FacWarCorpJoinWithdraw, Notify::Types::FacWarCorpLeaveRequest, Notify::Types::FacWarCorpLeaveWithdraw, Notify::Types::FWAllianceKick, Notify::Types::FWAllianceWarning, Notify::Types::FWCharKick, Notify::Types::FWCharRankGain, Notify::Types::FWCharRankLoss, Notify::Types::FWCharWarning, Notify::Types::FWCorpJoin, Notify::Types::FWCorpKick, Notify::Types::FWCorpLeave, Notify::Types::FWCorpWarning, CorporationDB::HasShares(), IsNPCCorp, Notify::Types::ItemUpdateStation, Notify::Types::ItemUpdateSystem, Corp::Role::JuniorAccountant, m_corpMembers, Notify::Types::MarketOrder, Notify::Types::OrbitalAttacked, Notify::Types::OrbitalReinforced, Notify::Types::OwnershipTransferred, Corp::Role::PersonnelManager, PyDecRef, PyIncRef, PySafeDecRef, Notify::Types::Reimbursement, Notify::Types::SovAllBillLate, Notify::Types::SovAllClaimAquired, Notify::Types::SovAllClaimFail, Notify::Types::SovAllClaimLost, Notify::Types::SovCorpBillLate, Notify::Types::SovCorpClaimAquired, Notify::Types::SovCorpClaimFail, Notify::Types::SovCorpClaimLost, Notify::Types::SovDisruptor, Notify::Types::SovereigntyIHDamage, Notify::Types::SovereigntySBUDamage, Notify::Types::SovereigntyTCUDamage, Notify::Types::StationAggression1, Notify::Types::StationAggression2, Notify::Types::StationConquer, Notify::Types::StationStateChange, Notify::Types::TowerAlert, Notify::Types::TowerResourceAlert, Corp::Role::Trader, Notify::Types::TransactionReversal, and Notify::Types::WalletChange.

433 {
434  // make sure this is player corp (which it really should be, but just in case....)
435  if (IsNPCCorp(corpID))
436  return;
437  std::map<uint32, Client*> cMap;
438  std::map<uint32, corpRole>::const_iterator cItr = m_corpMembers.find(corpID);
439  if (cItr == m_corpMembers.end()) {
440  PySafeDecRef(payload);
441  return; // no corp members online now. nothing to do here.
442  }
443 
444  // determine who in corp needs to be notified
445  using namespace Notify::Types;
446  //using namespace Corp::Role;
447  // auto doesnt work here...dunno why yet.
448  corpRole::const_iterator itr = cItr->second.begin(), end = cItr->second.end();
449  switch (bCastType) {
450  case CorpNews:
451  case CorpNewCEO:
452  case CharLeftCorp: {
453  // all members?
454  while (itr != end) {
455  cMap.emplace(itr->first->GetCharacterID(), itr->first);
456  ++itr;
457  }
458  } break;
459  case CorpAppNew:
460  case CorpAppReject:
461  case CorpAppAccept: {
462  // who else wants/needs this?
463  // PersonnelManager is only role that can view corp applications
464  while (itr != end) {
465  //if ((itr->second & Corp::Role::Director) == Corp::Role::Director)
466  // cMap.insert(std::make_pair(std::make_pair(itr->first->GetCharacterID(), itr->first)));
468  cMap.emplace(itr->first->GetCharacterID(), itr->first);
469  ++itr;
470  }
471  } break;
472  case CorpVote: {
473  // any member that can vote (has shares)
474  // damn...dunno if i wanna do this one like this....hit db every loop here?? fukin nuts!
475  // this is another vote for putting "corp shares" in character.corpData
476  // well, then we'd have to hit db for offine chars.....omg
477  CorporationDB mdb;
478  while (itr != end) {
479  // if (itr->first->GetChar()->HasShares()) // not written, no underlying code yet
480  if (mdb.HasShares(itr->first->GetCharacterID(), corpID))
481  cMap.emplace(itr->first->GetCharacterID(), itr->first);
482  ++itr;
483  }
484  } break;
485 
486  // unused yet. (not coded or not understood ...mostly the latter at this point in corp code)
487  case CharMedal:
488  case AllMaintenanceBill:
489  case AllWarDeclared:
490  case AllWarSurrender:
491  case AllWarRetracted:
492  case AllWarInvalidated:
493  case CharBill:
494  case CorpAllBill:
495  case BillOutOfMoney:
496  case BillPaidChar:
497  case BillPaidCorpAll:
498  case CorpTaxChange:
499  case CorpDividend:
500  case CorpVoteCEORevoked:
501  case CorpWarDeclared:
503  case CorpWarSurrender:
504  case CorpWarRetracted:
505  case CorpWarInvalidated:
506  case ContainerPassword:
507  case SovAllClaimFail:
508  case SovCorpClaimFail:
509  case SovAllBillLate:
510  case SovCorpBillLate:
511  case SovAllClaimLost:
512  case SovCorpClaimLost:
513  case SovAllClaimAquired:
514  case SovCorpClaimAquired:
515  case AllAnchoring:
516  case AllStructVulnerable:
518  case SovDisruptor:
519  case CorpStructLost:
521  case FWCorpJoin:
522  case FWCorpLeave:
523  case FWCorpKick:
524  case FWCharKick:
525  case FWCorpWarning:
526  case FWCharWarning:
527  case FWCharRankLoss:
528  case FWCharRankGain:
529  case FWAllianceWarning:
530  case FWAllianceKick:
531  case TransactionReversal:
532  case Reimbursement:
533  case TowerAlert:
534  case TowerResourceAlert:
535  case StationAggression1:
536  case StationStateChange:
537  case StationConquer:
538  case StationAggression2:
543  case CorpLiquidation:
546  case SovereigntyIHDamage:
547  case ContactAdd:
548  case ContactEdit:
549  case CorpKicked:
550  case OrbitalAttacked:
551  case OrbitalReinforced:
553  break;
554 
555  // internal corp notifications
556  case FactoryJob: { // factory job completion added to calendar
557  // who else wants/needs this?
558  // lets start with factory manager, and may have to add later
559  while (itr != end) {
561  cMap.emplace(itr->first->GetCharacterID(), itr->first);
562  ++itr;
563  }
564  } break;
565  case MarketOrder: {
566  // who else wants/needs this?
567  // lets start with traders, and may have to add later
568  while (itr != end) {
569  if ((itr->second & Corp::Role::Trader) == Corp::Role::Trader)
570  cMap.emplace(itr->first->GetCharacterID(), itr->first);
571  ++itr;
572  }
573  } break;
574  case WalletChange: {
575  while (itr != end) {
576  if ((itr->second & Corp::Role::Accountant) == Corp::Role::Accountant)
577  cMap.emplace(itr->first->GetCharacterID(), itr->first);
578  if ((itr->second & Corp::Role::Auditor) == Corp::Role::Auditor)
579  cMap.emplace(itr->first->GetCharacterID(), itr->first);
580  // this may need to check if player has access to division changed - will require a LOT more code
582  cMap.emplace(itr->first->GetCharacterID(), itr->first);
583  ++itr;
584  }
585  } break;
586  case ItemUpdateStation: {
587  // all members?
588  while (itr != end) {
589  cMap.emplace(itr->first->GetCharacterID(), itr->first);
590  ++itr;
591  }
592  } break;
593  case ItemUpdateSystem: {
594  // all members?
595  while (itr != end) {
596  cMap.emplace(itr->first->GetCharacterID(), itr->first);
597  ++itr;
598  }
599  } break;
600  }
601 
602  for (auto cur : cMap) {
603  PyIncRef(payload);
604  cur.second->SendNotification( notifyType, idType, payload, false ); // are any of these sequenced?
605  }
606 
607  PyDecRef(payload);
608 }
#define IsNPCCorp(itemID)
Definition: EVE_Defines.h:238
std::map< uint32, corpRole > m_corpMembers
Definition: EntityList.h:194
#define PyDecRef(op)
Definition: PyRep.h:57
#define PyIncRef(op)
Definition: PyRep.h:56
#define PySafeDecRef(op)
Definition: PyRep.h:61
bool HasShares(uint32 charID, uint32 corpID)

Here is the call graph for this function:

void EntityList::DeleteTargMgr ( SystemEntity pSE)
inline

Definition at line 157 of file EntityList.h.

References m_targMgrs.

157 { m_targMgrs.erase(pSE); }
std::unordered_map< SystemEntity *, TargetManager * > m_targMgrs
Definition: EntityList.h:188
Client * EntityList::FindClientByCharID ( uint32  charID) const

Definition at line 363 of file EntityList.cpp.

References m_players.

Referenced by Unicast().

364 {
365  std::map<uint32, Client*>::const_iterator itr = m_players.find(charID);
366  if (itr != m_players.end())
367  return itr->second;
368  return nullptr;
369 }
std::map< uint32, Client * > m_players
Definition: EntityList.h:180

Here is the caller graph for this function:

Client * EntityList::FindClientByName ( const char *  name) const
Todo:
Note
NOTE: TODO: HACK: the Find* methods below can get very expensive for many players

Definition at line 766 of file EntityList.cpp.

References RefPtr< X >::get(), m_players, and InventoryItem::name().

766  {
767  for (auto cur : m_players) {
768  CharacterRef cRef = cur.second->GetChar();
769  if (cRef.get() != nullptr)
770  if (strcmp(cRef->name(), name) == 0)
771  return cur.second;
772  }
773  return nullptr;
774 }
const char * name()
X * get() const
Definition: RefPtr.h:213
std::map< uint32, Client * > m_players
Definition: EntityList.h:180

Here is the call graph for this function:

SystemManager * EntityList::FindOrBootSystem ( uint32  systemID)

Definition at line 279 of file EntityList.cpp.

References _log, m_services, m_systems, SafeDelete(), and sDataMgr.

Referenced by Multicast().

279  {
280  if (!sDataMgr.IsSolarSystem(systemID)) {
281  _log(SERVER__INIT_ERR, "BootSystem() called with invalid systemID (%u)", systemID);
282  return nullptr;
283  }
284 
285  std::map<uint32, SystemManager*>::iterator itr = m_systems.find(systemID);
286  if (itr != m_systems.end())
287  return itr->second;
288 
289  SystemManager* pSM = new SystemManager(systemID, *m_services);
290  if ((pSM == nullptr) or (!pSM->BootSystem())) {
291  _log(SERVER__INIT_ERR, "BootSystem() - Booting system %u failed", systemID);
292  SafeDelete(pSM);
293  return nullptr;
294  }
295 
296  _log(SERVER__INIT, "BootSystem() - Booted system %u", systemID);
297  m_systems[systemID] = pSM;
298  return pSM;
299 }
#define _log(type, fmt,...)
Definition: logsys.h:124
std::map< uint32, SystemManager * > m_systems
Definition: EntityList.h:182
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
PyServiceMgr * m_services
Definition: EntityList.h:166
#define sDataMgr

Here is the call graph for this function:

Here is the caller graph for this function:

Agent * EntityList::GetAgent ( uint32  agentID)

Definition at line 310 of file EntityList.cpp.

References m_agents.

310  {
311  std::map<uint32, Agent*>::iterator res = m_agents.find(agentID);
312  if (res != m_agents.end())
313  return res->second;
314 
315  Agent* pAgent = new Agent(agentID);
316  if (!pAgent->Load()) {
317  delete pAgent;
318  return nullptr;
319  }
320  m_agents[agentID] = pAgent;
321  return pAgent;
322 }
std::map< uint32, Agent * > m_agents
Definition: EntityList.h:185
Definition: Agent.h:21
std::string EntityList::GetAnomalyID ( )

Definition at line 378 of file EntityList.cpp.

References alphaList, MakeRandomInt(), and str2().

379 {
380  // these should be totally unique. design a way to enforce this
381  std::string str1 = "", str2 = "";
382  for (uint8 i = 0; i < 3; ++i) {
383  str1 += alphaList[MakeRandomInt(0,25)]; //rand() % sizeof(alphaList) - 1
384  str2 += std::to_string(MakeRandomInt(0,9));
385  }
386 
387  std::string res = str1;
388  res += "-";
389  res += str2;
390  // not sure if we need to keep track of these IDs...
391  //m_anomIDs.push_back(res);
392  return res;
393 }
unsigned __int8 uint8
Definition: eve-compat.h:46
static const char alphaList[]
Definition: EVE_Consts.h:19
T str2(const char *str)
Generic string conversion template.
Definition: str2conv.h:39
int64 MakeRandomInt(int64 low, int64 high)
Generates random integer from interval [low; high].
Definition: misc.cpp:109

Here is the call graph for this function:

uint32 EntityList::GetClientCount ( ) const
inline

Definition at line 106 of file EntityList.h.

References m_clients.

106 { return m_clients.size(); }
std::vector< Client * > m_clients
Definition: EntityList.h:177
void EntityList::GetClients ( std::vector< Client * > &  result) const

Definition at line 324 of file EntityList.cpp.

References m_players.

324  {
325  for (auto cur : m_players)
326  result.push_back(cur.second);
327 }
std::map< uint32, Client * > m_players
Definition: EntityList.h:180
uint16 EntityList::GetClientSeed ( )
inline

Definition at line 110 of file EntityList.h.

References m_clientSeedID.

110 { return ++m_clientSeedID; }
uint16 m_clientSeedID
Definition: EntityList.h:202
uint32 EntityList::GetConnections ( )
inline

Definition at line 135 of file EntityList.h.

References m_connections.

135 { return m_connections; }
uint32 m_connections
Definition: EntityList.h:201
void EntityList::GetCorpClients ( std::vector< Client * > &  result,
uint32  corpID 
) const

Definition at line 329 of file EntityList.cpp.

References m_corpMembers.

329  {
330  std::map<uint32, corpRole>::const_iterator cItr = m_corpMembers.find(corpID);
331  if (cItr == m_corpMembers.end())
332  return;
333 
334  corpRole::const_iterator itr = cItr->second.begin(), end = cItr->second.end();
335  while (itr != end) {
336  if (itr->first != nullptr)
337  result.push_back(itr->first);
338  ++itr;
339  }
340 }
std::map< uint32, corpRole > m_corpMembers
Definition: EntityList.h:194
uint32 EntityList::GetMinutes ( )
inline

Definition at line 114 of file EntityList.h.

References m_minutes.

114 { return m_minutes; }
uint32 m_minutes
Definition: EntityList.h:200
uint32 EntityList::GetNPCCount ( )
inline

Definition at line 105 of file EntityList.h.

References m_npcs.

105 { return m_npcs; }
uint32 m_npcs
Definition: EntityList.h:198
uint32 EntityList::GetPlayerCount ( ) const
inline

Definition at line 107 of file EntityList.h.

References m_players.

107 { return m_players.size(); }
std::map< uint32, Client * > m_players
Definition: EntityList.h:180
uint32 EntityList::GetStamp ( )
inline

Definition at line 113 of file EntityList.h.

References m_stamp.

113 { return m_stamp; }
uint32 m_stamp
Definition: EntityList.h:199
int64 EntityList::GetStartTime ( )
inline

Definition at line 133 of file EntityList.h.

References m_startTime.

133 { return m_startTime; }
int64 m_startTime
Definition: EntityList.h:204
StationItemRef EntityList::GetStationByID ( uint32  stationID)

Definition at line 371 of file EntityList.cpp.

References m_stations.

371  {
372  std::map<uint32, StationItemRef>::iterator res = m_stations.find(stationID);
373  if (res != m_stations.end())
374  return res->second;
375  return StationItemRef(nullptr);
376 }
std::map< uint32, StationItemRef > m_stations
Definition: EntityList.h:183
uint32 EntityList::GetStationCount ( ) const
inline

Definition at line 109 of file EntityList.h.

References m_stations.

109 { return m_stations.size(); }
std::map< uint32, StationItemRef > m_stations
Definition: EntityList.h:183
void EntityList::GetStationGuestList ( uint32  stationID,
std::vector< Client * > &  result 
) const

Definition at line 343 of file EntityList.cpp.

References m_stations.

Referenced by Multicast().

343  {
344  std::map<uint32, StationItemRef>::const_iterator itr = m_stations.find(stationID);
345  if (itr != m_stations.end())
346  itr->second->GetGuestList(result);
347 }
std::map< uint32, StationItemRef > m_stations
Definition: EntityList.h:183

Here is the caller graph for this function:

uint32 EntityList::GetSystemCount ( ) const
inline

Definition at line 108 of file EntityList.h.

References m_systems.

108 { return m_systems.size(); }
std::map< uint32, SystemManager * > m_systems
Definition: EntityList.h:182
bool EntityList::GetTracking ( )
inline

Definition at line 129 of file EntityList.h.

References m_shipTracking.

129 { return m_shipTracking; }
bool m_shipTracking
Definition: EntityList.h:196
void EntityList::GetUpTime ( std::string &  time)

Definition at line 395 of file EntityList.cpp.

References m_stamp, and minutes.

396 {
397  float seconds = m_stamp - 1000;
398  float minutes = seconds/60;
399  float hours = minutes/60;
400  float days = hours/24;
401  float weeks = days/7;
402  float months = days/30;
403 
404  int s(fmod(seconds, 60));
405  int m(fmod(minutes, 60));
406  int h(fmod(hours, 24));
407  int d(fmod(days, 7));
408  int w(fmod(weeks, 4));
409  int M(fmod(months, 12));
410 
411  std::ostringstream uptime;
412  if (M) {
413  uptime << M << "M" << w << "w" << d << "d" << h << "h" << m << "m" << s << "s";
414  } else if (w) {
415  uptime << w << "w" << d << "d" << h << "h" << m << "m" << s << "s";
416  } else if (d) {
417  uptime << d << "d" << h << "h" << m << "m" << s << "s";
418  } else if (h) {
419  uptime << h << "h" << m << "m" << s << "s";
420  } else if (m) {
421  uptime << m << "m" << s << "s";
422  } else {
423  uptime << s << "s";
424  }
425 
426  //std::shared_ptr<const char*> ret = uptime.str().c_str();
427  time = uptime.str();
428 }
Respawn timer checks every u minutes
uint32 m_stamp
Definition: EntityList.h:199
bool EntityList::HasClients ( )
inline

Definition at line 90 of file EntityList.h.

References m_players.

90 { return !m_players.empty(); }
std::map< uint32, Client * > m_players
Definition: EntityList.h:180
void EntityList::Initialize ( )

Definition at line 79 of file EntityList.cpp.

References GetFileTimeNow(), is_log_enabled, m_clientSeedID, m_minuteTimer, m_stampTimer, m_startTime, m_targTimer, sConfig, ServiceDB::SetClientSeed(), sLog, and Timer::Start().

79  {
81 
82  /* start the timers */
83  m_targTimer.Start(250); // testing targeting and scan probes at 4/sec
84  m_stampTimer.Start(1000); // 1hz tic timer
85  m_minuteTimer.Start(60000); // does this need to be accurate?
86 
88  sLog.Green( " ServerInit", "ClientSeed Initialized." );
89 
90  if (is_log_enabled(SERVER__STACKTRACE))
91  sConfig.debug.StackTrace = true;
92 
93  sLog.Blue(" EntityList", "Entity Manager Initialized.");
94 }
#define sConfig
A macro for easier access to the singleton.
int64 m_startTime
Definition: EntityList.h:204
static uint32 SetClientSeed()
Definition: ServiceDB.cpp:34
#define is_log_enabled(type)
Definition: logsys.h:78
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
Timer m_minuteTimer
Definition: EntityList.h:172
uint16 m_clientSeedID
Definition: EntityList.h:202
Timer m_stampTimer
Definition: EntityList.h:171
double GetFileTimeNow()
Definition: utils_time.cpp:84
Timer m_targTimer
Definition: EntityList.h:173
void Start(uint32 setTimerTime=0, bool changeResetTimer=true)
Definition: timer.cpp:81

Here is the call graph for this function:

bool EntityList::IsOnline ( uint32  charID)

Definition at line 349 of file EntityList.cpp.

References m_players.

350 {
351  if (m_players.find(charID) == m_players.end())
352  return false;
353  return true;
354 }
std::map< uint32, Client * > m_players
Definition: EntityList.h:180
void EntityList::Multicast ( const char *  notifyType,
const char *  idType,
PyTuple **  in_payload,
NotificationDestination  target,
uint32  target_id,
bool  seq = true 
)

Definition at line 640 of file EntityList.cpp.

References FindOrBootSystem(), SystemManager::GetClientList(), GetStationGuestList(), m_corpMembers, NOTIF_DEST__CORPORATION, NOTIF_DEST__LOCATION, PyDecRef, PyIncRef, sDataMgr, sLog, and EvE::traceStack().

641 {
642  PyTuple* payload = *in_payload;
643  in_payload = nullptr;
644 
645  std::vector<Client*> cVec;
646  cVec.clear();
647  switch( target ) {
648  case NOTIF_DEST__LOCATION: {
649  if (sDataMgr.IsStation(targID)) {
650  GetStationGuestList(targID, cVec);
651  } else if (sDataMgr.IsSolarSystem(targID)) {
652  SystemManager* pSysMgr = FindOrBootSystem(targID);
653  if (pSysMgr == nullptr)
654  break;
655  pSysMgr->GetClientList(cVec);
656  } else {
657  sLog.Error("EntityList::Multicast 1", "DEST__LOCATION - location %u is neither station nor system", targID);
658  EvE::traceStack();
659  }
660  } break;
662  std::map<uint32, corpRole>::const_iterator cItr = m_corpMembers.find(targID);
663  if (cItr == m_corpMembers.end())
664  break;
665  corpRole::const_iterator itr = cItr->second.begin();
666  while (itr != cItr->second.end()) {
667  cVec.push_back(itr->first);
668  ++itr;
669  }
670  } break;
671  };
672 
673  for (auto cur : cVec) {
674  PyIncRef(payload);
675  cur->SendNotification( notifyType, idType, &payload, seq );
676  }
677 
678  PyDecRef( payload );
679 }
void GetClientList(std::vector< Client * > &cVec)
Python tuple.
Definition: PyRep.h:567
std::map< uint32, corpRole > m_corpMembers
Definition: EntityList.h:194
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
SystemManager * FindOrBootSystem(uint32 systemID)
Definition: EntityList.cpp:279
void GetStationGuestList(uint32 stationID, std::vector< Client * > &result) const
Definition: EntityList.cpp:343
#define PyDecRef(op)
Definition: PyRep.h:57
#define PyIncRef(op)
Definition: PyRep.h:56
void traceStack(void)
Definition: misc.cpp:169
#define sDataMgr

Here is the call graph for this function:

void EntityList::Multicast ( const char *  notifyType,
const char *  idType,
PyTuple **  payload,
const MulticastTarget mcset,
bool  seq = true 
)

Definition at line 682 of file EntityList.cpp.

References MulticastTarget::characters, MulticastTarget::corporations, FindOrBootSystem(), SystemManager::GetClientList(), GetStationGuestList(), MulticastTarget::locations, m_corpMembers, m_players, PyDecRef, PyIncRef, sDataMgr, sLog, and EvE::traceStack().

683 {
684  // consume payload
685  PyTuple* payload = *in_payload;
686  in_payload = nullptr;
687 
688  if (!mcset.characters.empty())
689  for (auto cur : mcset.characters) {
690  std::map<uint32, Client*>::iterator itr = m_players.find(cur);
691  if ( itr != m_players.end()) {
692  PyIncRef(payload);
693  itr->second->SendNotification( notifyType, idType, &payload, seq );
694  }
695  }
696 
697  if (!mcset.locations.empty()) {
698  SystemManager* pSysMgr(nullptr);
699  std::vector<Client*> cVec;
700  cVec.clear();
701  for (auto cur : mcset.locations) {
702  if (sDataMgr.IsStation(cur)) {
703  GetStationGuestList(cur, cVec);
704  } else if (sDataMgr.IsSolarSystem(cur)) {
705  pSysMgr = FindOrBootSystem(cur);
706  if (pSysMgr == nullptr)
707  continue;
708  pSysMgr->GetClientList(cVec);
709  } else {
710  sLog.Error("EntityList::Multicast 2", "location %u is neither station nor system", cur);
711  EvE::traceStack();
712  }
713  }
714  for (auto cur : cVec) {
715  PyIncRef(payload);
716  cur->SendNotification( notifyType, idType, &payload, seq );
717  }
718  }
719 
720  // this will need list of interested parties from corp. update this call to use CorpNotify() where possible.
721  if (!mcset.corporations.empty()) {
722  sLog.Error("EntityList::Multicast 2", "Corporation MulticastTarget called.");
723  EvE::traceStack();
724  for (auto cur : mcset.corporations) {
725  std::map<uint32, corpRole>::const_iterator cItr = m_corpMembers.find(cur);
726  if (cItr == m_corpMembers.end())
727  continue;
728  corpRole::const_iterator itr = cItr->second.begin();
729  while (itr != cItr->second.end()) {
730  PyIncRef(payload);
731  itr->first->SendNotification( notifyType, idType, &payload, seq );
732  ++itr;
733  }
734  }
735  }
736 
737  PyDecRef( payload );
738 }
std::set< uint32 > corporations
Definition: EntityList.h:60
Python tuple.
Definition: PyRep.h:567
std::map< uint32, corpRole > m_corpMembers
Definition: EntityList.h:194
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
SystemManager * FindOrBootSystem(uint32 systemID)
Definition: EntityList.cpp:279
void GetStationGuestList(uint32 stationID, std::vector< Client * > &result) const
Definition: EntityList.cpp:343
#define PyDecRef(op)
Definition: PyRep.h:57
#define PyIncRef(op)
Definition: PyRep.h:56
std::set< uint32 > characters
Definition: EntityList.h:58
std::map< uint32, Client * > m_players
Definition: EntityList.h:180
void traceStack(void)
Definition: misc.cpp:169
std::set< uint32 > locations
Definition: EntityList.h:59
#define sDataMgr

Here is the call graph for this function:

void EntityList::Multicast ( const character_set cset,
const PyAddress dest,
EVENotificationStream noti 
) const

Definition at line 630 of file EntityList.cpp.

References m_players.

630  {
631  std::map<uint32, Client*>::const_iterator itr = m_players.begin();
632  for (auto cur : cset) {
633  itr = m_players.find(cur);
634  if (itr != m_players.end())
635  itr->second->SendNotification(dest, noti);
636  }
637 }
std::map< uint32, Client * > m_players
Definition: EntityList.h:180
void EntityList::Multicast ( const character_set cset,
const char *  notifyType,
const char *  idType,
PyTuple **  payload,
bool  seq = true 
) const

Definition at line 740 of file EntityList.cpp.

References m_players, PyDecRef, and PyIncRef.

741 {
742  // consume payload
743  PyTuple* payload = *in_payload;
744  in_payload = nullptr;
745 
746  std::map<uint32, Client*>::const_iterator itr = m_players.begin();
747  for (auto cur : cset) {
748  itr = m_players.find(cur);
749  if (itr != m_players.end()) {
750  PyIncRef(payload);
751  itr->second->SendNotification(notifyType, idType, &payload, seq);
752  }
753  }
754  PyDecRef( payload );
755 }
Python tuple.
Definition: PyRep.h:567
#define PyDecRef(op)
Definition: PyRep.h:57
#define PyIncRef(op)
Definition: PyRep.h:56
std::map< uint32, Client * > m_players
Definition: EntityList.h:180
void EntityList::Process ( )
Todo:
test for adding OpenMP here to enable MP per system.

Definition at line 188 of file EntityList.cpp.

References Timer::Check(), Profile::entityS, GetTimeUSeconds(), m_clients, m_minutes, m_minuteTimer, m_players, m_probes, m_stamp, m_stampTimer, m_systems, m_targMgrs, m_targTimer, MapDB::ManipulateTimeData(), SafeDelete(), sBubbleMgr, sCivMgr, sConfig, sConsole, sLog, sMissionDataMgr, sMktMgr, sProfiler, and sWHMgr.

188  {
189  Client* pClient(nullptr);
190  std::vector<Client*>::iterator citr = m_clients.begin();
191  while (citr != m_clients.end()) {
192  if ((*citr)->ProcessNet()) {
193  ++citr;
194  } else {
195  pClient = *citr;
196  citr = m_clients.erase(citr);
197  SafeDelete(pClient);
198  }
199  }
200 
201  if (m_targTimer.Check()) {
202  std::unordered_map<SystemEntity*, TargetManager*>::iterator titr = m_targMgrs.begin();
203  while (titr != m_targMgrs.end()) {
204  if (titr->second->Process()) {
205  ++titr;
206  } else {
207  titr = m_targMgrs.erase(titr);
208  }
209  }
210  std::map<uint32, ProbeSE*>::iterator pitr = m_probes.begin();
211  while (pitr != m_probes.end()) {
212  if (pitr->second->ProcessTic()) {
213  ++pitr;
214  } else {
215  pitr = m_probes.erase(pitr);
216  }
217  }
218  }
219 
220  /* check for 1Hz timer tic */
221  if (m_stampTimer.Check()) {
222  double profileStartTime = GetTimeUSeconds();
223 
224  ++m_stamp;
225 
226  for (auto cur : m_players)
227  if (cur.second->IsValidSession()) // verify client is constructed before calling ProcessClient() on it
228  cur.second->ProcessClient();
229 
231  // this wont work....possibility of removing systems, therefore invalidating the iterator.
232  // bad things can happen if this is running parallel on MP
233  //#pragma omp parallel // starts a new team
234  std::map<uint32, SystemManager*>::iterator itr = m_systems.begin();
235  while (itr != m_systems.end()) {
236  if (itr->second == nullptr) { /* this shouldnt happen. log error to make note */
237  sLog.Error(" EntityList::Proc", "Deleting System %u", itr->first);
238  itr = m_systems.erase(itr);
239  continue;
240  } else if (!itr->second->ProcessTic()) { /* Process each loaded system */
241  itr->second->UnloadSystem();
242  SafeDelete(itr->second);
243  itr = m_systems.erase(itr);
244  continue;
245  }
246  ++itr;
247  }
248 
249  // these need 1Hz tics
250  sCivMgr.Process();
251  sBubbleMgr.Process();
252 
253  // these minute tics do not need to be precise
254  if (m_minuteTimer.Check()) {
255  ++m_minutes;
256  sMissionDataMgr.Process(); // 1m
257 
258  if (m_minutes % 5 == 0) { // ~5m
259  sWHMgr.Process();
260  // write something to tic corps vote cases.
261  for (auto cur : m_systems)
262  cur.second->UpdateData(); // update active system timers and dynamic data every 5m
263  }
264  if (m_minutes % 15 == 0) { // ~15m
265  //sMktBotMgr.Process(); // 15m to 30m
266  sConsole.UpdateStatus();
267  }
268  if (m_minutes % 60 == 0) { // ~1h
270  sMktMgr.Process(); // not used - does nothing at this time
271  }
272  }
273 
274  if (sConfig.debug.UseProfiling)
275  sProfiler.AddTime(Profile::entityS, GetTimeUSeconds() - profileStartTime);
276  }
277 }
#define sConfig
A macro for easier access to the singleton.
std::map< uint32, SystemManager * > m_systems
Definition: EntityList.h:182
#define sConsole
uint32 m_minutes
Definition: EntityList.h:200
#define sProfiler
Definition: dbcore.cpp:39
std::unordered_map< SystemEntity *, TargetManager * > m_targMgrs
Definition: EntityList.h:188
std::map< uint32, ProbeSE * > m_probes
Definition: EntityList.h:190
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
uint32 m_stamp
Definition: EntityList.h:199
double GetTimeUSeconds()
Definition: utils_time.cpp:116
Timer m_minuteTimer
Definition: EntityList.h:172
static void ManipulateTimeData()
Definition: MapDB.cpp:270
Timer m_stampTimer
Definition: EntityList.h:171
bool Check(bool reset=true)
Definition: timer.cpp:62
#define sMktMgr
Definition: MarketMgr.h:86
#define sMissionDataMgr
Definition: Client.h:66
#define sWHMgr
Definition: WormholeMgr.h:59
std::map< uint32, Client * > m_players
Definition: EntityList.h:180
Timer m_targTimer
Definition: EntityList.h:173
#define sCivMgr
Definition: CivilianMgr.h:45
#define sBubbleMgr
std::vector< Client * > m_clients
Definition: EntityList.h:177

Here is the call graph for this function:

PyRep * EntityList::PyIsOnline ( uint32  charID)

Definition at line 356 of file EntityList.cpp.

References m_players, and PyStatic.

357 {
358  if (m_players.find(charID) == m_players.end())
359  return PyStatic.NewFalse();
360  return PyStatic.NewTrue();
361 }
#define PyStatic
Definition: PyRep.h:1209
std::map< uint32, Client * > m_players
Definition: EntityList.h:180
void EntityList::RegisterSID ( int64 sessionID)
Todo:
this needs more work. hacked for now...

Definition at line 777 of file EntityList.cpp.

References m_sessions.

777  {
778  /* this whole method is just made up...eventually it will return a unique long long */
779  /* max for int64 = 9223372036854775807 */
780  std::set<int64>::iterator cur = m_sessions.find(sessionID);
781  std::pair<std::_Rb_tree_const_iterator<int64>, bool > test;
782  if (cur == m_sessions.end())
783  test = m_sessions.insert(sessionID);
784  if (test.second)
785  return;
786 }
std::set< int64 > m_sessions
Definition: EntityList.h:181
void EntityList::Remove ( Client pClient)

Definition at line 146 of file EntityList.cpp.

References m_clients.

146  {
147  /* note: will get expensive for many clients */
148  std::vector<Client*>::iterator itr = m_clients.begin();
149  for (; itr != m_clients.end(); ++itr)
150  if ((*itr) == pClient) {
151  m_clients.erase(itr);
152  return;
153  }
154 }
std::vector< Client * > m_clients
Definition: EntityList.h:177
void EntityList::RemoveNPC ( )
inline

Definition at line 83 of file EntityList.h.

References m_npcs.

83 { --m_npcs; }
uint32 m_npcs
Definition: EntityList.h:198
void EntityList::RemovePlayer ( Client pClient)

Definition at line 173 of file EntityList.cpp.

References Client::GetCharacterID(), Client::GetCharID(), Client::GetCorporationID(), Client::IsValidSession(), m_corpMembers, and m_players.

174 {
175  if (pClient != nullptr)
176  if (pClient->IsValidSession()) {
177  m_players.erase(pClient->GetCharacterID());
178  // remove player from corp map, if applicable
179  std::map<uint32, corpRole>::iterator itr = m_corpMembers.find(pClient->GetCorporationID());
180  if (itr != m_corpMembers.end())
181  itr->second.erase(pClient);
182  } else {
183  m_players.erase(pClient->GetCharID());
184  }
185 }
int32 GetCharacterID() const
Definition: Client.h:113
int32 GetCorporationID() const
Definition: Client.h:123
std::map< uint32, corpRole > m_corpMembers
Definition: EntityList.h:194
uint32 GetCharID()
Definition: Client.h:166
std::map< uint32, Client * > m_players
Definition: EntityList.h:180
bool IsValidSession()
Definition: Client.h:103

Here is the call graph for this function:

void EntityList::RemoveProbe ( uint32  probeID)
inline

Definition at line 162 of file EntityList.h.

References m_probes.

162 { m_probes.erase(probeID); }
std::map< uint32, ProbeSE * > m_probes
Definition: EntityList.h:190
void EntityList::RemoveSID ( int64  sessionID)

Definition at line 788 of file EntityList.cpp.

References m_sessions.

788  {
789  m_sessions.erase(sessionID);
790 }
std::set< int64 > m_sessions
Definition: EntityList.h:181
void EntityList::RemoveStation ( uint32  stationID)

Definition at line 306 of file EntityList.cpp.

References m_stations.

306  {
307  m_stations.erase(stationID);
308 }
std::map< uint32, StationItemRef > m_stations
Definition: EntityList.h:183
void EntityList::ResetStartTime ( )
inline

Definition at line 132 of file EntityList.h.

References GetFileTimeNow(), and m_startTime.

int64 m_startTime
Definition: EntityList.h:204
double GetFileTimeNow()
Definition: utils_time.cpp:84

Here is the call graph for this function:

void EntityList::SetService ( PyServiceMgr svc)
inline

Definition at line 84 of file EntityList.h.

References m_services.

Referenced by PyServiceMgr::PyServiceMgr().

84 { m_services = svc; }
PyServiceMgr * m_services
Definition: EntityList.h:166

Here is the caller graph for this function:

void EntityList::SetTracking ( bool  set = false)
inline

Definition at line 130 of file EntityList.h.

References m_shipTracking.

130 { m_shipTracking = set; }
bool m_shipTracking
Definition: EntityList.h:196
void EntityList::Shutdown ( )
Todo:
finish this.... halt server called from admin client. (gm command ingame) call d'tor on all connected clients server run loop will exit after control is returned from this function, which will clean up remaining items.

Definition at line 96 of file EntityList.cpp.

References m_clients, and SafeDelete().

96  {
102  for (auto cur : m_clients)
103  SafeDelete(cur);
104 
105  m_clients.clear();
106 }
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
std::vector< Client * > m_clients
Definition: EntityList.h:177

Here is the call graph for this function:

void EntityList::Unicast ( uint32  charID,
const char *  notifyType,
const char *  idType,
PyTuple **  payload,
bool  seq = true 
)

Definition at line 757 of file EntityList.cpp.

References FindClientByCharID(), and Client::SendNotification().

757  {
758  Client* pClient = FindClientByCharID(charID);
759  if (pClient != nullptr)
760  pClient->SendNotification( notifyType, idType, payload, seq );
761 }
void SendNotification(const PyAddress &dest, EVENotificationStream &noti, bool seq=true)
Definition: Client.cpp:2245
Definition: Client.h:66
Client * FindClientByCharID(uint32 charID) const
Definition: EntityList.cpp:363

Here is the call graph for this function:

Member Data Documentation

std::map<uint32, Agent*> EntityList::m_agents
private

Definition at line 185 of file EntityList.h.

Referenced by Close(), EntityList(), and GetAgent().

std::vector<std::string> EntityList::m_anomIDs
private

Definition at line 184 of file EntityList.h.

std::vector<Client*> EntityList::m_clients
private

Definition at line 177 of file EntityList.h.

Referenced by Add(), Close(), EntityList(), GetClientCount(), Process(), Remove(), and Shutdown().

uint16 EntityList::m_clientSeedID
private

Definition at line 202 of file EntityList.h.

Referenced by GetClientSeed(), and Initialize().

uint32 EntityList::m_connections
private

Definition at line 201 of file EntityList.h.

Referenced by Add(), and GetConnections().

std::map<uint32, corpRole> EntityList::m_corpMembers
private

Definition at line 194 of file EntityList.h.

Referenced by AddPlayer(), CorpNotify(), EntityList(), GetCorpClients(), Multicast(), and RemovePlayer().

uint32 EntityList::m_minutes
private

Definition at line 200 of file EntityList.h.

Referenced by GetMinutes(), and Process().

Timer EntityList::m_minuteTimer
private

Definition at line 172 of file EntityList.h.

Referenced by Initialize(), and Process().

uint32 EntityList::m_npcs
private

Definition at line 198 of file EntityList.h.

Referenced by AddNPC(), GetNPCCount(), and RemoveNPC().

std::map<uint32, ProbeSE*> EntityList::m_probes
private

Definition at line 190 of file EntityList.h.

Referenced by AddProbe(), EntityList(), Process(), and RemoveProbe().

PyServiceMgr* EntityList::m_services
protected

Definition at line 166 of file EntityList.h.

Referenced by FindOrBootSystem(), and SetService().

std::set<int64> EntityList::m_sessions
private

Definition at line 181 of file EntityList.h.

Referenced by RegisterSID(), and RemoveSID().

bool EntityList::m_shipTracking
private

Definition at line 196 of file EntityList.h.

Referenced by EntityList(), GetTracking(), and SetTracking().

uint32 EntityList::m_stamp
private

Definition at line 199 of file EntityList.h.

Referenced by GetStamp(), GetUpTime(), and Process().

Timer EntityList::m_stampTimer
private

Definition at line 171 of file EntityList.h.

Referenced by Initialize(), and Process().

int64 EntityList::m_startTime
private

Definition at line 204 of file EntityList.h.

Referenced by GetStartTime(), Initialize(), and ResetStartTime().

std::map<uint32, StationItemRef> EntityList::m_stations
private
std::map<uint32, SystemManager*> EntityList::m_systems
private

Definition at line 182 of file EntityList.h.

Referenced by Close(), EntityList(), FindOrBootSystem(), GetSystemCount(), and Process().

std::unordered_map<SystemEntity*, TargetManager*> EntityList::m_targMgrs
private

Definition at line 188 of file EntityList.h.

Referenced by AddTargMgr(), DeleteTargMgr(), EntityList(), and Process().

Timer EntityList::m_targTimer
private

Definition at line 173 of file EntityList.h.

Referenced by Initialize(), and Process().

Mutex EntityList::mMutex
protected

Definition at line 168 of file EntityList.h.


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