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

TSubFleet Class Reference

A subfleet consists of a number of ships of the same type. More...

#include <subfleet.h>

Inheritance diagram for TSubFleet:

Inheritance graph
[legend]
Collaboration diagram for TSubFleet:

Collaboration graph
[legend]
List of all members.

Public Methods

 TSubFleet (TShipDesign *ShipDesign, int2 NumberOfShips)
 TSubFleet (TSubFleet &OldSubFleet)
virtual ~TSubFleet ()
virtual int2 getType () const
virtual const string & getTypeName () const
virtual const TFleetgetFleet () const
virtual const TShipDesigngetShipDesign () const
virtual void AddShips (int4 NumberOfShips)
virtual void SubstractShips (int4 NumberOfShips)
virtual int4 getNumberOfShips () const
virtual void setAutoUpgrade (TShipDesign *UpgradeDesign)
virtual TShipDesigngetUpgradeDesign () const
virtual void CancelAutoUpgrade ()
virtual bool getUpgradeCosts (TSubstanceSet *UpgradeCosts) const=0
virtual bool CommitAutoUpgrade ()
virtual void setAutoRetire ()
virtual void CancelAutoRetire ()
virtual bool IsAutoRetire () const
virtual void getRepairCost (TSubstanceSet *RepairCost) const=0
virtual void RepairSubfleet ()=0
virtual void setExperience (int4 Experience)
virtual int4 getExperience () const
virtual int4 getMaxHullHP () const
virtual int4 getMaxArmorHP () const
virtual int4 getMaxShieldHP () const
virtual int4 getActualHullHP () const=0
virtual int4 getFTLFuelConsumption (double Speed, double Distance=1) const=0
virtual double getFTLMaxSpeed () const=0
virtual double getFTLMovementDistance (double dSpeed) const=0
virtual double getFTLBreakDownProbability (double Speed) const=0
virtual double getLongScannerRange (TScanner::tScannerType ScannerType) const=0
virtual void setFuel (int4 Fuel)=0
virtual int4 getFuel () const=0
virtual int4 getCargoSpace () const
virtual bool IsColonizer () const=0
virtual int2 getMiningRate () const
virtual bool load (TDataPackageList *in)
virtual bool save (TDataPackageList *out) const
virtual TSubFleet & operator= (const TSubFleet &SubFleet)

Protected Methods

virtual void setFleet (TFleet *NewFleet)

Protected Attributes

TLink< TFleetfFleet
TLink< TShipDesignfShipDesign
TLink< TShipDesignfUpgradeDesign
int4 fNumberOfShips
int4 fExperience
bool fAutoRetire

Friends

class TFleet

Detailed Description

A subfleet consists of a number of ships of the same type.

Author:
Marco Krohn <marco.krohn@gmx.de> , Ralf Laue <ralf.laue@gmx.de>
Version:
Id:
subfleet.h,v 1.10 2002/04/02 22:33:45 prolator Exp
See also:
TFleet, TShipDesign, TSubFleetBasic
In contrary to a fleet the subfleet consists only of ships of the same type. TSubFleet is a pure virtual class, the implementation is given in the rule system related classes TSubFleetBasic, TSubFleetStars, TSubFleetSL. Basically TSubFleet has a link to the ship design, damage distribution information and an integer with the number of ships in this subfleet. Note that the method descriptions sometimes uses the term "fleet" instead of subfleet.


Constructor & Destructor Documentation

TSubFleet::TSubFleet TShipDesign   ShipDesign,
int2    NumberOfShips
 

This constructor creates and initializes a new subfleet. The ship design the subfleet is of, is given in the parameter. The number of ships the subfleet should have initailly, is given in the second parameter.

Parameters:
ShipDesign  the ship design the subfleet is of
NumberOfShips  the number of ships the subfleet has initially

TSubFleet::TSubFleet TSubFleet &    OldSubFleet
 

This constructor also creates a new subfleet. It is initialized with the values of the subfleet given in the parameter. This is the copy constructor. All values ecxept the fleet are copied. The caller is responsible to inform the fleet about its new subfleet. This fleet will then inform the subfleet about its new parent. FIXME, at the moment the fields of TActioObject are NOT copied.

Parameters:
OldSubFleet  the subfleet the values are copied from

virtual TSubFleet::~TSubFleet   [virtual]
 

The destructor is doing nothing special at the moment.


Member Function Documentation

virtual void TSubFleet::AddShips int4    NumberOfShips [virtual]
 

With the method AddShips you can add ships to the subfleet. The method doesn't complain about, if the number of new ships is 0.

Parameters:
NumberOfShips  the number of ships to be added to the subfleet

virtual void TSubFleet::CancelAutoRetire   [virtual]
 

With the method CancelAutoRetire you can delete the flag, which determines whether the subfleet is to be retired at the next opportunity. That means, the auto reiterment is canceld.

See also:
setAutoRetire, CancelRetire

virtual void TSubFleet::CancelAutoUpgrade   [virtual]
 

With the method CancelAutoUpgrade you can cancel an ordered auto upgrade. Also the link to the upgrade design will be deleted, so that if you want to set up a new auto upgrade, you have to give the wished design again.

virtual bool TSubFleet::CommitAutoUpgrade   [virtual]
 

With the method CommitAutoUpgrade you can commit an ordered auto upgrade. Also the link to the upgrade design will be deleted (it is no longer needed) so that if you want to set up a new auto upgrade, you have to give the wished design again. The method will return a bool value, whether an upgrade was planned and commited (if one was planned it is commited after this method). Because this method doesn't care, whether you are able to pay the costs or not, make sure only to call it, when you already have payed the costs.

Returns:
true if a upgrade was planned an committed, false if not

virtual int4 TSubFleet::getActualHullHP   const [pure virtual]
 

With the method getActualHullHP you can get the amount if hit points the subfleet still has. You don't get any information how they are distributed over different ships.

Returns:
the amount of hit points the subfleet still has

Reimplemented in TSubFleetBasic.

virtual int4 TSubFleet::getCargoSpace   const [virtual]
 

With the method getCargoSpace you can get the amount of cargo space of the subfleet (as integer value).

Returns:
the amount of cargo space the subfleet has

virtual int4 TSubFleet::getExperience   const [virtual]
 

With the method getExperience you can get the amount of experience the subfleet or rather its crew has.

Returns:
the amount of experience the crew of the subfleet has

virtual const TFleet* TSubFleet::getFleet   const [virtual]
 

With the method getFleet you can get the "parent" fleet, the subfleet is belonging to.

Returns:
the TFleet object this subfleet belongs to

virtual double TSubFleet::getFTLBreakDownProbability double    Speed const [pure virtual]
 

With the method getBreakDownProbability you can get the probability of an engine failure for traveling with a certain speed. FIXME, do we differ between STL and FTL travel?

Parameters:
Speed  the speed of the subfleet
Returns:
the probability for an engine failure of subfleet at the given speed .

Reimplemented in TSubFleetBasic.

virtual int4 TSubFleet::getFTLFuelConsumption double    Speed,
double    Distance = 1
const [pure virtual]
 

With the method getFuelConsumption you can get the amount of fuel a subfleet needs for a given distance with a give speed. The method expacts speed and distance as parameters. The distance can be omitted; then the default value of 1 is chosen.

Parameters:
Speed  the speed of the subfleet wants to travel with
Distance  the distance the subfleet wants to travel
Returns:
the fuel needed for that distance at that speed

Reimplemented in TSubFleetBasic.

virtual double TSubFleet::getFTLMaxSpeed   const [pure virtual]
 

With the method getMaxSpeed you can get the maximum speed the sublfeet is able to travel with.

Returns:
the maximum speed of the subfleet

Reimplemented in TSubFleetBasic.

virtual double TSubFleet::getFTLMovementDistance double    Speed const [pure virtual]
 

With the method getMovementDistance you can get the distance the subfleet can travel within one turen with the given speed.

Parameters:
Speed  the speed the subfleet should travel with
Returns:
the distance the subfleet can move with the given speed within one turn

Reimplemented in TSubFleetBasic.

virtual int4 TSubFleet::getFuel   const [pure virtual]
 

With the method getFuel you can get the amount of fuel the subfleet has still left.

Returns:
the amount of fuel the subfleet has still left

Reimplemented in TSubFleetBasic.

virtual double TSubFleet::getLongScannerRange TScanner::tScannerType    ScannerType const [pure virtual]
 

With the method getLongScannerRange you can get the maximu scanning range of the long range scanner. That means the range the scanners can scan on the star map, not on the battlefield.

Returns:
the maximum scn range of the long range scanners

Reimplemented in TSubFleetBasic.

virtual int4 TSubFleet::getMaxArmorHP   const [virtual]
 

With this method you can get the maximum amount of armor hit points the sub fleet has (in undamaged condition). The amount is returned without taking in calculation different armor types.

Returns:
the maximum amount of armor hit points of the subfleet

virtual int4 TSubFleet::getMaxHullHP   const [virtual]
 

With this method you can get the maximum amount of hull hit points the sub fleet has (in undamaged condition).

Returns:
the maximum amount of hull hit points of the subfleet

virtual int4 TSubFleet::getMaxShieldHP   const [virtual]
 

With this method you can get the maximum amount of shield hit points the sub fleet has (in undamaged condition). The amount is returned without taking in calculation different shield types.

Returns:
the maximum amount of shield hit points of the subfleet

virtual int2 TSubFleet::getMiningRate   const [virtual]
 

With the method getMiningRate you can get the mineral mining rate of the subfleet. It is simply the value of the ship design multiplied with the number of ships in the subfleet.

Returns:
the mineral mining rate of the subfleet

virtual int4 TSubFleet::getNumberOfShips   const [virtual]
 

Returns:
The total number of ships in the subfleet.

virtual void TSubFleet::getRepairCost TSubstanceSet   RepairCost const [pure virtual]
 

With the method getRepairCost you can get the cost for a repair of all damages on hull, armor and other equipment. The cost for new fighters, SP weapons and ammuntion will not be included. The cost value will be returned in the parameter RepairCost.

Parameters:
RepairCost  return variable for the repair cost; it will deleted in any case

Reimplemented in TSubFleetBasic.

virtual const TShipDesign* TSubFleet::getShipDesign   const [virtual]
 

With the method getShipDesign you can get the ship design the ships in the subfleet are from.

Returns:
link to the ship design the ships in the subfleet are from

virtual int2 TSubFleet::getType   const [virtual]
 

This method is inherited from TType and reimplemented here. I returns TType::SUBFLEET.

Returns:
the type of the class, here: TType::SUBFLEET
See also:
TType

Reimplemented from TLinkable.

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

This method is inherited from TType and reimplemented here. I returns "TSubFleet".

Returns:
the name of the class, here "TSubFleet"
See also:
TType

Reimplemented from TLinkable.

virtual bool TSubFleet::getUpgradeCosts TSubstanceSet   UpgradeCosts const [pure virtual]
 

With the method getUpgradeCosts you can get the costs the planned upgrade will cost. The costs are returned in the paremeter UpgradeCosts. Furthermore the method returns, whether there is an upgrade planned.

ameter UpgradeCosts in this substance set the costs for the
upgrade are returned, it will be overwritten in any case, even if now upgrade was planned
Returns:
true if there is an upgrade planned, if not false

Reimplemented in TSubFleetBasic.

virtual TShipDesign* TSubFleet::getUpgradeDesign   const [virtual]
 

With the method getUpgradeDesign you can get the pointer to the ship design, the subfleet shall be upgraded to. If there is no such design, because no auto upgrade si planned, the method will return the NULL-pointer.

Returns:
pointer to upgrade design or NULL

virtual bool TSubFleet::IsAutoRetire   const [virtual]
 

With the method IsAutoRetire you can get the value of the flag that determines whether the subfleet shoulf be retired at the next opportunity.

Returns:
true is the subfleet should be retired, false if not
See also:
setAutoRetire, CancelRetire

virtual bool TSubFleet::IsColonizer   const [pure virtual]
 

With the method IsColonizer you can get the information whether the ship design of the subfleet contains at least on colonization module. What you do with this information is up to the code, which handles the actual colonization. For example, it could get this information and if positive it decreases the number of ships by one and colonizes the planet.

Returns:
true if colonization module in the design, if not false

Reimplemented in TSubFleetBasic.

virtual bool TSubFleet::load TDataPackageList   in [virtual]
 

The method Load loads a TSubFleet object from the data packages in the list. Additionally it informs the parent fleet about its new subfleet. For more information look in the documentation of the ancestors of TShipDesign from where this method is inherited.

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

Reimplemented in TSubFleetBasic.

virtual TSubFleet& TSubFleet::operator= const TSubFleet &    SubFleet [virtual]
 

This is the assignment operator for TSubFleet. It copies all values of the subfleet except the fleet. The caller is responsible to inform the fleet about its new subfleet. This fleet will then inform the subfleet about its new parent. FIXME, at the moment the fields of TActioObject are NOT copied.

virtual void TSubFleet::RepairSubfleet   [pure virtual]
 

With the method RepairSubfleet you can order the subfleet to repair damages to hull, armor and other equipment. But the stocks of fighters, SP weapons and ammuntion will not be filled up.

Reimplemented in TSubFleetBasic.

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

The method Save saves a TSubFleet by adding the data packages to the list. For more information look in the documentation of the ancestors of TShipDesign, because the method Save is inherited from there.

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

Reimplemented in TSubFleetBasic.

virtual void TSubFleet::setAutoRetire   [virtual]
 

With the method setAutoRetire you can set a flag, which determines whether the subfleet is to be retired at the next opportunity. The flag can be read out with the method IsAutoRetire. The classes which are responsible for the actions of the subfleet has to check at every opportunity (i.e. planet) whether the subfleet is to be retired and if yes, destruct it with the destructor.

virtual void TSubFleet::setAutoUpgrade TShipDesign   UpgradeDesign [virtual]
 

With the method setAutoUpgrade you can give the subfleet the ship design it should become upgraded to at the next opportunity. This opportunity is signed the subfleet with the method CommitAutoUpgrade. If there is already one auto upgrade planned, it will be overwritten with the new one.

Parameters:
UpgradeDesign  the design the subfleet shall be upgraded to

virtual void TSubFleet::setExperience int4    Experience [virtual]
 

With the method setExperience you can set the amount of experience the subfleet or rather its crew has. With growing experience the battle performance of the crew increaes.

Parameters:
Experience  the new amount of experience of the subfleet

virtual void TSubFleet::setFleet TFleet   NewFleet [protected, virtual]
 

The method setFleet sets the fleet this subfleet belongs to. It doesn't care about whether the new or old parent fleet are informed about it. This method should only be called by TFleet, if the subfleet gets a new parent fleet.

Parameters:
NewFleet  the new fleet the subfleet should be added to

virtual void TSubFleet::setFuel int4    Fuel [pure virtual]
 

With the method setFuel you can get the amount of fuel the subfleet has still left.

Returns:
the amount of fuel the subfleet has still left

Reimplemented in TSubFleetBasic.

virtual void TSubFleet::SubstractShips int4    NumberOfShips [virtual]
 

With the method SubstractShips you can substract ships from the subfleet. The method doesn't complain about, if the number of ships to be substracted is 0. If the number of ships would be become 0 or negative, the method gives a fatal error.

Parameters:
NumberOfShips  number to be substracted from the subfleet


Member Data Documentation

bool TSubFleet::fAutoRetire [protected]
 

the flag which determines whether the subfleet is to be auto retired

int4 TSubFleet::fExperience [protected]
 

the amount of experience the crew of the subfleet has

TLink<TFleet> TSubFleet::fFleet [protected]
 

the link to the "parent" fleet

int4 TSubFleet::fNumberOfShips [protected]
 

the number of ships in the subfleet

TLink<TShipDesign> TSubFleet::fShipDesign [protected]
 

the link to the ship design the ships in the subfleets are of

TLink<TShipDesign> TSubFleet::fUpgradeDesign [protected]
 

the link to the ship design the subfleet shall be get upgraded to


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