EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SolarSystem.cpp
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 #include "eve-server.h"
27 
28 #include "system/SolarSystem.h"
29 
33 /*
34  Border = Borders another Region or Constellation
35  Fringe = 1 connection to this system (dead end system)
36  Corridor = 2 connections to this system (in one side and out the other)
37  Hub = 3+ connections to this system
38  International = always has Border/Constellation, almost always Regional
39  Regional = always has Border/Constellation
40  Constellation = always the same as Border
41  Security = If it is positive, floor to nearest 1/10th gives the in-game security level. 0 or lower are 0.0 in-game.
42  */
43 
46 /*
47  * SolarSystemData
48  */
50  const GPoint &_minPos,
51  const GPoint &_maxPos,
52  double _luminosity,
53  bool _border,
54  bool _fringe,
55  bool _corridor,
56  bool _hub,
57  bool _international,
58  bool _regional,
59  bool _constellation,
60  double _security,
61  uint32 _factionID,
62  double _radius,
63  uint32 _sunTypeID,
64  const char *_securityClass)
65 : minPosition(_minPos),
66  maxPosition(_maxPos),
67  luminosity(_luminosity),
68  border(_border),
69  fringe(_fringe),
70  corridor(_corridor),
71  hub(_hub),
72  international(_international),
73  regional(_regional),
74  constellation(_constellation),
75  security(_security),
76  factionID(_factionID),
77  radius(_radius),
78  sunTypeID(_sunTypeID),
79  securityClass(_securityClass)
80 {
81 }
82 
83 /*
84  * SolarSystem
85  */
87  uint32 _solarSystemID,
88  const ItemType &_type,
89  const ItemData &_data,
90  const CelestialObjectData &_cData,
91  const SolarSystemData &_ssData)
92 : CelestialObject(_solarSystemID, _type, _data, _cData),
93  m_minPosition(_ssData.minPosition),
94  m_maxPosition(_ssData.maxPosition),
95  m_luminosity(_ssData.luminosity),
96  m_border(_ssData.border),
97  m_fringe(_ssData.fringe),
98  m_corridor(_ssData.corridor),
99  m_hub(_ssData.hub),
100  m_international(_ssData.international),
101  m_regional(_ssData.regional),
102  m_constellation(_ssData.constellation),
103  m_security(_ssData.security),
104  m_factionID(_ssData.factionID),
105  m_radius(_ssData.radius),
106  m_securityClass(_ssData.securityClass)
107 {
109 
110  _log(ITEM__TRACE, "Created SolarSystem Item %p for %s (%u).", this, name(), m_itemID);
111 }
112 
114  if (pInventory != nullptr)
115  pInventory->Unload();
117 }
118 
120 {
121  return InventoryItem::Load<SolarSystem>(solarSystemID);
122 }
123 
125 {
126  return CelestialObject::_Load();
127 }
128 
130 {
131  _log(ITEM__TRACE, "SS::AddItemToInventory() - adding %s(%u) to inventory of %s(%u)",\
132  iRef->name(), iRef->itemID(), name(), m_itemID);
133  AddItem( iRef );
134 }
135 
137 {
138  _log(ITEM__TRACE, "SS::RemoveItemFromInventory() - removing item %s(%u) from inventory of %s(%u)",\
139  iRef->name(), iRef->itemID(), name(), m_itemID);
140  RemoveItem( iRef );
141 }
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
virtual void RemoveItem(InventoryItemRef iRef)
virtual void AddItem(InventoryItemRef iRef)
virtual bool _Load()
const char * name()
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
void Unload()
Definition: Inventory.cpp:62
Definition: gpoint.h:33
static SolarSystemRef Load(uint32 solarSystemID)
Inventory * pInventory
SolarSystem(uint32 _solarSystemID, const ItemType &_type, const ItemData &_data, const CelestialObjectData &_cData, const SolarSystemData &_ssData)
Definition: SolarSystem.cpp:86
virtual ~SolarSystem()
void RemoveItemFromInventory(InventoryItemRef iRef)
virtual bool _Load()
unsigned __int32 uint32
Definition: eve-compat.h:50
RefPtr< InventoryItem > InventoryItemRef
Definition: ItemRef.h:52
void AddItemToInventory(InventoryItemRef iRef)
uint32 itemID() const
Definition: InventoryItem.h:98