OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
CraftWeapon.h
1 /*
2  * Copyright 2010-2014 OpenXcom Developers.
3  *
4  * This file is part of OpenXcom.
5  *
6  * OpenXcom is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * OpenXcom is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef OPENXCOM_CRAFTWEAPON_H
20 #define OPENXCOM_CRAFTWEAPON_H
21 
22 #include <string>
23 #include <yaml-cpp/yaml.h>
24 
25 namespace OpenXcom
26 {
27 
28 class RuleCraftWeapon;
29 class CraftWeaponProjectile;
30 class Ruleset;
31 
38 {
39 private:
40  RuleCraftWeapon *_rules;
41  int _ammo;
42  bool _rearming;
43 public:
45  CraftWeapon(RuleCraftWeapon *rules, int ammo);
47  ~CraftWeapon();
49  void load(const YAML::Node& node);
51  YAML::Node save() const;
53  RuleCraftWeapon *getRules() const;
55  int getAmmo() const;
57  bool setAmmo(int ammo);
59  bool isRearming() const;
61  void setRearming(bool rearming);
63  int rearm(const int available, const int clipSize);
65  CraftWeaponProjectile* fire() const;
67  int getClipsLoaded(Ruleset* ruleset);
68 
69 };
70 
71 }
72 
73 #endif
int rearm(const int available, const int clipSize)
Rearms the craft weapon.
Definition: CraftWeapon.cpp:131
bool isRearming() const
Gets the craft weapon's rearming status.
Definition: CraftWeapon.cpp:110
CraftWeaponProjectile * fire() const
Fires the craft weapon. Used during dogfights.
Definition: CraftWeapon.cpp:163
void setRearming(bool rearming)
Sets the craft weapon's rearming status.
Definition: CraftWeapon.cpp:120
Represents a craft weapon equipped by a craft.
Definition: CraftWeapon.h:37
CraftWeapon(RuleCraftWeapon *rules, int ammo)
Creates a craft weapon of the specified type.
Definition: CraftWeapon.cpp:33
RuleCraftWeapon * getRules() const
Gets the craft weapon's ruleset.
Definition: CraftWeapon.cpp:72
YAML::Node save() const
Saves the craft weapon to YAML.
Definition: CraftWeapon.cpp:58
Set of rules and stats for a game.
Definition: Ruleset.h:69
int getAmmo() const
Gets the craft weapon's ammo.
Definition: CraftWeapon.cpp:81
~CraftWeapon()
Cleans up the craft weapon.
Definition: CraftWeapon.cpp:40
void load(const YAML::Node &node)
Loads the craft weapon from YAML.
Definition: CraftWeapon.cpp:48
int getClipsLoaded(Ruleset *ruleset)
get how many clips are loaded into this weapon.
Definition: CraftWeapon.cpp:179
Represents a specific type of craft weapon.
Definition: RuleCraftWeapon.h:35
bool setAmmo(int ammo)
Sets the craft weapon's ammo.
Definition: CraftWeapon.cpp:91
Definition: CraftWeaponProjectile.h:36