EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SolarSystem.h
Go to the documentation of this file.
1 /*
2  ------------------------------------------------------------------------------------
3  LICENSE:
4  ------------------------------------------------------------------------------------
5  This file is part of EVEmu: EVE Online Server Emulator
6  Copyright 2006 - 2021 The EVEmu Team
7  For the latest information visit https://evemu.dev
8  ------------------------------------------------------------------------------------
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License along with
19  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20  Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21  http://www.gnu.org/copyleft/lesser.txt.
22  ------------------------------------------------------------------------------------
23  Author: Bloody.Rabbit
24 */
25 
26 #ifndef __SOLAR_SYSTEM__H__INCL__
27 #define __SOLAR_SYSTEM__H__INCL__
28 
29 
30 #include "EVEServerConfig.h"
31 #include "system/Celestial.h"
32 
37 public:
39  const GPoint &_minPos = GPoint(0, 0, 0),
40  const GPoint &_maxPos = GPoint(0, 0, 0),
41  double _luminosity = 0.0,
42  bool _border = false,
43  bool _fringe = false,
44  bool _corridor = false,
45  bool _hub = false,
46  bool _international = false,
47  bool _regional = false,
48  bool _constellation = false,
49  double _security = 0.0,
50  uint32 _factionID = 0,
51  double _radius = 0.0,
52  uint32 _sunTypeID = 0,
53  const char *_securityClass = ""
54  );
55 
56  // Data members:
59  double luminosity;
60 
61  // use bitfield to save some memory...
62  bool border :1;
63  bool fringe :1;
64  bool corridor :1;
65  bool hub :1;
66  bool international :1;
67  bool regional :1;
68  bool constellation :1;
69 
70  double security;
72  double radius;
74  std::string securityClass;
75 };
76 
81 : public CelestialObject
82 {
83  friend class InventoryItem; // to let it construct us
84  friend class CelestialObject; // to let it construct us
85 public:
93  static SolarSystemRef Load( uint32 solarSystemID);
94 
95  /*
96  * Public Fields:
97  */
98  const GPoint & minPosition() const { return m_minPosition; }
99  const GPoint & maxPosition() const { return m_maxPosition; }
100  double luminosity() const { return m_luminosity; }
101 
102  bool border() const { return m_border; }
103  bool fringe() const { return m_fringe; }
104  bool corridor() const { return m_corridor; }
105  bool hub() const { return m_hub; }
106  bool international() const { return m_international; }
107  bool regional() const { return m_regional; }
108  bool constellation() const { return m_constellation; }
109 
110  double security() const { return m_security; }
111  uint32 factionID() const { return m_factionID; }
112  double radius() const { return m_radius; }
113  const std::string & securityClass() const { return m_securityClass; }
114 
115  // Solar System Inventory Functions:
118 
119 protected:
120  SolarSystem(
121  uint32 _solarSystemID,
122  // InventoryItem stuff:
123  const ItemType &_type,
124  const ItemData &_data,
125  // CelestialObject stuff:
126  const CelestialObjectData &_cData,
127  // SolarSystem stuff:
128  const SolarSystemData &_ssData
129  );
130  virtual ~SolarSystem();
131 
132  /*
133  * Member functions:
134  */
135  using InventoryItem::_Load;
136  virtual bool _Load();
137 
138  // Template loader:
139  template<class _Ty>
140  static RefPtr<_Ty> _LoadItem( uint32 solarSystemID, const ItemType &type, const ItemData &data) {
141  if (type.groupID() != EVEDB::invGroups::Solar_System) {
142  _log(ITEM__ERROR, "Trying to load %s as SolarSystem.", sDataMgr.GetCategoryName(type.categoryID()));
143  if (sConfig.debug.StackTrace)
144  EvE::traceStack();
145  return RefPtr<_Ty>();
146  }
147 
148  // load celestial data
150  if (!sItemFactory.db()->GetCelestialObject(solarSystemID, cData))
151  return RefPtr<_Ty>();
152 
153  // load solar system data
155  SolarSystemData ssData = SolarSystemData();
156  if( !sItemFactory.db()->GetSolarSystem( solarSystemID, ssData ) )
157  return RefPtr<_Ty>();
158 
159  return SolarSystemRef( new SolarSystem(solarSystemID, type, data, cData, ssData ) );
160  }
161 
162  /*
163  * Data members:
164  */
165  bool m_border :1;
166  bool m_fringe :1;
167  bool m_corridor :1;
168  bool m_hub :1;
170  bool m_regional :1;
172 
174 
175  double m_security;
176  double m_radius;
177  double m_luminosity;
178 
179  std::string m_securityClass;
182 };
183 
184 #endif /* !__SOLAR_SYSTEM__H__INCL__ */
185 
bool fringe() const
Definition: SolarSystem.h:103
double luminosity() const
Definition: SolarSystem.h:100
#define sConfig
A macro for easier access to the singleton.
double radius() const
Definition: SolarSystem.h:112
SolarSystemData(const GPoint &_minPos=GPoint(0, 0, 0), const GPoint &_maxPos=GPoint(0, 0, 0), double _luminosity=0.0, bool _border=false, bool _fringe=false, bool _corridor=false, bool _hub=false, bool _international=false, bool _regional=false, bool _constellation=false, double _security=0.0, uint32 _factionID=0, double _radius=0.0, uint32 _sunTypeID=0, const char *_securityClass="")
Definition: SolarSystem.cpp:49
#define _log(type, fmt,...)
Definition: logsys.h:124
uint16 groupID() const
Definition: ItemType.h:64
double luminosity
Definition: SolarSystem.h:59
GPoint m_minPosition
Definition: SolarSystem.h:180
const GPoint & minPosition() const
Definition: SolarSystem.h:98
const std::string & securityClass() const
Definition: SolarSystem.h:113
GPoint maxPosition
Definition: SolarSystem.h:58
GPoint minPosition
Definition: SolarSystem.h:57
virtual bool _Load()
RefPtr< SolarSystem > SolarSystemRef
Definition: ItemRef.h:65
bool m_corridor
Definition: SolarSystem.h:167
uint8 categoryID() const
Definition: ItemType.h:66
const ItemType & type() const
bool constellation() const
Definition: SolarSystem.h:108
static RefPtr< _Ty > _LoadItem(uint32 solarSystemID, const ItemType &type, const ItemData &data)
Definition: SolarSystem.h:140
Definition: gpoint.h:33
double m_radius
Definition: SolarSystem.h:176
const GPoint & maxPosition() const
Definition: SolarSystem.h:99
static SolarSystemRef Load(uint32 solarSystemID)
bool regional() const
Definition: SolarSystem.h:107
bool m_regional
Definition: SolarSystem.h:170
bool hub() const
Definition: SolarSystem.h:105
SolarSystem(uint32 _solarSystemID, const ItemType &_type, const ItemData &_data, const CelestialObjectData &_cData, const SolarSystemData &_ssData)
Definition: SolarSystem.cpp:86
double m_security
Definition: SolarSystem.h:175
virtual ~SolarSystem()
uint32 factionID
Definition: SolarSystem.h:71
void RemoveItemFromInventory(InventoryItemRef iRef)
GPoint m_maxPosition
Definition: SolarSystem.h:181
virtual bool _Load()
unsigned __int32 uint32
Definition: eve-compat.h:50
bool border() const
Definition: SolarSystem.h:102
bool corridor() const
Definition: SolarSystem.h:104
double m_luminosity
Definition: SolarSystem.h:177
std::string m_securityClass
Definition: SolarSystem.h:179
std::string securityClass
Definition: SolarSystem.h:74
uint32 factionID() const
Definition: SolarSystem.h:111
void traceStack(void)
Definition: misc.cpp:169
#define sItemFactory
Definition: ItemFactory.h:165
uint32 sunTypeID
Definition: SolarSystem.h:73
uint32 m_factionID
Definition: SolarSystem.h:173
double security() const
Definition: SolarSystem.h:110
bool m_international
Definition: SolarSystem.h:169
bool m_constellation
Definition: SolarSystem.h:171
void AddItemToInventory(InventoryItemRef iRef)
bool international() const
Definition: SolarSystem.h:106
#define sDataMgr