OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
OpenXcom::CraftWeapon Class Reference

Represents a craft weapon equipped by a craft. More...

#include <CraftWeapon.h>

Public Member Functions

 CraftWeapon (RuleCraftWeapon *rules, int ammo)
 Creates a craft weapon of the specified type. More...
 
 ~CraftWeapon ()
 Cleans up the craft weapon.
 
void load (const YAML::Node &node)
 Loads the craft weapon from YAML. More...
 
YAML::Node save () const
 Saves the craft weapon to YAML. More...
 
RuleCraftWeapongetRules () const
 Gets the craft weapon's ruleset. More...
 
int getAmmo () const
 Gets the craft weapon's ammo. More...
 
bool setAmmo (int ammo)
 Sets the craft weapon's ammo. More...
 
bool isRearming () const
 Gets the craft weapon's rearming status. More...
 
void setRearming (bool rearming)
 Sets the craft weapon's rearming status. More...
 
int rearm (const int available, const int clipSize)
 Rearms the craft weapon. More...
 
CraftWeaponProjectilefire () const
 Fires the craft weapon. Used during dogfights.
 
int getClipsLoaded (Ruleset *ruleset)
 get how many clips are loaded into this weapon.
 

Detailed Description

Represents a craft weapon equipped by a craft.

Contains variable info about a craft weapon like ammo.

See also
RuleCraftWeapon

Constructor & Destructor Documentation

OpenXcom::CraftWeapon::CraftWeapon ( RuleCraftWeapon rules,
int  ammo 
)

Creates a craft weapon of the specified type.

Initializes a craft weapon of the specified type.

Parameters
rulesPointer to ruleset.
ammoInitial ammo.

Member Function Documentation

int OpenXcom::CraftWeapon::getAmmo ( ) const

Gets the craft weapon's ammo.

Returns the ammo contained in this craft weapon.

Returns
Weapon ammo.
RuleCraftWeapon * OpenXcom::CraftWeapon::getRules ( ) const

Gets the craft weapon's ruleset.

Returns the ruleset for the craft weapon's type.

Returns
Pointer to ruleset.
bool OpenXcom::CraftWeapon::isRearming ( ) const

Gets the craft weapon's rearming status.

Returns whether this craft weapon needs rearming.

Returns
Rearming status.
void OpenXcom::CraftWeapon::load ( const YAML::Node &  node)

Loads the craft weapon from YAML.

Loads the craft weapon from a YAML file.

Parameters
nodeYAML node.
int OpenXcom::CraftWeapon::rearm ( const int  available,
const int  clipSize 
)

Rearms the craft weapon.

Rearms this craft weapon's ammo.

Parameters
availablenumber of clips available.
clipSizenumber of rounds in said clips.
Returns
number of clips used.
YAML::Node OpenXcom::CraftWeapon::save ( ) const

Saves the craft weapon to YAML.

Saves the base to a YAML file.

Returns
YAML node.
bool OpenXcom::CraftWeapon::setAmmo ( int  ammo)

Sets the craft weapon's ammo.

Changes the ammo contained in this craft weapon.

Parameters
ammoWeapon ammo.
Returns
If the weapon ran out of ammo.
void OpenXcom::CraftWeapon::setRearming ( bool  rearming)

Sets the craft weapon's rearming status.

Changes whether this craft weapon needs rearming (for example, in case there's no more ammo).

Parameters
rearmingRearming status.

The documentation for this class was generated from the following files: