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

TFleet Class Reference

A fleet is the composition of different ships. More...

#include <fleet.h>

Inheritance diagram for TFleet:

Inheritance graph
[legend]
Collaboration diagram for TFleet:

Collaboration graph
[legend]
List of all members.

Public Methods

 TFleet (const TPoint &Pos=0)
virtual ~TFleet ()
virtual void Add (TSubFleet *pSubFleet)
virtual bool canPerformAction (const TAction &action)
virtual bool canBeObjectInAction (const TAction &action)
TOSVal getNumberOfShips () const
double getSpeed () const
virtual int2 getType () const
virtual const string & getTypeName () const
virtual bool load (TDataPackageList *in)
virtual bool Remove (TSubFleet *pSubFleet)
virtual bool save (TDataPackageList *out) const
void setSpeed (double speed)
virtual bool TransferSubFleet (TSubFleet *pSubFleet, TFleet *pNewFleet)

Protected Attributes

double fSpeed
TPList< TSubFleetfSubFleets

Detailed Description

A fleet is the composition of different ships.

Author:
Marco Krohn <marco.krohn@gmx.de>
Version:
Id:
fleet.h,v 1.17 2002/06/07 00:35:11 mkrohn5 Exp
See also:
TStellarObject, TSubFleet, TFleetBasic
A fleet is basically a list of TSubFleet objects. Similarily to the other classes TPlanet, TSystem etc. this class is pure virtual meaning that it just defines the general interface for fleets in general.


Constructor & Destructor Documentation

TFleet::TFleet const TPoint   Pos = 0
 

Initializes the fleet with a position in space and sets the current speed to 0.

Parameters:
Pos  Position in space.

virtual TFleet::~TFleet   [virtual]
 

Deletes all subfleets.


Member Function Documentation

virtual void TFleet::Add TSubFleet   pSubFleet [virtual]
 

Adds a subfleet to the fleet. Note: TFleet is now responsible for the subfleet in the sense that it will delete the TSubFleet object when the desturtor is called. Also note that no check is performed to prevent that a sub fleet is added twice.

virtual bool TFleet::canBeObjectInAction const TAction   action [virtual]
 

Overload of TActionObject method to filter action types.

Reimplemented from TStellarObject.

virtual bool TFleet::canPerformAction const TAction   action [virtual]
 

Overload of TActionObject method to filter action types.

Reimplemented from TStellarObject.

TOSVal TFleet::getNumberOfShips   const
 

Returns:
The total number of ships calculated by summing up the number of ships of the subfleets.
See also:
TSubFleet::getNumberOfShips

double TFleet::getSpeed   const
 

Returns:
The current speed of the fleet.

virtual int2 TFleet::getType   const [virtual]
 

Returns:
The type of the stellar object, here: TType::FLEET.
See also:
TType

Reimplemented from TStellarObject.

virtual const string& TFleet::getTypeName   const [virtual]
 

Returns:
The name of the class: "TFleet".

Reimplemented from TStellarObject.

virtual bool TFleet::load TDataPackageList   in [virtual]
 

The method Load loads a TFleet 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 TStellarObject.

virtual bool TFleet::Remove TSubFleet   pSubFleet [virtual]
 

This method removes a subfleet from the fleet. It will also delete the subfleet.

Parameters:
pSubFleet  The subfleet which will be removed.
Returns:
true = successfuly removed the subfleet from the list, otherwise false (means that the object is not an element of the list).

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

The method Save saves a TFleet 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 TStellarObject.

void TFleet::setSpeed double    speed
 

Sets the current speed of the fleet. The value is only stored during fleet movement. Actually the fleet tries to move with the speed given by the waypoint list, but under some circumstances (e.g. mine fields) the current speed can be different of the wanted speed.

Parameters:
speed  The new current speed.

virtual bool TFleet::TransferSubFleet TSubFleet   pSubFleet,
TFleet *    pNewFleet
[virtual]
 

This method moves the subfleet given as parameter from this fleet to the fleet given as second parameter. The method will return false, if the subfleet was not part of this fleet and the move couldn't be done.

Parameters:
pSubFleet  the subfleet which will be moved
pNewFleet  the new fleet the subfleet will be moved to
Returns:
true = successfuly removed the subfleet from the list, otherwise false (means that the object is not an element of the list).


Member Data Documentation

double TFleet::fSpeed [protected]
 

Current speed of the fleet

TPList<TSubFleet> TFleet::fSubFleets [protected]
 

List of all subfleets.


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