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

Box represents falling inventory. More...

#include <Containers.h>

Inheritance diagram for Box:
Inheritance graph
[legend]
Collaboration diagram for Box:
Collaboration graph
[legend]

Public Member Functions

 Box (int kind, int sub)
 
 Box (QDataStream &str, int kind, int sub)
 
int ShouldAct () const override
 
void Damage (int dmg, int dmg_kind) override
 
void ReceiveSignal (QString) override
 
void DoRareAction () override
 
QString FullName () const override
 
BlockDropAfterDamage (bool *delete_block) override
 Should return dropped block. More...
 
InventoryHasInventory () overridefinal
 
usage_types Use (Block *who) override
 
inner_actions ActInner () override
 
- Public Member Functions inherited from Falling
 Falling (int sub, int id, int transp=UNDEF)
 
 Falling (QDataStream &str, int sub, int id, int transp=UNDEF)
 
void Move (dirs dir) override
 
FallingShouldFall () overridefinal
 
push_reaction PushResult (dirs) const override
 
void FallDamage ()
 
bool IsFalling () const
 
void SetFalling (bool set)
 
- Public Member Functions inherited from Active
 Active (int sub, int id, int transp=UNDEF)
 
 Active (QDataStream &str, int sub, int id, int transp=UNDEF)
 
int X () const
 
int Y () const
 
ActiveActiveBlock () overridefinal
 
ShredGetShred () const
 
WorldGetWorld () const
 
virtual void ActFrequent ()
 
void ActRare ()
 
virtual void UpdateLightRadius ()
 
void SetShred (Shred *)
 
void Farewell ()
 
void Unregister ()
 
- Public Member Functions inherited from Block
 Block (int sub, int kind, int transp=UNDEF)
 
 Block (QDataStream &, int sub, int kind, int transp=UNDEF)
 
virtual ~Block ()
 
Blockoperator= (Block &)=delete
 
 Block (Block &)=delete
 
virtual bool Catchable () const
 
virtual bool Inscribe (QString str)
 Returns true on success. More...
 
virtual usage_types UseOnShredMove (Block *user)
 
virtual AnimalIsAnimal ()
 
virtual wearable Wearable () const
 
virtual int DamageKind () const
 
virtual int DamageLevel () const
 
virtual int LightRadius () const
 
virtual int Weight () const
 
int GetId () const
 Determines kind and sub, unique for every kind-sub pair. More...
 
void Restore ()
 Set maximum durability. More...
 
void Break ()
 Set durability to null. More...
 
void Mend (int plus)
 Increase durability, no more than MAX_DURABILITY. More...
 
void SetDir (int dir)
 
dirs GetDir () const
 
int GetDurability () const
 
QString GetNote () const
 
int Transparent () const
 
int Sub () const
 
int Kind () const
 
bool operator== (const Block &) const
 
bool operator!= (const Block &) const
 
void SaveToFile (QDataStream &out)
 
void SaveNormalToFile (QDataStream &out) const
 
void RestoreDurabilityAfterSave ()
 Importart! Use it if block won't be deleted after SaveToFile. More...
 
- Public Member Functions inherited from Inventory
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 int Start () const
 
virtual int Weight () const
 
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

void SaveAttributes (QDataStream &out) const override
 
- Protected Member Functions inherited from Active
void SendSignalAround (QString) const
 
void DamageAround () const
 
void TryDestroy (int x, int y, int z) const
 Damages block and destroys it if it is broken. More...
 
bool IsSubAround (int sub) const
 Returns true if there is at least 1 block of substance sub around. More...
 
bool Gravitate (int range, int down, int up, int calmness)
 
virtual int Attractive (int sub) const
 
- Protected Member Functions inherited from Xyz
 Xyz (short x, short y, short z)
 
 Xyz ()
 
short Z () const
 
void SetXyz (short x, short y, short z)
 
- Protected Member Functions inherited from Xy
 Xy (short x, short y)
 
 Xy ()
 
short X () const
 
short Y () const
 
- Protected Member Functions inherited from Inventory
 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 ()
 

Additional Inherited Members

- Signals inherited from Active
void Moved (int)
 
void Updated ()
 
void ReceivedText (const QString)
 
- Static Public Member Functions inherited from Block
static QString SubName (int sub)
 Returns translated substance name. More...
 
static QString SubNameUpper (int sub)
 Returns translated substance name with first upper letter. More...
 
static sub_groups GetSubGroup (int sub)
 
static dirs MakeDirFromDamage (int damage_kind)
 
static QString DirString (dirs)
 
- Protected Attributes inherited from Block
quint16 noteId
 To convert DAMAGE_PUSH_UP...WEST to corresponding direction. More...
 
- Protected Attributes inherited from Xyz
short z_self
 
- Protected Attributes inherited from Xy
short x_self
 
short y_self
 

Detailed Description

Box represents falling inventory.

Unlike chests, position of box is not static, it can be moved and falls when it can. Also, pile is box of substance DIFFERENT, it will dissapear if empty.

Definition at line 56 of file Containers.h.

Constructor & Destructor Documentation

Box::Box ( int  kind,
int  sub 
)

Definition at line 86 of file Containers.cpp.

Box::Box ( QDataStream &  str,
int  kind,
int  sub 
)

Definition at line 91 of file Containers.cpp.

Member Function Documentation

inner_actions Box::ActInner ( )
overridevirtual

Reimplemented from Active.

Definition at line 104 of file Containers.cpp.

void Box::Damage ( int  dmg,
int  dmg_kind 
)
overridevirtual

Reimplemented from Active.

Definition at line 129 of file Containers.cpp.

void Box::DoRareAction ( )
overridevirtual

Reimplemented from Active.

Definition at line 106 of file Containers.cpp.

Block * Box::DropAfterDamage ( bool *  delete_self)
overridevirtual

Should return dropped block.

It can be pile(BOX, DIFFERENT) containing all dropped blocks, or block itself. Set delete_self false if this block itself should not be deleted. (by default block is deleted, beware).

Reimplemented from Block.

Definition at line 124 of file Containers.cpp.

QString Box::FullName ( ) const
overridevirtual

Reimplemented from Falling.

Definition at line 140 of file Containers.cpp.

Inventory * Box::HasInventory ( )
finaloverridevirtual

Implements Inventory.

Definition at line 103 of file Containers.cpp.

void Box::ReceiveSignal ( QString  str)
overridevirtual

Implements Inventory.

Definition at line 102 of file Containers.cpp.

void Box::SaveAttributes ( QDataStream &  out) const
overrideprotectedvirtual

Reimplemented from Falling.

Definition at line 96 of file Containers.cpp.

int Box::ShouldAct ( ) const
overridevirtual

Reimplemented from Active.

Definition at line 101 of file Containers.cpp.

usage_types Box::Use ( Block who)
overridevirtual

Reimplemented from Block.

Definition at line 149 of file Containers.cpp.


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