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

#include "StationOffice.h"

Inheritance diagram for StationOffice:
Collaboration diagram for StationOffice:

Public Member Functions

const ItemTypetype () const
 
bool IsEmpty ()
 
bool IsLoaded ()
 
void SetLoaded (bool set=false)
 
- Public Member Functions inherited from InventoryItem
 InventoryItem (uint32 _itemID, const ItemType &_type, const ItemData &_data)
 
 InventoryItem (const InventoryItem &oth)
 
 InventoryItem (InventoryItem &&oth) noexcept
 
InventoryItemoperator= (const InventoryItem &oth)=delete
 
InventoryItemoperator= (InventoryItem &&oth)=delete
 
virtual ~InventoryItem () noexcept
 
virtual ShipItemGetShipItem ()
 
virtual ModuleItemGetModuleItem ()
 
virtual bool IsShipItem ()
 
virtual bool IsModuleItem ()
 
virtual void Rename (std::string name)
 
InventoryGetMyInventory ()
 
bool contraband () const
 
bool isSingleton () const
 
int32 quantity () const
 
uint32 itemID () const
 
uint32 ownerID () const
 
uint32 locationID () const
 
EVEItemFlags flag () const
 
const GPointposition () const
 
const ItemTypetype () const
 
const std::string & itemName () const
 
const std::string & customInfo () const
 
const char * name ()
 
uint16 typeID () const
 
uint16 groupID () const
 
double radius () const
 
uint8 categoryID () const
 
bool isGlobal () const
 
bool IsOnline ()
 
void SetPosition (const GPoint &pos)
 
void SetCustomInfo (const char *ci)
 
void ChangeOwner (uint32 new_owner, bool notify=false)
 
void Move (uint32 new_location=locTemp, EVEItemFlags flag=flagNone, bool notify=false)
 
void Donate (uint32 new_owner=ownerSystem, uint32 new_location=locTemp, EVEItemFlags new_flag=flagNone, bool notify=true)
 
void SendItemChange (uint32 toID, std::map< int32, PyRep * > &changes)
 
void MergeTypesInCargo (ShipItem *pShip, EVEItemFlags flag=flagNone)
 
bool ChangeSingleton (bool singleton, bool notify=false)
 
bool AlterQuantity (int32 qty, bool notify=false)
 
bool SetQuantity (int32 qty, bool notify=false, bool deleteOnZero=true)
 
bool SetFlag (EVEItemFlags flag, bool notify=false)
 
void SetOwner (uint32 ownerID)
 
void SaveItem ()
 
void UpdateLocation ()
 
void UpdateLocation (uint32 locID)
 
virtual void Delete ()
 
virtual InventoryItemRef Split (int32 qty=0, bool notify=true, bool silent=false)
 
virtual bool Merge (InventoryItemRef to_merge, int32 qty=0, bool notify=true)
 
virtual void Relocate (uint32 locID=0, EVEItemFlags flag=flagNone)
 
double GetPackagedVolume ()
 
virtual void SetPlayer (Client *pClient)
 
virtual bool HasPilot ()
 
virtual ClientGetPilot ()
 
void ToVirtual (uint32 locationID)
 
virtual bool _Load ()
 
PyRepGetItem () const
 
void GetItemRow (PyPackedRow *into) const
 
void GetItemStatusRow (PyPackedRow *into) const
 
void GetChargeStatusRow (uint32 shipID, PyPackedRow *into) const
 
bool Populate (Rsp_CommonGetInfo_Entry &into)
 
PyListGetItemInfo () const
 
PyObjectItemGetInfo ()
 
PyPackedRowGetItemRow () const
 
PyPackedRowGetItemStatusRow () const
 
PyPackedRowGetChargeStatusRow (uint32 shipID) const
 
bool SkillCheck (InventoryItemRef refItem)
 
void ClearModifiers ()
 
void AddModifier (fxData &data)
 
void RemoveModifier (fxData &data)
 
void ResetAttributes ()
 
bool HasReqSkill (const uint16 skillID)
 
AttributeMapGetAttributeMap ()
 
int64 GetTimeStamp ()
 
void SetAttribute (uint16 attrID, int num, bool notify=true)
 
void SetAttribute (uint16 attrID, uint32 num, bool notify=true)
 
void SetAttribute (uint16 attrID, int64 num, bool notify=true)
 
void SetAttribute (uint16 attrID, float num, bool notify=true)
 
void SetAttribute (uint16 attrID, double num, bool notify=true)
 
void SetAttribute (uint16 attrID, EvilNumber num, bool notify=true)
 
void MultiplyAttribute (uint16 attrID, EvilNumber num, bool notify=false)
 
bool HasAttribute (const uint16 attrID) const
 
bool HasAttribute (const uint16 attrID, EvilNumber &value) const
 
bool SaveAttributes ()
 
void ResetAttribute (uint16 attrID, bool notify=false)
 
void DeleteAttribute (uint16 attrID)
 
EvilNumber GetAttribute (const uint16 attrID) const
 
EvilNumber GetDefaultAttribute (const uint16 attrID) const
 
- Public Member Functions inherited from RefObject
 RefObject (size_t initRefCount)
 Initializes reference count. More...
 
virtual ~RefObject ()
 Destructor; must be virtual. More...
 
size_t GetCount ()
 

Protected Member Functions

virtual PyRepGetItem () const
 
- Protected Member Functions inherited from RefObject
void IncRef () const
 Increments reference count of object by one. More...
 
void DecRef () const
 Decrements reference count of object by one. More...
 

Static Protected Member Functions

template<class _Ty >
static RefPtr< _Ty > _LoadItem (uint32 officeID, const ItemType &type, const ItemData &idata)
 
- Static Protected Member Functions inherited from InventoryItem
template<class _Ty >
static RefPtr< _Ty > Load (uint32 itemID)
 
template<class _Ty >
static RefPtr< _Ty > _Load (uint32 itemID)
 
template<class _Ty >
static RefPtr< _Ty > _LoadItem (uint32 itemID, const ItemType &type, const ItemData &data)
 

Private Attributes

OfficeData m_data
 
bool m_loaded
 

Friends

class InventoryItem
 

StationOffice.cpp

station office item class derived from container

: Allan

Date
: 14Dec17
 StationOffice (uint32 _officeID, const ItemType &_itemType, const ItemData &_data, const OfficeData &_odata)
 
virtual ~StationOffice ()
 
void ValidateAddItem (EVEItemFlags flag, InventoryItemRef item) const
 
virtual void AddItem (InventoryItemRef item)
 
virtual void RemoveItem (InventoryItemRef item)
 
PyObjectStationOfficeGetInfo ()
 
static StationOfficeRef Load (uint32 officeID)
 
static StationOfficeRef Spawn (ItemData &idata, OfficeData &odata)
 

Additional Inherited Members

- Static Public Member Functions inherited from InventoryItem
static uint32 CreateItemID (ItemData &data)
 
static uint32 CreateTempItemID (ItemData &data)
 
static InventoryItemRef Load (uint32 itemID)
 
static InventoryItemRef SpawnItem (uint32 itemID, const ItemData &data)
 
static InventoryItemRef Spawn (ItemData &data)
 
static InventoryItemRef SpawnTemp (ItemData &data)
 
- Public Attributes inherited from InventoryItem
std::multimap< int8, fxDatam_modifiers
 
- Protected Attributes inherited from InventoryItem
InventorypInventory
 
uint32 m_itemID
 
AttributeMappAttributeMap
 
- Protected Attributes inherited from RefObject
size_t mRefCount
 Reference count of instance. More...
 
bool mDeleted
 

Detailed Description

Definition at line 19 of file StationOffice.h.

Constructor & Destructor Documentation

StationOffice::StationOffice ( uint32  _officeID,
const ItemType _itemType,
const ItemData _data,
const OfficeData _odata 
)

Definition at line 26 of file StationOffice.cpp.

References _log, InventoryItem::itemID(), m_loaded, InventoryItem::name(), and InventoryItem::pInventory.

Referenced by _LoadItem().

27 : InventoryItem(_officeID, _containerType, _data),
28 m_data(_odata)
29 {
30  m_loaded = false;
32  _log(ITEM__TRACE, "Created StationOffice object for item %s (%u).", name(), itemID());
33 }
friend class InventoryItem
Definition: StationOffice.h:22
#define _log(type, fmt,...)
Definition: logsys.h:124
OfficeData m_data
Definition: StationOffice.h:68
const char * name()
Inventory * pInventory
RefPtr< InventoryItem > InventoryItemRef
Definition: ItemRef.h:52
uint32 itemID() const
Definition: InventoryItem.h:98

Here is the call graph for this function:

Here is the caller graph for this function:

StationOffice::~StationOffice ( )
virtual

Definition at line 35 of file StationOffice.cpp.

References InventoryItem::pInventory, SafeDelete(), and Inventory::Unload().

36 {
37  if (pInventory != nullptr)
38  pInventory->Unload();
40 }
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
Definition: SafeMem.h:83
void Unload()
Definition: Inventory.cpp:62
Inventory * pInventory

Here is the call graph for this function:

Member Function Documentation

template<class _Ty >
static RefPtr<_Ty> StationOffice::_LoadItem ( uint32  officeID,
const ItemType type,
const ItemData idata 
)
inlinestaticprotected

Definition at line 50 of file StationOffice.h.

References _log, StationDB::GetOfficeData(), ItemType::id(), sConfig, StationOffice(), and EvE::traceStack().

50  {
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  }
RefPtr< StationOffice > StationOfficeRef
Definition: ItemRef.h:67
#define sConfig
A macro for easier access to the singleton.
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
static bool GetOfficeData(uint32 officeID, OfficeData &odata)
Definition: StationDB.cpp:68
void traceStack(void)
Definition: misc.cpp:169
Reference-counting-based smart pointer.
Definition: RefPtr.h:133

Here is the call graph for this function:

void StationOffice::AddItem ( InventoryItemRef  item)
virtual

Reimplemented from InventoryItem.

Definition at line 91 of file StationOffice.cpp.

References InventoryItem::AddItem(), RefPtr< X >::get(), and m_loaded.

92 {
93  if (!m_loaded)
94  return; // make error here?
95 
96  if (iRef.get() == nullptr)
97  return;
98 
100 }
virtual void AddItem(InventoryItemRef iRef)

Here is the call graph for this function:

virtual PyRep* StationOffice::GetItem ( ) const
inlineprotectedvirtual

Definition at line 65 of file StationOffice.h.

References InventoryItem::GetItemRow().

65 { return GetItemRow(); }
PyPackedRow * GetItemRow() const

Here is the call graph for this function:

bool StationOffice::IsEmpty ( )
inline

Definition at line 39 of file StationOffice.h.

References InventoryItem::GetMyInventory(), IsEmpty(), and m_loaded.

Referenced by IsEmpty().

39 { return (m_loaded ? GetMyInventory()->IsEmpty() : false); }
Inventory * GetMyInventory()
Definition: InventoryItem.h:91

Here is the call graph for this function:

Here is the caller graph for this function:

bool StationOffice::IsLoaded ( )
inline

Definition at line 40 of file StationOffice.h.

References m_loaded.

40 { return m_loaded; }
StationOfficeRef StationOffice::Load ( uint32  officeID)
static

Definition at line 42 of file StationOffice.cpp.

Referenced by Spawn().

43 {
44  return InventoryItem::Load<StationOffice>(officeID );
45 }

Here is the caller graph for this function:

void StationOffice::RemoveItem ( InventoryItemRef  item)
virtual

Reimplemented from InventoryItem.

Definition at line 102 of file StationOffice.cpp.

References RefPtr< X >::get(), m_loaded, and InventoryItem::RemoveItem().

103 {
104  if (!m_loaded)
105  return; // make error here?
106 
107  if (iRef.get() == nullptr)
108  return;
109 
111 }
virtual void RemoveItem(InventoryItemRef iRef)

Here is the call graph for this function:

void StationOffice::SetLoaded ( bool  set = false)
inline

Definition at line 42 of file StationOffice.h.

References m_loaded.

42 { m_loaded = set; }
StationOfficeRef StationOffice::Spawn ( ItemData idata,
OfficeData odata 
)
static

we are NOT loading office contents for every office on station load. this will be done on first corp member docking to this station

Todo:
maybe later make config option to load corp hangars on station load.

Definition at line 58 of file StationOffice.cpp.

References StationDB::CreateOffice(), and Load().

Referenced by ItemFactory::SpawnOffice().

58  {
59  uint32 officeID = StationDB::CreateOffice(idata, odata);
60  if (officeID == 0 )
61  return StationOfficeRef(nullptr);
62 
63  return StationOffice::Load(officeID );
64 }
RefPtr< StationOffice > StationOfficeRef
Definition: ItemRef.h:67
static StationOfficeRef Load(uint32 officeID)
unsigned __int32 uint32
Definition: eve-compat.h:50
static uint32 CreateOffice(ItemData &idata, OfficeData &odata)
Definition: StationDB.cpp:17

Here is the call graph for this function:

Here is the caller graph for this function:

PyObject * StationOffice::StationOfficeGetInfo ( )

Definition at line 73 of file StationOffice.cpp.

References codelog, Inventory::LoadContents(), InventoryItem::m_itemID, InventoryItem::name(), InventoryItem::pInventory, and InventoryItem::Populate().

73  {
74  if (!pInventory->LoadContents( ) ) {
75  codelog( ITEM__ERROR, "%s (%u): Failed to load contents for StationOfficeGetInfo", name(), m_itemID );
76  return nullptr;
77  }
78 
79  Rsp_CommonGetInfo result;
80  Rsp_CommonGetInfo_Entry entry;
81 
82  //first populate the StationOffice.
83  if (!Populate( entry ) )
84  return nullptr; //print already done.
85 
86  result.items[ m_itemID ] = entry.Encode();
87 
88  return result.Encode();
89 }
const char * name()
Inventory * pInventory
#define codelog(type, fmt,...)
Definition: logsys.h:128
bool Populate(Rsp_CommonGetInfo_Entry &into)
bool LoadContents()
Definition: Inventory.cpp:113

Here is the call graph for this function:

const ItemType& StationOffice::type ( ) const
inline

Definition at line 35 of file StationOffice.h.

References InventoryItem::type().

35 { return InventoryItem::type(); }
const ItemType & type() const

Here is the call graph for this function:

void StationOffice::ValidateAddItem ( EVEItemFlags  flag,
InventoryItemRef  item 
) const

Definition at line 66 of file StationOffice.cpp.

References Inventory::HasAvailableSpace(), m_loaded, and InventoryItem::pInventory.

66  {
67  if (!m_loaded)
68  return; // make error here?
69 
71 }
bool HasAvailableSpace(EVEItemFlags flag, InventoryItemRef iRef) const
Definition: Inventory.cpp:625
Inventory * pInventory
EVEItemFlags flag() const

Here is the call graph for this function:

Friends And Related Function Documentation

friend class InventoryItem
friend

Definition at line 22 of file StationOffice.h.

Member Data Documentation

OfficeData StationOffice::m_data
private

Definition at line 68 of file StationOffice.h.

bool StationOffice::m_loaded
private

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