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

#include <Dwarf.h>

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

Public Member Functions

 Dwarf (int sub, int id)
 
 Dwarf (QDataStream &str, int sub, int id)
 
int ShouldAct () const override
 
int DamageKind () const override
 
void Move (dirs direction) override
 
int Start () const override
 
int Weight () const override
 
int DamageLevel () const override
 
void Damage (int dmg, int dmg_kind) override
 
void UpdateLightRadius () override
 
QString FullName () const override
 
QString InvFullName (int slot_number) const override
 
bool Access () const override
 
bool Inscribe (QString str) override
 Returns true on success. More...
 
bool GetExact (Block *, int to) override
 Returns true if block found its place. More...
 
void ReceiveSignal (QString) override
 
int LightRadius () const override
 
int NutritionalValue (subs) const override
 
BlockDropAfterDamage (bool *delete_block) override
 Should return dropped block. More...
 
InventoryHasInventory () override
 
- Public Member Functions inherited from Animal
 Animal (int sub, int id)
 
 Animal (QDataStream &str, int sub, int id)
 
 ~Animal ()
 
void ActFrequent () override
 
void DoRareAction () override
 
bool Eat (subs)
 
int Breath () const
 
int Satiation () const
 
AnimalIsAnimal () override
 
inner_actions ActInner () override
 
void SetDeferredAction (DeferredAction *)
 
- Public Member Functions inherited from Falling
 Falling (int sub, int id, int transp=UNDEF)
 
 Falling (QDataStream &str, int sub, int id, int transp=UNDEF)
 
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
 
void ActRare ()
 
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 usage_types Use (Block *user)
 
virtual usage_types UseOnShredMove (Block *user)
 
virtual wearable Wearable () 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 Get (Block *block, int start=0)
 Returns true on success. More...
 
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 Animal
void EatGrass ()
 
- 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 ()
 

Private Types

enum  {
  ON_HEAD, ON_BODY, ON_LEGS, IN_RIGHT,
  IN_LEFT
}
 

Private Member Functions

int UpdateLightRadiusInner () const
 

Private Attributes

int lightRadius
 

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 Animal
bool moved_in_this_turn = false
 
- 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

Definition at line 28 of file Dwarf.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
ON_HEAD 
ON_BODY 
ON_LEGS 
IN_RIGHT 
IN_LEFT 

Definition at line 58 of file Dwarf.h.

Constructor & Destructor Documentation

Dwarf::Dwarf ( int  sub,
int  id 
)

Definition at line 176 of file Dwarf.cpp.

Dwarf::Dwarf ( QDataStream &  str,
int  sub,
int  id 
)

Definition at line 184 of file Dwarf.cpp.

Member Function Documentation

bool Dwarf::Access ( ) const
overridevirtual

Reimplemented from Inventory.

Definition at line 45 of file Dwarf.cpp.

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

Reimplemented from Active.

Definition at line 85 of file Dwarf.cpp.

int Dwarf::DamageKind ( ) const
overridevirtual

Reimplemented from Animal.

Definition at line 68 of file Dwarf.cpp.

int Dwarf::DamageLevel ( ) const
overridevirtual

Reimplemented from Block.

Definition at line 74 of file Dwarf.cpp.

Block * Dwarf::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 Animal.

Definition at line 36 of file Dwarf.cpp.

QString Dwarf::FullName ( ) const
overridevirtual

Implements Animal.

Definition at line 49 of file Dwarf.cpp.

bool Dwarf::GetExact ( Block block,
int  num 
)
overridevirtual

Returns true if block found its place.

Reimplemented from Inventory.

Definition at line 130 of file Dwarf.cpp.

Inventory * Dwarf::HasInventory ( )
overridevirtual

Implements Inventory.

Definition at line 46 of file Dwarf.cpp.

bool Dwarf::Inscribe ( QString  str)
overridevirtual

Returns true on success.

Reimplemented from Block.

Definition at line 158 of file Dwarf.cpp.

QString Dwarf::InvFullName ( int  slot_number) const
overridevirtual

Reimplemented from Inventory.

Definition at line 163 of file Dwarf.cpp.

int Dwarf::LightRadius ( ) const
overridevirtual

Reimplemented from Block.

Definition at line 44 of file Dwarf.cpp.

void Dwarf::Move ( dirs  direction)
overridevirtual

Reimplemented from Falling.

Definition at line 109 of file Dwarf.cpp.

int Dwarf::NutritionalValue ( subs  sub) const
overridevirtual

Reimplemented from Animal.

Definition at line 120 of file Dwarf.cpp.

void Dwarf::ReceiveSignal ( QString  str)
overridevirtual

Implements Inventory.

Definition at line 47 of file Dwarf.cpp.

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

Reimplemented from Animal.

Definition at line 153 of file Dwarf.cpp.

int Dwarf::ShouldAct ( ) const
overridevirtual

Reimplemented from Animal.

Definition at line 42 of file Dwarf.cpp.

int Dwarf::Start ( ) const
overridevirtual

Reimplemented from Inventory.

Definition at line 43 of file Dwarf.cpp.

void Dwarf::UpdateLightRadius ( )
overridevirtual

Reimplemented from Active.

Definition at line 55 of file Dwarf.cpp.

int Dwarf::UpdateLightRadiusInner ( ) const
private

Definition at line 60 of file Dwarf.cpp.

int Dwarf::Weight ( ) const
overridevirtual

Reimplemented from Inventory.

Definition at line 26 of file Dwarf.cpp.

Member Data Documentation

int Dwarf::lightRadius
private

Definition at line 68 of file Dwarf.h.


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