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

TWeapon Class Reference

TWeapon represents an abstract weapon for a ship. More...

#include <item.h>

Inheritance diagram for TWeapon:

Inheritance graph
[legend]
Collaboration diagram for TWeapon:

Collaboration graph
[legend]
List of all members.

Public Methods

 TWeapon ()
 TWeapon (const TWeapon &OldWeapon)
virtual ~TWeapon ()
virtual bool load (TDataPackageList *in)
virtual bool save (TDataPackageList *out) const
virtual TItem::tItemType getItemType () const=0
virtual void setDamagePoints (const int2 DamagePoints)
virtual int2 getDamagePoints () const
virtual void setRateOfFire (const int2 RateOfFire)
virtual int2 getRateOfFire () const
virtual void setWeaponType (const TItem::tWeaponType WeaponType)
virtual TItem::tWeaponType getWeaponType () const
virtual bool operator== (const TWeapon &Weapon) const

Protected Methods

virtual TWeapon & operator= (const TWeapon &Weapon)

Protected Attributes

int2 fDamagePoints
int2 fRateOfFire
TItem::tWeaponType fWeaponType

Detailed Description

TWeapon represents an abstract weapon for a ship.

Author:
Ralf Laue
Version:
Id:
item.h,v 1.34 2002/04/02 22:33:08 prolator Exp
See also:
TShipDesign
The class TWeapon is derived from TItem and it is (like TItem) a pure virtual class. The actual weapons will be derived from this class. At this level the properties damage points, rate of fire and weapon type are implemented. If in future weapon type gets an own class (until now it's an integer and different types are neede for kinetic weapons, energy weapons and perhaps other weapons, these types have to be derived from a type TWeaponType.


Constructor & Destructor Documentation

TWeapon::TWeapon  
 

This constructor doesn't work, because TWeapon is a pure virtual class. It's only implemented to be used by the sub classes of TWeapon.

TWeapon::TWeapon const TWeapon &    OldWeapon
 

This constructor doesn't work either and is only implemented to provide a copy constructor for the sub classes.

Parameters:
OldWeapon  the TWeapon object which shall be copied

virtual TWeapon::~TWeapon   [virtual]
 

Destructs the object. Has nothing else to do, because no memory has to be freed or similar stuff. Doesn't work, because TWeapon is a pure virtual class and you wont be able to construct an object.


Member Function Documentation

virtual int2 TWeapon::getDamagePoints   const [virtual]
 

With the method getDamagePoints you can get the damage points the weapon causes per shot.

Returns:
the damage points the weapon causes

virtual TItem::tItemType TWeapon::getItemType   const [pure virtual]
 

The method getItemType returns the type of the item, , but in this class it's pure virtual. Therefor it has be reimplemented in all derived classes.

Returns:
nothing

Reimplemented from TItem.

Reimplemented in TKWeapon, and TEWeapon.

virtual int2 TWeapon::getRateOfFire   const [virtual]
 

With the method getRateOfFire you can get the rate of fire of the weapon, that is how many shots it can fire in a certain time.

Returns:
the rate of fire for the weapon

virtual TItem::tWeaponType TWeapon::getWeaponType   const [virtual]
 

With the method getWeaponType you can get the type of the weapon.

Returns:
the type of the weapon

virtual bool TWeapon::load TDataPackageList   in [virtual]
 

The method Load loads a TWeapon object from the data packages in the list.

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 TItem.

Reimplemented in TKWeapon, and TEWeapon.

virtual TWeapon& TWeapon::operator= const TWeapon &    Weapon [protected, virtual]
 

The assignment operator for TWeapon

virtual bool TWeapon::operator== const TWeapon &    Weapon const [virtual]
 

With the method operator== you can compare two TWeapon objects. This is of course the behaviour one would expect from "operator==".

Parameters:
Weapon  the TWeapon object which shall be compared with *this
Returns:
true if TWeapon objects are equal, false if not

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

The method Save saves a TWeapon object by adding the data packages to the list.

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 TItem.

Reimplemented in TKWeapon, and TEWeapon.

virtual void TWeapon::setDamagePoints const int2    DamagePoints [virtual]
 

The method setDamage sets the damage points the weapon causes per shot.

Parameters:
DamagePoints  the new amount of damage points the weapon causes

virtual void TWeapon::setRateOfFire const int2    RateOfFire [virtual]
 

The method setRateOfFire sets the rate of fire of the weapon, that is how many shots it can fire in a certain time.

Parameters:
RateOfFire  the new rate of fire for the weapon

virtual void TWeapon::setWeaponType const TItem::tWeaponType    WeaponType [virtual]
 

The method setWeaponType sets the type of the weapon.

Parameters:
WeaponType  the new type of the weapon


Member Data Documentation

int2 TWeapon::fDamagePoints [protected]
 

the damage points the weapon causes

int2 TWeapon::fRateOfFire [protected]
 

the rate of fire for the weapon

TItem::tWeaponType TWeapon::fWeaponType [protected]
 

the type of the weapon


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