EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
StationOffice.h
Go to the documentation of this file.
1 
11 #ifndef EVE_STATION_OFFICE_H
12 #define EVE_STATION_OFFICE_H
13 
14 
15 #include "EVEServerConfig.h"
17 #include "station/StationDB.h"
18 
20 : public InventoryItem
21 {
22  friend class InventoryItem; // to let it construct us
23 public:
24  StationOffice(uint32 _officeID, const ItemType& _itemType, const ItemData& _data, const OfficeData& _odata);
25  virtual ~StationOffice();
26 
27  static StationOfficeRef Load( uint32 officeID);
28  static StationOfficeRef Spawn( ItemData& idata, OfficeData& odata);
29 
31 
32  virtual void AddItem(InventoryItemRef item);
33  virtual void RemoveItem(InventoryItemRef item);
34 
35  const ItemType& type() const { return InventoryItem::type(); }
36 
38 
39  bool IsEmpty() { return (m_loaded ? GetMyInventory()->IsEmpty() : false); }
40  bool IsLoaded() { return m_loaded; }
41 
42  void SetLoaded(bool set=false) { m_loaded = set; }
43 
44 protected:
46  //virtual bool _Load();
47 
48  // Template loader:
49  template<class _Ty>
50  static RefPtr<_Ty> _LoadItem( uint32 officeID, const ItemType& type, const ItemData& idata) {
51  if (type.id() != 27) {
52  _log(ITEM__ERROR, "Trying to load itemID %u as Office.", type.id());
53  if (sConfig.debug.StackTrace)
55  return RefPtr<_Ty>();
56  }
57 
58  OfficeData odata = OfficeData();
59  if (!StationDB::GetOfficeData(officeID, odata))
60  return RefPtr<_Ty>();
61 
62  return StationOfficeRef(new StationOffice(officeID, type, idata, odata));
63  }
64 
65  virtual PyRep* GetItem() const { return GetItemRow(); }
66 
67 private:
69 
70  bool m_loaded;
71 
72 };
73 
74 #endif //EVE_STATION_OFFICE_H
75 
Base Python wire object.
Definition: PyRep.h:66
RefPtr< StationOffice > StationOfficeRef
Definition: ItemRef.h:67
#define sConfig
A macro for easier access to the singleton.
PyPackedRow * GetItemRow() const
StationOffice(uint32 _officeID, const ItemType &_itemType, const ItemData &_data, const OfficeData &_odata)
#define _log(type, fmt,...)
Definition: logsys.h:124
uint16 id() const
Definition: ItemType.h:63
EVEItemFlags
Definition: EVE_Flags.h:13
static StationOfficeRef Load(uint32 officeID)
virtual bool _Load()
OfficeData m_data
Definition: StationOffice.h:68
itemID[count] Create count or of the specified item(from Insider)" ) COMMAND( goto
virtual ~StationOffice()
const ItemType & type() const
PyObject * StationOfficeGetInfo()
Python object.
Definition: PyRep.h:826
static RefPtr< _Ty > _LoadItem(uint32 officeID, const ItemType &type, const ItemData &idata)
Definition: StationOffice.h:50
static bool GetOfficeData(uint32 officeID, OfficeData &odata)
Definition: StationDB.cpp:68
const ItemType & type() const
Definition: StationOffice.h:35
unsigned __int32 uint32
Definition: eve-compat.h:50
EVEItemFlags flag() const
virtual PyRep * GetItem() const
Definition: StationOffice.h:65
void SetLoaded(bool set=false)
Definition: StationOffice.h:42
static StationOfficeRef Spawn(ItemData &idata, OfficeData &odata)
void traceStack(void)
Definition: misc.cpp:169
Inventory * GetMyInventory()
Definition: InventoryItem.h:91
virtual void AddItem(InventoryItemRef item)
Reference-counting-based smart pointer.
Definition: RefPtr.h:133
virtual void RemoveItem(InventoryItemRef item)
void ValidateAddItem(EVEItemFlags flag, InventoryItemRef item) const