CSWWeaponBattery Class Reference

Inheritance diagram for CSWWeaponBattery:

Inheritance graph
List of all members.

Public Member Functions

virtual const unsigned long & getRechargingIDs () const
virtual double getFillLevel () const
virtual const unsigned long & tryRecharging (const std::string &strResourceProvider, const unsigned long &nResourceIDs)
bool release (boost::shared_ptr< CSWWeapon > pWeapon)
bool releaseNext (double fArmDelay=5.0)
boost::shared_ptr< CSWWeapongetNext () const
const Vector3D & getDirection () const
int getSize () const
int getNumInserted () const
bool isFull () const
bool isEmpty () const

Detailed Description

This class provides functionality to store, launch and recharge weapons. Weapons can only launched via WeaponBatteries. At least one second should be waited between two weapon releases. Otherwise the release failed and no weapon is released. When firing a weapon through a weapon battery the following things will happen:
  1. the weapon will be armed (only when used releaseNext()),
  2. the weapon will be launched/released and
  3. the weapon will explode on a defined trigger.

Member Function Documentation

const unsigned long & CSWWeaponBattery::getRechargingIDs (  )  const [virtual]

Signals if the recharging is currently running.

The recharging resource ids if recharging is currently running otherwise 0.

Implements CSWIRechargeable.

double CSWWeaponBattery::getFillLevel (  )  const [virtual]

Returns the current fill level in range [0, 1].

The current fill level in range [0, 1].

Implements CSWIRechargeable.

const unsigned long & CSWWeaponBattery::tryRecharging ( const std::string &  strResourceProvider,
const unsigned long &  nResourceIDs 
) [virtual]

Tries to recharge itself by the given resource provider.

strResourceProvider The name of the resource provider on which the object should try to recharge.
nResourceIDs The bitwise ORed resources that should be recharged by the requested provider. This should be a subset of the resources that this rechargeable object could contain.
Returns the resource ids that will be recharged. Not 0 is returned on successfully applying for recharging on the given provider for at least one requested resource otherwise 0.

Implements CSWIRechargeable.

bool CSWWeaponBattery::release ( boost::shared_ptr< CSWWeapon pWeapon  ) 

Launches a given weapon. If no weapon is given nothing will be done.

pWeapon The weapon that should be launched.
True on success
The weapon _must_ be arm before launch. Otherwise the weapon will _never_ fire.

bool CSWWeaponBattery::releaseNext ( double  fArmDelay = 5.0  ) 

Arms and launches the next available weapon. If no weapon is available nothing will be done.

fArmDelay The time in seconds when the weapon should be armed.
True on success

CSWWeapon::PtrType CSWWeaponBattery::getNext (  )  const

Returns the weapon that would be launched next.

The weapon that would be released next time. If no weapon is available None will returned.

const Vector3D & CSWWeaponBattery::getDirection (  )  const

Returns the direction in world coordinate system in which the weapon are launched.

The direction in world coordinate systen in which the weapon are launched.

int CSWWeaponBattery::getSize (  )  const

Returns how many weapon can contain the weapon battery.

The capacity of the weapon battery.

int CSWWeaponBattery::getNumInserted (  )  const

Returns the current number of available weapons.

The number of currently inserted weapons.

bool CSWWeaponBattery::isFull (  )  const

Returns true if the battery is full.

True if full.

bool CSWWeaponBattery::isEmpty (  )  const

Returns true if the battery is empty.

True if empty.

Generated at 2 Jan 2007 for project CodeSubWars. www.codesubwars.org