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

#include <Active.h>

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

Signals

void Moved (int)
 
void Updated ()
 
void ReceivedText (const QString)
 

Public Member Functions

 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 Move (dirs dir) override
 
void ReceiveSignal (QString) override
 Receive text signal. More...
 
void Damage (int dmg, int dmg_kind) override
 
QString FullName () const override=0
 
ActiveActiveBlock () overridefinal
 
ShredGetShred () const
 
WorldGetWorld () const
 
virtual void ActFrequent ()
 
void ActRare ()
 
virtual inner_actions ActInner ()
 
virtual int ShouldAct () const
 
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 push_reaction PushResult (dirs) const
 
virtual BlockDropAfterDamage (bool *delete_self)
 Should return dropped block. More...
 
virtual InventoryHasInventory ()
 
virtual AnimalIsAnimal ()
 
virtual FallingShouldFall ()
 
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...
 

Protected Member Functions

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 void DoRareAction ()
 
virtual int Attractive (int sub) const
 
- Protected Member Functions inherited from Block
virtual void SaveAttributes (QDataStream &) 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
 

Private Member Functions

 Active (Active &)=delete
 
Activeoperator= (Active &)=delete
 
void ReRegister (dirs)
 

Private Attributes

Shredshred = nullptr
 

Additional Inherited Members

- 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

Definition at line 46 of file Active.h.

Constructor & Destructor Documentation

Active::Active ( int  sub,
int  id,
int  transp = UNDEF 
)

Definition at line 166 of file Active.cpp.

Active::Active ( QDataStream &  str,
int  sub,
int  id,
int  transp = UNDEF 
)

Definition at line 171 of file Active.cpp.

Active::Active ( Active )
privatedelete

Member Function Documentation

void Active::ActFrequent ( )
virtual

Reimplemented in Door, Rabbit, Predator, and Animal.

Definition at line 41 of file Active.cpp.

inner_actions Active::ActInner ( )
virtual

Reimplemented in Telegraph, Clock, Bush, Grass, Box, Liquid, Container, Animal, RainMachine, and Illuminator.

Definition at line 30 of file Active.cpp.

Active * Active::ActiveBlock ( )
finaloverridevirtual

Reimplemented from Block.

Definition at line 28 of file Active.cpp.

void Active::ActRare ( )

Definition at line 55 of file Active.cpp.

int Active::Attractive ( int  sub) const
protectedvirtual

Reimplemented in Rabbit, and Predator.

Definition at line 217 of file Active.cpp.

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

Reimplemented from Block.

Reimplemented in Bell, Clock, Door, Converter, Bush, Box, Liquid, Container, Dwarf, and RainMachine.

Definition at line 142 of file Active.cpp.

void Active::DamageAround ( ) const
protected

Definition at line 118 of file Active.cpp.

void Active::DoRareAction ( )
protectedvirtual

Reimplemented in Rabbit, Converter, Bush, Grass, Predator, Box, Liquid, Illuminator, Animal, and RainMachine.

Definition at line 48 of file Active.cpp.

void Active::Farewell ( )
QString Active::FullName ( ) const
overridepure virtual
Shred * Active::GetShred ( ) const

Definition at line 139 of file Active.cpp.

World * Active::GetWorld ( ) const

Definition at line 140 of file Active.cpp.

bool Active::Gravitate ( int  range,
int  down,
int  up,
int  calmness 
)
protected

Definition at line 178 of file Active.cpp.

bool Active::IsSubAround ( int  sub) const
protected

Returns true if there is at least 1 block of substance sub around.

Definition at line 219 of file Active.cpp.

void Active::Move ( dirs  dir)
overridevirtual

Reimplemented from Block.

Reimplemented in Falling, and Dwarf.

Definition at line 86 of file Active.cpp.

void Active::Moved ( int  )
signal
Active& Active::operator= ( Active )
privatedelete
void Active::ReceivedText ( const QString  )
signal
void Active::ReceiveSignal ( QString  )
overridevirtual

Receive text signal.

Reimplemented from Block.

Reimplemented in Telegraph, Bush, Box, Dwarf, Container, and RainMachine.

Definition at line 156 of file Active.cpp.

void Active::ReRegister ( dirs  dir)
private

Definition at line 98 of file Active.cpp.

void Active::SendSignalAround ( QString  signal) const
protected

Definition at line 106 of file Active.cpp.

void Active::SetShred ( Shred new_shred)

Definition at line 138 of file Active.cpp.

int Active::ShouldAct ( ) const
virtual

Reimplemented in Telegraph, Clock, Door, Converter, Bush, Grass, Box, Liquid, Container, Animal, Dwarf, RainMachine, and Illuminator.

Definition at line 29 of file Active.cpp.

void Active::TryDestroy ( int  x,
int  y,
int  z 
) const
protected

Damages block and destroys it if it is broken.

Definition at line 131 of file Active.cpp.

void Active::Unregister ( )

Definition at line 79 of file Active.cpp.

void Active::Updated ( )
signal
void Active::UpdateLightRadius ( )
virtual

Reimplemented in Dwarf.

Definition at line 32 of file Active.cpp.

int Active::X ( ) const

Definition at line 158 of file Active.cpp.

int Active::Y ( ) const

Definition at line 162 of file Active.cpp.

Member Data Documentation

Shred* Active::shred = nullptr
private

Definition at line 99 of file Active.h.


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