freg
0.3
Free-Roaming Elementary Game
|
Provides block ability to contain other blocks inside. More...
#include <Inventory.h>
Public Member Functions | |
Inventory & | operator= (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 Inventory * | HasInventory ()=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 |
Block * | ShowBlock (int slot) const |
Block * | ShowBlockInSlot (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 |
Provides block ability to contain other blocks inside.
Definition at line 33 of file Inventory.h.
|
delete |
|
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.
|
protected |
Definition at line 249 of file Inventory.cpp.
|
protectedvirtual |
Definition at line 264 of file Inventory.cpp.
|
virtual |
Reimplemented in Dwarf.
Definition at line 29 of file Inventory.cpp.
|
virtual |
|
pure virtual |
|
virtual |
Returns true on success.
Reimplemented in Workbench, Bucket, and Filter.
Definition at line 78 of file Inventory.cpp.
|
virtual |
|
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.
|
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.
|
virtual |
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.
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.
|
pure virtual |
Implemented in Bush, Box, Dwarf, Container, RainMachine, and Bucket.
Definition at line 275 of file Inventory.cpp.
|
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.
|
virtual |
Reimplemented in Workbench, and Dwarf.
Definition at line 26 of file Inventory.cpp.
|
virtual |
|
private |
Definition at line 92 of file Inventory.h.
|
private |
Definition at line 91 of file Inventory.h.