- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

# Weapon Class Reference

`#include <Weapon.h>`

Inheritance diagram for Weapon:

List of all members.

## Public Member Functions
| Weapon ()
| Weapon (std::string filename, Person *shooter)
void | load (List *info)
void | shoot ()
void | update ()
virtual Weapon * | copy (Person *shooter)
void | addAmmo (int dAmmo)
int | getAmmo ()
SDL_Rect | drawAmmo (SDL_Rect)
std::string | id ()
## Protected Attributes
Person * | _shooter
Sprite * | _icon
int | _waitShoot
int | _framesSinceShoot
int | _bulletSpeed
int | _damage
unsigned int | _ammo
unsigned int | _ammoSize
bool | _spray
int | _sprayCount
std::string | _id

## Detailed Description

Definition at line 12 of file Weapon.h.

## Constructor & Destructor Documentation

Weapon::Weapon | ( |  | ) |

| Definition at line 14 of file Weapon.cpp. Referenced by copy().

Weapon::Weapon | ( | std::string | filename,
|  | Person * | shooter
| ) |

| Definition at line 19 of file Weapon.cpp. References load(), and Parser::parse().

## Member Function Documentation

void Weapon::addAmmo | ( | int | dAmmo | ) |

| Definition at line 64 of file Weapon.cpp. References _ammo. Referenced by Player::addSecondary().

Weapon * Weapon::copy | ( | Person * | shooter | ) | `[virtual]`

| Reimplemented in WeaponPunch. Definition at line 30 of file Weapon.cpp. References _shooter, and Weapon(). Referenced by Player::copy(), Person::copy(), and Enemy::copy().

SDL_Rect Weapon::drawAmmo | ( | SDL_Rect |  | ) |

| Definition at line 71 of file Weapon.cpp. References _ammo, _icon, Sprite::draw(), glfuncs::glPrint(), glfuncs::instance(), and Sprite::SCREEN. Referenced by Player::drawSecondaryAmmo().

int Weapon::getAmmo | ( |  | ) | `[inline]`

| Definition at line 25 of file Weapon.h. References _ammo. Referenced by Player::addSecondary(), and Player::update().

std::string Weapon::id | ( |  | ) | `[inline]`

| Definition at line 29 of file Weapon.h. References _id. Referenced by Player::addSecondary().

void Weapon::load | ( | List * | info | ) |

| Definition at line 37 of file Weapon.cpp. References _ammo, _ammoSize, _bulletSpeed, _damage, _icon, _id, _spray, _waitShoot, List::empty(), List::firstList(), List::firstString(), Sprite::loadSprite(), and List::rest(). Referenced by Weapon(), and WeaponPunch::WeaponPunch().

void Weapon::shoot | ( |  | ) |

| Reimplemented in WeaponPunch. Definition at line 86 of file Weapon.cpp. References _ammo, _ammoSize, _bulletSpeed, _damage, _framesSinceShoot, _id, _shooter, _spray, _sprayCount, _waitShoot, Object::getId(), Level::instance(), and Level::registerObject(). Referenced by Person::shoot(), and Player::shootSecondary().

void Weapon::update | ( |  | ) |

| Definition at line 121 of file Weapon.cpp. References _framesSinceShoot. Referenced by Player::update(), and Person::update().

## Member Data Documentation

unsigned int Weapon::_ammo`[protected]`

| Definition at line 41 of file Weapon.h. Referenced by addAmmo(), drawAmmo(), getAmmo(), load(), and shoot().

unsigned int Weapon::_ammoSize`[protected]`

| Definition at line 42 of file Weapon.h. Referenced by load(), and shoot().

int Weapon::_bulletSpeed`[protected]`

| Definition at line 38 of file Weapon.h. Referenced by load(), and shoot().

int Weapon::_damage`[protected]`

| Definition at line 39 of file Weapon.h. Referenced by load(), and shoot().

int Weapon::_framesSinceShoot`[protected]`

| Definition at line 37 of file Weapon.h. Referenced by WeaponPunch::shoot(), shoot(), and update().

Sprite* Weapon::_icon`[protected]`

| Definition at line 34 of file Weapon.h. Referenced by drawAmmo(), and load().

std::string Weapon::_id`[protected]`

| Definition at line 48 of file Weapon.h. Referenced by id(), load(), and shoot().

Person* Weapon::_shooter`[protected]`

| Definition at line 32 of file Weapon.h. Referenced by WeaponPunch::copy(), copy(), WeaponPunch::shoot(), and shoot().

bool Weapon::_spray`[protected]`

| Definition at line 44 of file Weapon.h. Referenced by load(), and shoot().

int Weapon::_sprayCount`[protected]`

| Definition at line 46 of file Weapon.h. Referenced by shoot().

int Weapon::_waitShoot`[protected]`

| Definition at line 36 of file Weapon.h. Referenced by load(), WeaponPunch::shoot(), and shoot().

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

- C:/Documents and Settings/jegan/Desktop/projectX/Weapon.h
- C:/Documents and Settings/jegan/Desktop/projectX/Weapon.cpp