Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

TDefenseType Class Reference

TDefenseType contains the efficiencies against different weapons. More...

#include <item.h>

Inheritance diagram for TDefenseType:

Inheritance graph
[legend]
Collaboration diagram for TDefenseType:

Collaboration graph
[legend]
List of all members.

Public Methods

 TDefenseType ()
 TDefenseType (const int2 StandardEfficiency)
 TDefenseType (const TDefenseType &OldDefenseType)
virtual ~TDefenseType ()=0
virtual bool load (TDataPackageList *in)
virtual bool save (TDataPackageList *out) const
virtual void setStandardEfficiency (const int2 StandardEfficiency)
virtual int2 getStandardEfficiency () const
virtual void setDefenseEfficiency (const TItem::tWeaponType WeaponType, const int2 Efficiency)
virtual int2 getDefenseEfficiency (const TItem::tWeaponType WeaponType) const
virtual bool operator== (const TDefenseType &DefenseType) const

Protected Types

typedef TPEList< TEfficiencyToken
>::const_iterator 
tEfficienciesIteratorConst
typedef TPEList< TEfficiencyToken
>::iterator 
tEfficienciesIterator

Protected Methods

virtual TDefenseType & operator= (const TDefenseType &DefenseType)

Protected Attributes

int2 fStandardEfficiency
TPEList< TEfficiencyTokenfEfficiencies

Detailed Description

TDefenseType contains the efficiencies against different weapons.

Author:
Ralf Laue
Version:
Id:
item.h,v 1.34 2002/04/02 22:33:08 prolator Exp
See also:
TArmor , TShield
The class TDefenseType provides an ancestor for the type for armor and shields or rather the information about their efficiencies against different weapon types. It is derived from TLinkable and has therefor an unique ID and can be linked (see also TLinkable). An defense type contains a list/array with types of weapons and the related efficiencies of the armor (or shields) against them. The hit point value for armors or shields is provided by TArmor or TShield respectively. If a weapon type is not yet known a standard efficiency against all weapons is returned. This value can be changed with setStandardEfficiency and it can be read with getStandardEfficiency. The value of the standard efficiency is initialized with 100 if you use the constructor without parameters or to the value you want, if you use the constructor with StandardEfficiency as parameter. The 100 are chosen in expectation, that the values are percental values. If that's not correct, the implementation should perhaps be changed in fufture.
This class is pure virtual and ancestor to TArmorType an TShieldType. It is written to have the code which is necessary in both sub classes only one time.


Member Typedef Documentation

typedef TPEList<TEfficiencyToken>::iterator TDefenseType::tEfficienciesIterator [protected]
 

This is the type definition for the iterator through the efficiencies array.

typedef TPEList<TEfficiencyToken>::const_iterator TDefenseType::tEfficienciesIteratorConst [protected]
 

This is the type definition for the const iterator through the efficiencies array.


Constructor & Destructor Documentation

TDefenseType::TDefenseType  
 

This constructor generates a new TDefenseType object with all properties resetted. This means the value for the standard efficiency is 100 and the defense type doesn't know any weapons types. These you have to make known with setDefenseEfficiency.

TDefenseType::TDefenseType const int2    StandardEfficiency
 

This constructor generates a also new TDefenseType object, but only with the defense efficiencies resetted. The standard efficiency is set to the value given as parameter. The efficiencies against weapon types have to be set with setDefenseEfficiency.

TDefenseType::TDefenseType const TDefenseType &    OldDefenseType
 

This constructor creates also a new defense type, but the attributes are copied from the defense type given in OldDefenseType. Mostly implemented to provide a copy constructor.

Parameters:
OldDefenseType  the TDefenseType object which shall be copied

virtual TDefenseType::~TDefenseType   [pure virtual]
 

Destructs the object. It has to be called for destruction of the object, because it releases the memory used for the efficiencies list.


Member Function Documentation

virtual int2 TDefenseType::getDefenseEfficiency const TItem::tWeaponType    WeaponType const [virtual]
 

With the method getDefenseEfficiency you can get the efficiency value of the defense type against a certain weapon type.

Parameters:
WeaponType  the weapon type you want the efficieny against
Returns:
the efficiency against this weapon type

virtual int2 TDefenseType::getStandardEfficiency   const [virtual]
 

With the method getStandardEfficiency you can get the standard efficiency value against all unknown weapons.

Returns:
the standard efficiency against unknown weapons

virtual bool TDefenseType::load TDataPackageList   in [virtual]
 

The method Load loads a TDefenseType object from the data packages in the list. All sub classes of TDefenseType have to reimplement the Load method and they must call TDefenseType::Load explicitly in their Load method to load the data correctly.

Parameters:
in  the list of data packages
Returns:
true means that everything was loaded correctly, otherwise this method will return false.
See also:
TLinkable

Reimplemented from TLinkable.

Reimplemented in TArmorType, and TShieldType.

virtual TDefenseType& TDefenseType::operator= const TDefenseType &    DefenseType [protected, virtual]
 

This is the assignment operator for TDefenseType.

virtual bool TDefenseType::operator== const TDefenseType &    DefenseType const [virtual]
 

With the method operator== you can compare two TDefenseType objects. This is of course the behaviour one would expect from "operator==". The method teste whether both defense types have the same efficiencies for all possible weapon types at the moment. That means, the number of known weapon types can be different, but the behavior is still equal and this method will decide then for equal.

Parameters:
DefenseType  the TDefenseType object to be compared with *this
Returns:
true if the TDefenseType objects are equal, false if not

virtual bool TDefenseType::save TDataPackageList   out const [virtual]
 

The method Save saves a TDefenseType by adding the data packages to the list. All sub classes of TDefenseType have to reimplement the Save method and they must call TDefenseType::Save explicitly in their Save method to save the data correctly.

Parameters:
out  the output stream of data packages
Returns:
true means that everything was saved correctly, otherwise this method will return false.
See also:
TLinkable

Reimplemented from TLinkable.

Reimplemented in TArmorType, and TShieldType.

virtual void TDefenseType::setDefenseEfficiency const TItem::tWeaponType    WeaponType,
const int2    Efficiency
[virtual]
 

With the method setDefenseEfficiency you can set the efficiency value of the defense type against a certain weapon type.

Parameters:
WeaponType  the weapon type you want to set the efficieny against
Efficiency  the new efficiency the defense type shall have against the weapon type

virtual void TDefenseType::setStandardEfficiency const int2    StandardEfficiency [virtual]
 

With the method setStandardEfficiency you can set the standard efficiency value against all unknown weapons.

Parameters:
StandardEfficiency  the new standard efficiency of the defense type against unknown weapon types


Member Data Documentation

TPEList<TEfficiencyToken> TDefenseType::fEfficiencies [protected]
 

the list of efficiencies of the defense type against different weapon types

int2 TDefenseType::fStandardEfficiency [protected]
 

the standard defense efficiency against all weapons


The documentation for this class was generated from the following file:
Generated on Thu Jun 20 18:13:19 2002 for Stellar Legacy by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001