freg  0.3
Free-Roaming Elementary Game
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
Inventory Class Referenceabstract

Provides block ability to contain other blocks inside. More...

#include <Inventory.h>

Inheritance diagram for Inventory:
Inheritance graph
[legend]

Public Member Functions

Inventoryoperator= (Inventory &)=delete
 
 Inventory (Inventory &inv)=delete
 
virtual bool Drop (int src, int dest, int num, Inventory *to)
 Returns true on success. More...
 
virtual bool GetAll (Inventory *from)
 Returns true on success. More...
 
virtual bool Access () const
 
virtual bool Get (Block *block, int start=0)
 Returns true on success. More...
 
virtual void ReceiveSignal (QString)=0
 
virtual int Start () const
 
virtual int Weight () const
 
virtual QString FullName () const =0
 
virtual InventoryHasInventory ()=0
 
virtual bool GetExact (Block *block, int num)
 Returns true if block found its place. More...
 
virtual QString InvFullName (int num) const
 
void Pull (int num)
 Removes block from inventory. Does not delete block. More...
 
void MoveInside (int num_from, int num_to, int num)
 
bool MiniCraft (int num)
 Returns true on success (something has been crafted). More...
 
bool InscribeInv (int num, QString str)
 Returns true on success. More...
 
int GetInvSub (int i) const
 Returns AIR if slot number i is empty. More...
 
int GetInvKind (int i) const
 Returns BLOCK if slot number i is empty. More...
 
int Size () const
 
int GetInvWeight (int i) const
 
int Number (int i) const
 
BlockShowBlock (int slot) const
 
BlockShowBlockInSlot (int slot, int index) const
 Don't move block shown by this function. More...
 
bool IsEmpty () const
 
void Push (int x, int y, int z, int push_direction)
 
void Shake ()
 Stacks items in inventory if possible. More...
 

Protected Member Functions

 Inventory (int sz=INV_SIZE)
 It is not recommended to make inventory size more than 26. More...
 
 Inventory (QDataStream &str, int size=INV_SIZE)
 
virtual ~Inventory ()
 
virtual void SaveAttributes (QDataStream &out) const
 

Private Attributes

const quint8 size
 
QStack< Block * > *const inventory
 

Detailed Description

Provides block ability to contain other blocks inside.

Definition at line 33 of file Inventory.h.

Constructor & Destructor Documentation

Inventory::Inventory ( Inventory inv)
delete
Inventory::Inventory ( int  sz = INV_SIZE)
explicitprotected

It is not recommended to make inventory size more than 26.

Because it will not be convenient to deal with inventory in console version.

Definition at line 244 of file Inventory.cpp.

Inventory::Inventory ( QDataStream &  str,
int  size = INV_SIZE 
)
protected

Definition at line 249 of file Inventory.cpp.

Inventory::~Inventory ( )
protectedvirtual

Definition at line 264 of file Inventory.cpp.

Member Function Documentation

bool Inventory::Access ( ) const
virtual

Reimplemented in Dwarf.

Definition at line 29 of file Inventory.cpp.

bool Inventory::Drop ( int  src,
int  dest,
int  num,
Inventory to 
)
virtual

Returns true on success.

Reimplemented in Workbench.

Definition at line 31 of file Inventory.cpp.

QString Inventory::FullName ( ) const
pure virtual

Implemented in Converter, Bush, Workbench, Box, Container, Dwarf, RainMachine, Bucket, and Filter.

Definition at line 277 of file Inventory.cpp.

bool Inventory::Get ( Block block,
int  start = 0 
)
virtual

Returns true on success.

Reimplemented in Workbench, Bucket, and Filter.

Definition at line 78 of file Inventory.cpp.

bool Inventory::GetAll ( Inventory from)
virtual

Returns true on success.

Reimplemented in Workbench.

Definition at line 49 of file Inventory.cpp.

bool Inventory::GetExact ( Block block,
int  num 
)
virtual

Returns true if block found its place.

Reimplemented in Dwarf.

Definition at line 103 of file Inventory.cpp.

int Inventory::GetInvKind ( int  i) const

Returns BLOCK if slot number i is empty.

Definition at line 164 of file Inventory.cpp.

int Inventory::GetInvSub ( int  i) const

Returns AIR if slot number i is empty.

Definition at line 159 of file Inventory.cpp.

int Inventory::GetInvWeight ( int  i) const

Definition at line 154 of file Inventory.cpp.

Inventory * Inventory::HasInventory ( )
pure virtual

Implemented in Bush, Box, Dwarf, Container, RainMachine, and Bucket.

Definition at line 282 of file Inventory.cpp.

bool Inventory::InscribeInv ( int  num,
QString  str 
)

Returns true on success.

Definition at line 123 of file Inventory.cpp.

QString Inventory::InvFullName ( int  num) const
virtual

Reimplemented in Converter, Workbench, Dwarf, and Filter.

Definition at line 145 of file Inventory.cpp.

bool Inventory::IsEmpty ( ) const

Definition at line 187 of file Inventory.cpp.

bool Inventory::MiniCraft ( int  num)

Returns true on success (something has been crafted).

Definition at line 209 of file Inventory.cpp.

void Inventory::MoveInside ( int  num_from,
int  num_to,
int  num 
)

Definition at line 115 of file Inventory.cpp.

int Inventory::Number ( int  i) const

Definition at line 28 of file Inventory.cpp.

Inventory& Inventory::operator= ( Inventory )
delete
void Inventory::Pull ( int  num)

Removes block from inventory. Does not delete block.

Definition at line 59 of file Inventory.cpp.

void Inventory::Push ( int  x,
int  y,
int  z,
int  push_direction 
)

Definition at line 196 of file Inventory.cpp.

void Inventory::ReceiveSignal ( QString  )
pure virtual

Implemented in Bush, Box, Dwarf, Container, RainMachine, and Bucket.

Definition at line 275 of file Inventory.cpp.

void Inventory::SaveAttributes ( QDataStream &  out) const
protectedvirtual

Reimplemented in Converter, Bush, Box, Dwarf, Container, Bucket, and RainMachine.

Definition at line 65 of file Inventory.cpp.

void Inventory::Shake ( )

Stacks items in inventory if possible.

Definition at line 234 of file Inventory.cpp.

Block * Inventory::ShowBlock ( int  slot) const

Definition at line 182 of file Inventory.cpp.

Block * Inventory::ShowBlockInSlot ( int  slot,
int  index 
) const

Don't move block shown by this function.

Definition at line 177 of file Inventory.cpp.

int Inventory::Size ( ) const

Definition at line 27 of file Inventory.cpp.

int Inventory::Start ( ) const
virtual

Reimplemented in Workbench, and Dwarf.

Definition at line 26 of file Inventory.cpp.

int Inventory::Weight ( ) const
virtual

Reimplemented in Bush, Container, Dwarf, and Bucket.

Definition at line 169 of file Inventory.cpp.

Member Data Documentation

QStack<Block *>* const Inventory::inventory
private

Definition at line 92 of file Inventory.h.

const quint8 Inventory::size
private

Definition at line 91 of file Inventory.h.


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