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

#include "SovereigntyDataMgr.h"

Inheritance diagram for SovereigntyDataMgr:
Collaboration diagram for SovereigntyDataMgr:

Private Types

typedef
boost::multi_index_container
< SovereigntyData,
boost::multi_index::indexed_by
< boost::multi_index::hashed_non_unique
< boost::multi_index::tag
< SovDataBySolarSystem >
, boost::multi_index::member
< SovereigntyData, uint32,&SovereigntyData::solarSystemID >
>, boost::multi_index::hashed_non_unique
< boost::multi_index::tag
< SovDataByConstellation >
, boost::multi_index::member
< SovereigntyData, uint32,&SovereigntyData::constellationID >
>, boost::multi_index::hashed_non_unique
< boost::multi_index::tag
< SovDataByRegion >
, boost::multi_index::member
< SovereigntyData, uint32,&SovereigntyData::regionID >
>, boost::multi_index::hashed_unique
< boost::multi_index::tag
< SovDataByClaim >
, boost::multi_index::member
< SovereigntyData, uint32,&SovereigntyData::claimID >
>, boost::multi_index::hashed_non_unique
< boost::multi_index::tag
< SovDataByAlliance >
, boost::multi_index::member
< SovereigntyData, uint32,&SovereigntyData::allianceID > > > > 
SovDataContainer
 

Private Attributes

SovDataContainer m_sovData
 

SovereigntyDataMgr.cpp

memory object caching system for managing and saving ingame static and dynamic station data

: James

Date
: 21Apr13
 SovereigntyDataMgr ()
 
 ~SovereigntyDataMgr ()
 
int Initialize ()
 
void Clear ()
 
void Close ()
 
void GetInfo ()
 
PyRepGetSystemSovereignty (uint32 systemID)
 
PyRepGetAllianceSystems ()
 
PyRepGetCurrentSovData (uint32 locationID)
 
PyRepGetAllianceBeacons (uint32 allianceID)
 
uint32 GetSystemAllianceID (uint32 systemID)
 
void AddSovClaim (SovereigntyData data)
 
void RemoveSovClaim (uint32 systemID)
 
void MarkContested (uint32 systemID, bool contested)
 
SovereigntyData GetSovereigntyData (uint32 systemID)
 
void UpdateSystemHubID (uint32 systemID, uint32 hubID)
 
void UpdateSystemJammerID (uint32 systemID, uint32 jammerID)
 
void UpdateSystemBeaconID (uint32 systemID, uint32 beaconID)
 
void UpdateClaim (uint32 systemID)
 
void Populate ()
 

Additional Inherited Members

- Public Member Functions inherited from Singleton< SovereigntyDataMgr >
 Singleton ()
 Primary constructor. More...
 
- Static Public Member Functions inherited from Singleton< SovereigntyDataMgr >
static SovereigntyDataMgrget ()
 
- Static Protected Attributes inherited from Singleton< SovereigntyDataMgr >
static std::shared_ptr
< SovereigntyDataMgr
mInstance
 

Detailed Description

Definition at line 23 of file SovereigntyDataMgr.h.

Member Typedef Documentation

typedef boost::multi_index_container< SovereigntyData, boost::multi_index::indexed_by< boost::multi_index::hashed_non_unique< boost::multi_index::tag<SovDataBySolarSystem>, boost::multi_index::member<SovereigntyData, uint32, &SovereigntyData::solarSystemID> >, boost::multi_index::hashed_non_unique< boost::multi_index::tag<SovDataByConstellation>, boost::multi_index::member<SovereigntyData, uint32, &SovereigntyData::constellationID> >, boost::multi_index::hashed_non_unique< boost::multi_index::tag<SovDataByRegion>, boost::multi_index::member<SovereigntyData, uint32, &SovereigntyData::regionID> >, boost::multi_index::hashed_unique< boost::multi_index::tag<SovDataByClaim>, boost::multi_index::member<SovereigntyData, uint32, &SovereigntyData::claimID> >, boost::multi_index::hashed_non_unique< boost::multi_index::tag<SovDataByAlliance>, boost::multi_index::member<SovereigntyData, uint32, &SovereigntyData::allianceID> > > > SovereigntyDataMgr::SovDataContainer
private

Definition at line 77 of file SovereigntyDataMgr.h.

Constructor & Destructor Documentation

SovereigntyDataMgr::SovereigntyDataMgr ( )

Definition at line 18 of file SovereigntyDataMgr.cpp.

References m_sovData.

19 {
20  m_sovData.clear();
21 }
SovDataContainer m_sovData
SovereigntyDataMgr::~SovereigntyDataMgr ( )

Definition at line 23 of file SovereigntyDataMgr.cpp.

24 {
25  //Clear();
26 }

Member Function Documentation

void SovereigntyDataMgr::AddSovClaim ( SovereigntyData  data)

Definition at line 290 of file SovereigntyDataMgr.cpp.

References _log, SovereigntyDB::AddSovereigntyData(), m_sovData, SovereigntyData::solarSystemID, and UpdateClaim().

291 {
292  _log(SOV__INFO, "AddSovClaim() - Adding claim for %u to DataMgr...", data.solarSystemID);
293 
294  //Add a new sovereignty claim to DB
295  uint32 claimID(0);
296  SovereigntyDB::AddSovereigntyData(data, claimID);
297  _log(SOV__DEBUG, "AddSovClaim() - ClaimID %u added to DB...", claimID);
298 
299  //Define our view from container
300  auto &bySolar = m_sovData.get<SovDataBySolarSystem>();
301 
302  //Delete existing records in container which match the systemID
303  auto it = m_sovData.get<SovDataBySolarSystem>().find(data.solarSystemID);
304  if (it != m_sovData.get<SovDataBySolarSystem>().end())
305  {
306  bySolar.erase(data.solarSystemID);
307  }
308 
310 }
void UpdateClaim(uint32 systemID)
#define _log(type, fmt,...)
Definition: logsys.h:124
static void AddSovereigntyData(SovereigntyData data, uint32 &claimID)
unsigned __int32 uint32
Definition: eve-compat.h:50
SovDataContainer m_sovData

Here is the call graph for this function:

void SovereigntyDataMgr::Clear ( )

Definition at line 44 of file SovereigntyDataMgr.cpp.

References m_sovData.

45 {
46  //for (auto cur : m_sovPyData)
47  // PySafeDecRef(cur.second);
48  m_sovData.clear();
49  //m_sovPyData.clear();
50 }
SovDataContainer m_sovData
void SovereigntyDataMgr::Close ( )
Todo:
put a save method here which will save anything changed before shutdown

Definition at line 35 of file SovereigntyDataMgr.cpp.

References sLog.

36 {
38  //for (auto cur : m_sovPyData)
39  // PySafeDecRef(cur.second);
40 
41  sLog.Warning(" SovereigntyDataMgr", "Sovereignty Data Manager has been closed.");
42 }
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
PyRep * SovereigntyDataMgr::GetAllianceBeacons ( uint32  allianceID)

Definition at line 203 of file SovereigntyDataMgr.cpp.

References _log, PyList::AddItem(), EVEDB::invTypes::CynosuralGeneratorArray, m_sovData, and PyTuple::SetItem().

204 {
205  PyList* list = new PyList();
206  for (SovereigntyData const &sData : boost::make_iterator_range(
207  m_sovData.get<SovDataByAlliance>().equal_range(allianceID)))
208  {
209  // Don't add systems where no beacon exists
210  if (sData.beaconID == 0) {
211  continue;
212  }
213  _log(SOV__DEBUG, "== data (GetAllianceBeacons()) ==");
214  _log(SOV__DEBUG, "solarSystemID: %u", sData.solarSystemID);
215  _log(SOV__DEBUG, "beaconID: %u", sData.beaconID);
216  _log(SOV__DEBUG, "==========");
217 
218  PyTuple* tuple = new PyTuple(3);
219  tuple->SetItem(0, new PyInt(sData.solarSystemID));
220  tuple->SetItem(1, new PyInt(sData.beaconID));
222  list->AddItem(tuple);
223  }
224  return list;
225 }
#define _log(type, fmt,...)
Definition: logsys.h:124
Python tuple.
Definition: PyRep.h:567
void AddItem(PyRep *i)
Definition: PyRep.h:701
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610
Python integer.
Definition: PyRep.h:231
SovDataContainer m_sovData
Python list.
Definition: PyRep.h:639

Here is the call graph for this function:

PyRep * SovereigntyDataMgr::GetAllianceSystems ( )

Definition at line 184 of file SovereigntyDataMgr.cpp.

References _log, PyList::AddItem(), m_sovData, and PyDict::SetItemString().

185 {
186  PyList *list = new PyList();
187  for (auto &it : m_sovData.get<SovDataBySolarSystem>())
188  {
189  _log(SOV__DEBUG, "== data (GetAllianceSystems()) ==");
190  _log(SOV__DEBUG, "claimID: %u", it.claimID);
191  _log(SOV__DEBUG, "solarSystemID: %u", it.solarSystemID);
192  _log(SOV__DEBUG, "allianceID: %u", it.allianceID);
193  _log(SOV__DEBUG, "==========");
194 
195  PyDict *dict = new PyDict();
196  dict->SetItemString("allianceID", new PyInt(it.allianceID));
197  dict->SetItemString("solarSystemID", new PyInt(it.solarSystemID));
198  list->AddItem(new PyObject("util.KeyVal", dict));
199  }
200  return list;
201 }
#define _log(type, fmt,...)
Definition: logsys.h:124
Python's dictionary.
Definition: PyRep.h:719
void AddItem(PyRep *i)
Definition: PyRep.h:701
Python object.
Definition: PyRep.h:826
Python integer.
Definition: PyRep.h:231
SovDataContainer m_sovData
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:

PyRep * SovereigntyDataMgr::GetCurrentSovData ( uint32  locationID)

Definition at line 227 of file SovereigntyDataMgr.cpp.

References DBRowDescriptor::AddColumn(), DBTYPE_I2, DBTYPE_I4, IsConstellationID, IsRegionID, m_sovData, CRowSet::NewRow(), sDataMgr, and PyPackedRow::SetField().

228 {
229  DBRowDescriptor *header = new DBRowDescriptor();
230  header->AddColumn("locationID", DBTYPE_I4);
231  header->AddColumn("allianceID", DBTYPE_I4);
232  header->AddColumn("stationCount", DBTYPE_I2);
233  header->AddColumn("militaryPoints", DBTYPE_I2);
234  header->AddColumn("industrialPoints", DBTYPE_I2);
235  header->AddColumn("claimedFor", DBTYPE_I4);
236  CRowSet *rowset = new CRowSet(&header);
237 
238  if (IsConstellationID(locationID))
239  {
240  for (SovereigntyData const &sData : boost::make_iterator_range(
241  m_sovData.get<SovDataByConstellation>().equal_range(locationID)))
242  {
243  PyPackedRow *row = rowset->NewRow();
244  row->SetField("locationID", new PyInt(sData.solarSystemID));
245  row->SetField("allianceID", new PyInt(sData.allianceID));
246  row->SetField("stationCount", new PyInt(sData.stationCount));
247  row->SetField("militaryPoints", new PyInt(sData.militaryPoints));
248  row->SetField("industrialPoints", new PyInt(sData.industrialPoints));
249  row->SetField("claimedFor", new PyInt(sData.allianceID));
250  }
251  }
252  //Get all unique alliances in the region who hold sovereignty
253  else if (IsRegionID(locationID))
254  {
255  std::vector<uint32> cv;
256  for (SovereigntyData const &sData : boost::make_iterator_range(
257  m_sovData.get<SovDataByRegion>().equal_range(locationID)))
258  {
259  if (!(std::find(cv.begin(), cv.end(), sData.constellationID) != cv.end()))
260  {
261  PyPackedRow *row = rowset->NewRow();
262  row->SetField("locationID", new PyInt(sData.constellationID));
263  row->SetField("allianceID", new PyInt(sData.allianceID));
264  row->SetField("stationCount", new PyInt(sData.stationCount));
265  row->SetField("militaryPoints", new PyInt(sData.militaryPoints));
266  row->SetField("industrialPoints", new PyInt(sData.industrialPoints));
267  row->SetField("claimedFor", new PyInt(sData.allianceID));
268  cv.push_back(sData.constellationID);
269  }
270  }
271  }
272  else if (sDataMgr.IsSolarSystem(locationID))
273  {
274  for (SovereigntyData const &sData : boost::make_iterator_range(
275  m_sovData.get<SovDataByRegion>().equal_range(locationID)))
276  {
277  PyPackedRow *row = rowset->NewRow();
278  row->SetField("locationID", new PyInt(sData.solarSystemID));
279  row->SetField("allianceID", new PyInt(sData.allianceID));
280  row->SetField("stationCount", new PyInt(sData.stationCount));
281  row->SetField("militaryPoints", new PyInt(sData.militaryPoints));
282  row->SetField("industrialPoints", new PyInt(sData.industrialPoints));
283  row->SetField("claimedFor", new PyInt(sData.allianceID));
284  }
285  }
286 
287  return rowset;
288 }
#define IsConstellationID(itemID)
Definition: EVE_Defines.h:276
void AddColumn(const char *name, DBTYPE type)
Definition: PyDatabase.cpp:96
Python object "blue.DBRowDescriptor".
Definition: PyDatabase.h:41
Python object "dbutil.CRowset".
Definition: PyDatabase.h:124
Python integer.
Definition: PyRep.h:231
bool SetField(uint32 index, PyRep *value)
Definition: PyRep.cpp:1031
PyPackedRow * NewRow()
Definition: PyDatabase.cpp:132
Packed row.
Definition: PyRep.h:961
#define IsRegionID(itemID)
Definition: EVE_Defines.h:273
SovDataContainer m_sovData
#define sDataMgr

Here is the call graph for this function:

void SovereigntyDataMgr::GetInfo ( )

Definition at line 92 of file SovereigntyDataMgr.cpp.

93 {
94  /* return info about loaded items? */
95  /*
96  * m_sovData;
97  *
98  */
99 }
SovereigntyData SovereigntyDataMgr::GetSovereigntyData ( uint32  systemID)

Definition at line 112 of file SovereigntyDataMgr.cpp.

References m_sovData.

113 {
114  auto it = m_sovData.get<SovDataBySolarSystem>().find(systemID);
115  if (it != m_sovData.get<SovDataBySolarSystem>().end())
116  {
117  SovereigntyData sData = *it;
118  return sData;
119  } else
120  {
121  //Return empty object in case we don't find anything
122  SovereigntyData sData;
123  return sData;
124  }
125 }
SovDataContainer m_sovData
uint32 SovereigntyDataMgr::GetSystemAllianceID ( uint32  systemID)

Definition at line 101 of file SovereigntyDataMgr.cpp.

References SovereigntyData::allianceID, and m_sovData.

102 {
103  auto it = m_sovData.get<SovDataBySolarSystem>().find(systemID);
104  if (it != m_sovData.get<SovDataBySolarSystem>().end())
105  {
106  SovereigntyData sData = *it;
107  return sData.allianceID;
108  }
109  return 0;
110 }
SovDataContainer m_sovData
PyRep * SovereigntyDataMgr::GetSystemSovereignty ( uint32  systemID)

Definition at line 127 of file SovereigntyDataMgr.cpp.

References _log, SovereigntyData::allianceID, args, SovereigntyData::claimID, SovereigntyData::claimStructureID, SovereigntyData::claimTime, SovereigntyData::constellationID, SovereigntyData::contested, SovereigntyData::corporationID, SystemData::factionID, SovereigntyData::hubID, m_sovData, PyStatic, sDataMgr, PyDict::SetItemString(), and SovereigntyData::solarSystemID.

128 {
129  SystemData sysData = SystemData();
130  PyDict *args = new PyDict();
131 
132  //Figure out if this system is in empire space
133  sDataMgr.GetSystemData(systemID, sysData);
134 
135  if (sysData.factionID)
136  { //If we have a factionID, we can set the system's sov data to it
137  args->SetItemString("contested", PyStatic.NewZero());
138  args->SetItemString("corporationID", PyStatic.NewZero());
139  args->SetItemString("claimTime", new PyLong(0));
140  args->SetItemString("claimStructureID", PyStatic.NewZero());
141  args->SetItemString("hubID", PyStatic.NewZero());
142  args->SetItemString("allianceID", new PyInt(sysData.factionID));
143  args->SetItemString("solarSystemID", new PyInt(systemID));
144  _log(SOV__INFO, "SovereigntyDataMgr::GetSystemSovereignty(): Faction system %u found, assigning factionID as allianceID.", systemID);
145  }
146  else
147  {
148  auto it = m_sovData.get<SovDataBySolarSystem>().find(systemID);
149  if (it != m_sovData.get<SovDataBySolarSystem>().end())
150  {
151  SovereigntyData sData = *it;
152  _log(SOV__INFO, "SovereigntyDataMgr::GetSystemSovereignty(): Found sov data for solarSystemID %u.", systemID);
153  _log(SOV__DEBUG, "== data (GetSystemSovereignty()) ==");
154  _log(SOV__DEBUG, "claimID: %u", sData.claimID);
155  _log(SOV__DEBUG, "solarSystemID: %u", sData.solarSystemID);
156  _log(SOV__DEBUG, "constellationID: %u", sData.constellationID);
157  _log(SOV__DEBUG, "corporationID: %u", sData.corporationID);
158  _log(SOV__DEBUG, "allianceID: %u", sData.allianceID);
159  _log(SOV__DEBUG, "claimStructureID: %u", sData.claimStructureID);
160  _log(SOV__DEBUG, "==========");
161  args->SetItemString("contested", new PyInt(sData.contested));
162  args->SetItemString("corporationID", new PyInt(sData.corporationID));
163  args->SetItemString("claimTime", new PyLong(sData.claimTime));
164  args->SetItemString("claimStructureID", new PyInt(sData.claimStructureID));
165  args->SetItemString("hubID", new PyInt(sData.hubID));
166  args->SetItemString("allianceID", new PyInt(sData.allianceID));
167  args->SetItemString("solarSystemID", new PyInt(sData.solarSystemID));
168  }
169  else
170  {
171  _log(SOV__INFO, "SovereigntyDataMgr::GetSystemSovereignty(): No data for solarSystemID %u. Sending blank SovereigntyData object.", systemID);
172  args->SetItemString("contested", PyStatic.NewNone());
173  args->SetItemString("corporationID", PyStatic.NewNone());
174  args->SetItemString("claimTime", PyStatic.NewNone());
175  args->SetItemString("claimStructureID", PyStatic.NewNone());
176  args->SetItemString("hubID", PyStatic.NewNone());
177  args->SetItemString("allianceID", PyStatic.NewNone());
178  args->SetItemString("solarSystemID", new PyInt(systemID));
179  }
180  }
181  return new PyObject("util.KeyVal", args);
182 }
#define _log(type, fmt,...)
Definition: logsys.h:124
Python's dictionary.
Definition: PyRep.h:719
uint32 factionID
* args
Python object.
Definition: PyRep.h:826
Python integer.
Definition: PyRep.h:231
#define PyStatic
Definition: PyRep.h:1209
SovDataContainer m_sovData
void SetItemString(const char *key, PyRep *value)
SetItemString adds or sets a database entry.
Definition: PyRep.h:812
Python long integer.
Definition: PyRep.h:261
#define sDataMgr

Here is the call graph for this function:

int SovereigntyDataMgr::Initialize ( )

Definition at line 28 of file SovereigntyDataMgr.cpp.

References Populate(), and sLog.

29 {
30  Populate();
31  sLog.Blue(" SovereigntyDataMgr", "Sovereignty Data Manager Initialized.");
32  return 1;
33 }
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250

Here is the call graph for this function:

void SovereigntyDataMgr::MarkContested ( uint32  systemID,
bool  contested 
)

Definition at line 312 of file SovereigntyDataMgr.cpp.

References _log, SovereigntyDB::SetContested(), and UpdateClaim().

313 {
314  _log(SOV__INFO, "MarkContested() - Marking system %u as state %u", systemID, int(contested));
315 
316  //Update state in DB
317  SovereigntyDB::SetContested(systemID, contested);
318 
319  //Re-sync the claim data
320  UpdateClaim(systemID);
321 }
void UpdateClaim(uint32 systemID)
#define _log(type, fmt,...)
Definition: logsys.h:124
static void SetContested(uint32 systemID, bool contested)

Here is the call graph for this function:

void SovereigntyDataMgr::Populate ( )
protected

Definition at line 52 of file SovereigntyDataMgr.cpp.

References SovereigntyData::allianceID, SovereigntyData::beaconID, SovereigntyData::claimID, SovereigntyData::claimStructureID, SovereigntyData::claimTime, SovereigntyData::constellationID, SovereigntyData::contested, SovereigntyData::corporationID, DBResultRow::GetInt64(), DBQueryResult::GetRow(), SovereigntyDB::GetSovereigntyData(), GetTimeMSeconds(), DBResultRow::GetUInt(), SovereigntyData::hubID, SovereigntyData::industrialPoints, SovereigntyData::jammerID, m_sovData, SovereigntyData::militaryPoints, SovereigntyData::regionID, SafeDelete(), sLog, SovereigntyData::solarSystemID, and SovereigntyData::stationCount.

Referenced by Initialize().

53 {
54  double start = GetTimeMSeconds();
55  DBQueryResult *res = new DBQueryResult();
56  DBResultRow row;
57 
58  std::map<int8, int32>::iterator itr;
59 
60  //This data is added by solar system, so we need to use that tag here
61  auto &bySolar = m_sovData.get<SovDataBySolarSystem>();
62 
64  while (res->GetRow(row))
65  {
67  sData.solarSystemID = row.GetUInt(0);
68  sData.constellationID = row.GetUInt(1);
69  sData.regionID = row.GetUInt(2);
70  sData.corporationID = row.GetUInt(3);
71  sData.allianceID = row.GetUInt(4);
72  sData.claimStructureID = row.GetUInt(5);
73  sData.claimTime = row.GetInt64(6);
74  sData.hubID = row.GetUInt(7);
75  sData.contested = row.GetUInt(8);
76  sData.stationCount = row.GetUInt(9);
77  sData.militaryPoints = row.GetUInt(10);
78  sData.industrialPoints = row.GetUInt(11);
79  sData.claimID = row.GetUInt(12);
80  sData.beaconID = row.GetUInt(13);
81  sData.jammerID = row.GetUInt(14);
82  bySolar.insert(sData);
83  }
84 
85  sLog.Cyan(" SovereigntyDataMgr", "%u Sovereignty data sets loaded in %.3fms.",
86  bySolar.size(), (GetTimeMSeconds() - start));
87 
88  //cleanup
89  SafeDelete(res);
90 }
uint32 GetUInt(uint32 index) const
Definition: dbcore.cpp:658
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
double GetTimeMSeconds()
Definition: utils_time.cpp:104
int64 GetInt64(uint32 index) const
Definition: dbcore.cpp:670
SovDataContainer m_sovData
static void GetSovereigntyData(DBQueryResult &res)

Here is the call graph for this function:

Here is the caller graph for this function:

void SovereigntyDataMgr::RemoveSovClaim ( uint32  systemID)

Definition at line 323 of file SovereigntyDataMgr.cpp.

References _log, m_sovData, and SovereigntyDB::RemoveSovereigntyData().

324 {
325  _log(SOV__INFO, "RemoveSovClaim() - Removing claim for %u from DataMgr...", systemID);
326 
327  //Delete sovereignty claim from DB
329  _log(SOV__DEBUG, "RemoveSovClaim() - Claim for %u removed from DB...", systemID);
330 
331  //Remove claim from container
332  auto &bySolar = m_sovData.get<SovDataBySolarSystem>();
333  bySolar.erase(systemID);
334 }
static void RemoveSovereigntyData(uint32 systemID)
#define _log(type, fmt,...)
Definition: logsys.h:124
SovDataContainer m_sovData

Here is the call graph for this function:

void SovereigntyDataMgr::UpdateClaim ( uint32  systemID)

Definition at line 370 of file SovereigntyDataMgr.cpp.

References SovereigntyData::allianceID, SovereigntyData::beaconID, SovereigntyData::claimID, SovereigntyData::claimStructureID, SovereigntyData::claimTime, SovereigntyData::constellationID, SovereigntyData::contested, SovereigntyData::corporationID, DBResultRow::GetInt64(), DBQueryResult::GetRow(), SovereigntyDB::GetSovereigntyDataForSystem(), DBResultRow::GetUInt(), SovereigntyData::hubID, SovereigntyData::industrialPoints, SovereigntyData::jammerID, m_sovData, SovereigntyData::militaryPoints, SovereigntyData::regionID, SafeDelete(), SovereigntyData::solarSystemID, and SovereigntyData::stationCount.

Referenced by AddSovClaim(), MarkContested(), UpdateSystemBeaconID(), UpdateSystemHubID(), and UpdateSystemJammerID().

371 {
372  //Define our view from container
373  auto &bySolar = m_sovData.get<SovDataBySolarSystem>();
374 
375  //Remove old from container
376  bySolar.erase(systemID);
377 
378  //Get the data from the DB, this will avoid inconsistencies
379  DBQueryResult *res = new DBQueryResult();
380  DBResultRow row;
381 
383  while (res->GetRow(row))
384  {
386  sData.solarSystemID = row.GetUInt(0);
387  sData.constellationID = row.GetUInt(1);
388  sData.regionID = row.GetUInt(2);
389  sData.corporationID = row.GetUInt(3);
390  sData.allianceID = row.GetUInt(4);
391  sData.claimStructureID = row.GetUInt(5);
392  sData.claimTime = row.GetInt64(6);
393  sData.hubID = row.GetUInt(7);
394  sData.contested = row.GetUInt(8);
395  sData.stationCount = row.GetUInt(9);
396  sData.militaryPoints = row.GetUInt(10);
397  sData.industrialPoints = row.GetUInt(11);
398  sData.claimID = row.GetUInt(12);
399  sData.beaconID = row.GetUInt(13);
400  sData.jammerID = row.GetUInt(14);
401  bySolar.insert(sData);
402  }
403  SafeDelete(res);
404 }
uint32 GetUInt(uint32 index) const
Definition: dbcore.cpp:658
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
bool GetRow(DBResultRow &into)
Definition: dbcore.cpp:552
int64 GetInt64(uint32 index) const
Definition: dbcore.cpp:670
SovDataContainer m_sovData
static void GetSovereigntyDataForSystem(DBQueryResult &res, uint32 systemID)

Here is the call graph for this function:

Here is the caller graph for this function:

void SovereigntyDataMgr::UpdateSystemBeaconID ( uint32  systemID,
uint32  beaconID 
)

Definition at line 358 of file SovereigntyDataMgr.cpp.

References _log, SovereigntyDB::SetBeaconID(), and UpdateClaim().

359 {
360  _log(SOV__INFO, "UpdateSystemBeaconID() - Updating beaconID for system %u with beacon %u", systemID, beaconID);
361 
362  //Update state in DB
363  SovereigntyDB::SetBeaconID(systemID, beaconID);
364 
365  //Re-sync the claim data
366  UpdateClaim(systemID);
367 }
void UpdateClaim(uint32 systemID)
#define _log(type, fmt,...)
Definition: logsys.h:124
static void SetBeaconID(uint32 systemID, uint32 beaconID)

Here is the call graph for this function:

void SovereigntyDataMgr::UpdateSystemHubID ( uint32  systemID,
uint32  hubID 
)

Definition at line 336 of file SovereigntyDataMgr.cpp.

References _log, SovereigntyDB::SetHubID(), and UpdateClaim().

337 {
338  _log(SOV__INFO, "UpdateSystemHubID() - Updating hubID for system %u with hub %u", systemID, hubID);
339 
340  //Update state in DB
341  SovereigntyDB::SetHubID(systemID, hubID);
342 
343  //Re-sync the claim data
344  UpdateClaim(systemID);
345 }
void UpdateClaim(uint32 systemID)
#define _log(type, fmt,...)
Definition: logsys.h:124
static void SetHubID(uint32 systemID, uint32 hubID)

Here is the call graph for this function:

void SovereigntyDataMgr::UpdateSystemJammerID ( uint32  systemID,
uint32  jammerID 
)

Definition at line 347 of file SovereigntyDataMgr.cpp.

References _log, SovereigntyDB::SetJammerID(), and UpdateClaim().

348 {
349  _log(SOV__INFO, "UpdateSystemJammerID() - Updating jammerID for system %u with jammer %u", systemID, jammerID);
350 
351  //Update state in DB
352  SovereigntyDB::SetJammerID(systemID, jammerID);
353 
354  //Re-sync the claim data
355  UpdateClaim(systemID);
356 }
void UpdateClaim(uint32 systemID)
#define _log(type, fmt,...)
Definition: logsys.h:124
static void SetJammerID(uint32 systemID, uint32 jammerID)

Here is the call graph for this function:

Member Data Documentation


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