SingleWeapon Class Reference

A single weapon of a Vehicletype. More...

#include <vehicletype.h>

List of all members.

Public Member Functions

 SingleWeapon ()
int getScalarWeaponType (void) const
bool requiresAmmo (void) const
bool shootable (void) const
bool service (void) const
bool placeObjects () const
bool canRefuel (void) const
void set (int type)
int gettype (void) const
bool offensive (void) const
ASCString getName (void) const
void runTextIO (PropertyContainer &pc)
bool equals (const SingleWeapon *otherWeapon) const

Static Public Member Functions

static ASCString getIconFileName (int weaponType)

Public Attributes

int targ
 the weapon can attack targets at these levels of height (bitmapped)
int sourceheight
 the weapon can be shot from these levels of height (bitmapped)
int maxdistance
 the maximum distance the weapon can shoot
int mindistance
 the minimal distance the weapon can shoot
int count
 amount of ammunition the unit having this weapon can carry
int maxstrength
 strength of the weapon when fired over the minimal distance
int minstrength
 strength of the weapon when fired over the maximum distance
int efficiency [13]
 the targeting accuracy of the weapon over different height differences between the attacking unit and the target.
int targetingAccuracy [cmovemalitypenum]
 the effectiveness of the weapon against different targets.
int laserRechargeRate
 the number of shots that the laser is recharged each turn
Resources laserRechargeCost
 the resources that recharging the laser for a single shot requires
int reactionFireShots
ASCString soundLabel
ASCString name


Detailed Description

A single weapon of a Vehicletype.

Definition at line 100 of file vehicletype.h.


Constructor & Destructor Documentation

SingleWeapon::SingleWeapon (  ) 

Definition at line 797 of file vehicletype.cpp.

References cmovemalitypenum, count, efficiency, laserRechargeRate, maxdistance, maxstrength, mindistance, minstrength, reactionFireShots, sourceheight, targ, and targetingAccuracy.


Member Function Documentation

int SingleWeapon::getScalarWeaponType ( void   )  const

Definition at line 820 of file vehicletype.cpp.

References cwmineb, cwweapon, and getFirstBit().

Referenced by assignWeaponInfo(), attackpossible(), attackpossible28(), attackpossible2n(), attackpossible2u(), Vehicle::getAmmo(), VehicleProduction_SelectionItemFactory::getCost(), getName(), WeapDist::getWeaponStrength(), InternalAmmoTransferCommand::go(), Vehicle::maxAmmo(), WeaponInfoLine::painter(), DashboardPanel::painter(), Vehicle::putAmmo(), PutMineCommand::PutMineCommand(), runTextIO(), tunitattacksobject::setresult(), tunitattacksbuilding::setresult(), tunitattacksunit::setresult(), DashboardPanel::showUnitData(), InternalAmmoTransferHandler::weaponAmmoTransferBuffer(), and WeaponInfoPanel::WeaponInfoPanel().

bool SingleWeapon::requiresAmmo ( void   )  const

Definition at line 829 of file vehicletype.cpp.

References cwlaserb, cwmineb, and cwweapon.

Referenced by VehicleProduction_SelectionItemFactory::getCost().

bool SingleWeapon::shootable ( void   )  const

Definition at line 837 of file vehicletype.cpp.

References cwshootableb.

Referenced by assignWeaponInfo(), attackpossible(), attackpossible28(), attackpossible2n(), attackpossible2u(), TrainUnitCommand::avail(), CalculateThreat_VehicleType::calc_threat_vehicletype(), Vehicle::ReactionFire::enable(), Vehicle::putAmmo(), PutMineCommand::PutMineCommand(), WeaponRange::run(), AttackCommand::searchTargets(), DashboardPanel::showUnitData(), and Vehicle::weapexist().

bool SingleWeapon::service ( void   )  const

Definition at line 847 of file vehicletype.cpp.

References cwserviceb.

Referenced by assignWeaponInfo(), RepairUnitCommand::availExternally(), getName(), ServiceChecker::getServiceWeapon(), DashboardPanel::painter(), VehicleType::runTextIO(), and DashboardPanel::showUnitData().

bool SingleWeapon::placeObjects (  )  const

Definition at line 852 of file vehicletype.cpp.

References cwobjectplacementb.

Referenced by getName().

bool SingleWeapon::canRefuel ( void   )  const

Definition at line 858 of file vehicletype.cpp.

References cwammunitionb.

Referenced by assignWeaponInfo(), Vehicle::getAmmo(), VehicleType::read(), and VehicleType::runTextIO().

void SingleWeapon::set ( int  type  ) 

Definition at line 864 of file vehicletype.cpp.

Referenced by VehicleType::read().

int SingleWeapon::gettype ( void   )  const [inline]

Definition at line 158 of file vehicletype.h.

Referenced by equals(), and VehicleType::write().

bool SingleWeapon::offensive ( void   )  const

Definition at line 842 of file vehicletype.cpp.

References cwweapon.

Referenced by attackpossible28(), attackpossible2n(), attackpossible2u(), ReactionFireSwitchCommand::avail(), CalculateThreat_VehicleType::calc_threat_vehicletype(), and Vehicle::weapexist().

ASCString SingleWeapon::getName ( void   )  const

Definition at line 869 of file vehicletype.cpp.

References cwaffentypen, cwservicen, getScalarWeaponType(), name, placeObjects(), and service().

Referenced by assignWeaponInfo(), and InternalAmmoTransferHandler::getName().

ASCString SingleWeapon::getIconFileName ( int  weaponType  )  [static]

Definition at line 888 of file vehicletype.cpp.

References cwbombn, cwcannonn, cwcruisemissile, cwlargemissilen, cwlasern, cwmachinegunn, cwminen, cwservicen, cwsmallmissilen, and cwtorpedon.

Referenced by assignWeaponInfo(), WeaponInfoLine::painter(), DashboardPanel::painter(), and AttackPanel::painter().

void SingleWeapon::runTextIO ( PropertyContainer pc  ) 

Definition at line 1226 of file vehicletype.cpp.

References PropertyContainer::addInteger(), PropertyContainer::addString(), PropertyContainer::addTagInteger(), choehenstufennum, PropertyContainer::closeBracket(), cmovemalitypenum, count, cwminen, efficiency, PropertyContainer::find(), PropertyContainer::getFileName(), getScalarWeaponType(), heightTags, PropertyContainer::isReading(), laserRechargeCost, laserRechargeRate, maxdistance, maxstrength, mindistance, minstrength, name, PropertyContainer::openBracket(), reactionFireShots, Resources::runTextIO(), soundLabel, sourceheight, strrr(), targ, targetingAccuracy, unitCategoryTags, warningMessage(), weaponTags, and weaponTypeNum.

Referenced by VehicleType::runTextIO().

bool SingleWeapon::equals ( const SingleWeapon otherWeapon  )  const

Definition at line 917 of file vehicletype.cpp.

References count, efficiency, gettype(), maxdistance, maxstrength, mindistance, minstrength, sourceheight, and targ.


Member Data Documentation

int SingleWeapon::targ

the weapon can attack targets at these levels of height (bitmapped)

Definition at line 105 of file vehicletype.h.

Referenced by assignWeaponInfo(), attackpossible(), attackpossible28(), attackpossible2n(), attackpossible2u(), CalculateThreat_VehicleType::calc_threat_vehicletype(), equals(), WeaponInfoLine::painter(), VehicleType::read(), runTextIO(), SingleWeapon(), and VehicleType::write().

int SingleWeapon::sourceheight

the weapon can be shot from these levels of height (bitmapped)

Definition at line 108 of file vehicletype.h.

Referenced by assignWeaponInfo(), attackpossible(), attackpossible28(), attackpossible2n(), attackpossible2u(), CalculateThreat_VehicleType::calc_threat_vehicletype(), Vehicle::ReactionFire::enable(), equals(), WeaponInfoLine::painter(), PutMineCommand::PutMineCommand(), VehicleType::read(), runTextIO(), AttackCommand::searchTargets(), SingleWeapon(), and VehicleType::write().

int SingleWeapon::maxdistance

the maximum distance the weapon can shoot

Definition at line 111 of file vehicletype.h.

Referenced by assignWeaponInfo(), equals(), WeapDist::getWeaponStrength(), StandardUnitCostCalculator::productionCost(), VehicleType::read(), WeaponRange::run(), runTextIO(), AttackCommand::searchTargets(), DataTab::setData(), SingleWeapon(), and VehicleType::write().

int SingleWeapon::mindistance

the minimal distance the weapon can shoot

Definition at line 114 of file vehicletype.h.

Referenced by assignWeaponInfo(), attackpossible(), attackpossible28(), attackpossible2n(), CalculateThreat_VehicleType::calc_threat_vehicletype(), equals(), WeapDist::getWeaponStrength(), VehicleType::read(), WeaponRange::run(), runTextIO(), AttackCommand::searchTargets(), DataTab::setData(), SingleWeapon(), and VehicleType::write().

int SingleWeapon::count

amount of ammunition the unit having this weapon can carry

Definition at line 117 of file vehicletype.h.

Referenced by assignWeaponInfo(), TrainUnitCommand::avail(), equals(), Vehicle::fillMagically(), VehicleProduction_SelectionItemFactory::getCost(), InternalAmmoTransferHandler::getMaxAmmo(), UnitPropertyEditor::init(), Vehicle::maxAmmo(), InternalAmmoTransferHandler::performTransfer(), Vehicle::putAmmo(), VehicleType::read(), ConsumeAmmo::runAction(), runTextIO(), DashboardPanel::showUnitData(), SingleWeapon(), Vehicle::transform(), ConsumeAmmo::undoAction(), VehicleType::write(), and Vehicle::write().

int SingleWeapon::maxstrength

strength of the weapon when fired over the minimal distance

Definition at line 120 of file vehicletype.h.

Referenced by assignWeaponInfo(), CalculateThreat_VehicleType::calc_threat_vehicletype(), equals(), Vehicle::fillMagically(), WeapDist::getWeaponStrength(), PutMineCommand::go(), VehicleType::read(), runTextIO(), DataTab::setData(), DashboardPanel::showUnitData(), SingleWeapon(), Vehicle::transform(), VehicleType::write(), and Vehicle::write().

int SingleWeapon::minstrength

strength of the weapon when fired over the maximum distance

Definition at line 123 of file vehicletype.h.

Referenced by assignWeaponInfo(), equals(), WeapDist::getWeaponStrength(), VehicleType::read(), runTextIO(), DataTab::setData(), SingleWeapon(), and VehicleType::write().

int SingleWeapon::efficiency[13]

the targeting accuracy of the weapon over different height differences between the attacking unit and the target.

The levels "ground" and "floating" are assumed to be the same. All values are in percent. The index for this array is the height difference+6 Example: low flying airplane attacking a submerged submarine: height difference is -2 ; index here is 4

Definition at line 132 of file vehicletype.h.

Referenced by attackpossible(), attackpossible28(), attackpossible2n(), attackpossible2u(), equals(), WeapDist::getWeaponStrength(), VehicleType::read(), runTextIO(), SingleWeapon(), and VehicleType::write().

int SingleWeapon::targetingAccuracy[cmovemalitypenum]

the effectiveness of the weapon against different targets.

All values are in percent.

See also:
cmovemalitypes

Definition at line 137 of file vehicletype.h.

Referenced by attackpossible(), attackpossible28(), attackpossible2n(), attackpossible2u(), VehicleType::read(), runTextIO(), SingleWeapon(), and VehicleType::write().

int SingleWeapon::laserRechargeRate

the number of shots that the laser is recharged each turn

Definition at line 140 of file vehicletype.h.

Referenced by VehicleType::read(), runTextIO(), DataTab::setData(), SingleWeapon(), and VehicleType::write().

Resources SingleWeapon::laserRechargeCost

the resources that recharging the laser for a single shot requires

Definition at line 143 of file vehicletype.h.

Referenced by VehicleType::read(), runTextIO(), DataTab::setData(), and VehicleType::write().

int SingleWeapon::reactionFireShots

Definition at line 145 of file vehicletype.h.

Referenced by assignWeaponInfo(), ReactionFireSwitchCommand::avail(), Vehicle::ReactionFire::checkData(), VehicleType::read(), runTextIO(), VehicleType::runTextIO(), DashboardPanel::showUnitData(), SingleWeapon(), and VehicleType::write().

ASCString SingleWeapon::soundLabel

Definition at line 147 of file vehicletype.h.

Referenced by VehicleType::read(), runTextIO(), and VehicleType::write().

ASCString SingleWeapon::name

Definition at line 149 of file vehicletype.h.

Referenced by getName(), VehicleType::read(), runTextIO(), DataTab::setData(), and VehicleType::write().


The documentation for this class was generated from the following files:
Generated on Mon May 21 01:47:29 2012 for Advanced Strategic Command by  doxygen 1.5.1