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

#include <Animal.h>

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

Public Member Functions

 Animal (int sub, int id)
 
 Animal (QDataStream &str, int sub, int id)
 
 ~Animal ()
 
int DamageKind () const override
 
int ShouldAct () const override
 
void ActFrequent () override
 
void DoRareAction () override
 
bool Eat (subs)
 
int Breath () const
 
int Satiation () const
 
QString FullName () const override=0
 
AnimalIsAnimal () override
 
BlockDropAfterDamage (bool *delete_block) override
 Should return dropped block. More...
 
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)
 
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
 
void ReceiveSignal (QString) override
 Receive text signal. More...
 
void Damage (int dmg, int dmg_kind) override
 
ActiveActiveBlock () overridefinal
 
ShredGetShred () const
 
WorldGetWorld () const
 
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 Use (Block *user)
 
virtual usage_types UseOnShredMove (Block *user)
 
virtual InventoryHasInventory ()
 
virtual wearable Wearable () 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...
 

Protected Member Functions

void SaveAttributes (QDataStream &out) const override
 
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 Attributes

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
 

Private Member Functions

 Animal (Animal &)=delete
 
Animaloperator= (Animal &)=delete
 
virtual int NutritionalValue (subs) const
 

Private Attributes

quint8 breath
 
quint16 satiation
 
DeferredActiondeferredAction = nullptr
 

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)
 

Detailed Description

Definition at line 27 of file Animal.h.

Constructor & Destructor Documentation

Animal::Animal ( int  sub,
int  id 
)

Definition at line 116 of file Animal.cpp.

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

Definition at line 122 of file Animal.cpp.

Animal::~Animal ( )

Definition at line 130 of file Animal.cpp.

Animal::Animal ( Animal )
privatedelete

Member Function Documentation

void Animal::ActFrequent ( )
overridevirtual

Reimplemented from Active.

Reimplemented in Rabbit, and Predator.

Definition at line 39 of file Animal.cpp.

inner_actions Animal::ActInner ( )
overridevirtual

Reimplemented from Active.

Definition at line 27 of file Animal.cpp.

int Animal::Breath ( ) const

Definition at line 65 of file Animal.cpp.

int Animal::DamageKind ( ) const
overridevirtual

Reimplemented from Block.

Reimplemented in Dwarf.

Definition at line 68 of file Animal.cpp.

void Animal::DoRareAction ( )
overridevirtual

Reimplemented from Active.

Reimplemented in Rabbit, and Predator.

Definition at line 47 of file Animal.cpp.

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

Reimplemented in Dwarf.

Definition at line 105 of file Animal.cpp.

bool Animal::Eat ( subs  sub)

Definition at line 72 of file Animal.cpp.

void Animal::EatGrass ( )
protected

Definition at line 92 of file Animal.cpp.

QString Animal::FullName ( ) const
overridepure virtual

Reimplemented from Falling.

Implemented in Rabbit, Predator, and Dwarf.

Animal * Animal::IsAnimal ( )
overridevirtual

Reimplemented from Block.

Definition at line 70 of file Animal.cpp.

int Animal::NutritionalValue ( subs  ) const
privatevirtual

Reimplemented in Rabbit, Predator, and Dwarf.

Definition at line 69 of file Animal.cpp.

Animal& Animal::operator= ( Animal )
privatedelete
int Animal::Satiation ( ) const

Definition at line 66 of file Animal.cpp.

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

Reimplemented from Falling.

Reimplemented in Dwarf.

Definition at line 87 of file Animal.cpp.

void Animal::SetDeferredAction ( DeferredAction action)

Definition at line 111 of file Animal.cpp.

int Animal::ShouldAct ( ) const
overridevirtual

Reimplemented from Active.

Reimplemented in Dwarf.

Definition at line 67 of file Animal.cpp.

Member Data Documentation

quint8 Animal::breath
private

Definition at line 59 of file Animal.h.

DeferredAction* Animal::deferredAction = nullptr
private

Definition at line 61 of file Animal.h.

bool Animal::moved_in_this_turn = false
protected

Definition at line 52 of file Animal.h.

quint16 Animal::satiation
private

Definition at line 60 of file Animal.h.


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