Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
WeaponGroup.h
Go to the documentation of this file.
1 /* Project Starshatter 4.5
2  Destroyer Studios LLC
3  Copyright © 1997-2004. All Rights Reserved.
4 
5  SUBSYSTEM: Stars.exe
6  FILE: WeaponGroup.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Weapon Control Category (Group) class
13 */
14 
15 #ifndef WeaponGroup_h
16 #define WeaponGroup_h
17 
18 #include "Types.h"
19 #include "Weapon.h"
20 #include "Text.h"
21 
22 // +--------------------------------------------------------------------+
23 
25 {
26 public:
27  static const char* TYPENAME() { return "WeaponGroup"; }
28 
29  WeaponGroup(const char* name);
30  ~WeaponGroup();
31 
32  void ExecFrame(double factor);
33 
34  // identification:
35  const char* Name() const { return name; }
36  const char* Abbreviation() const { return abrv; }
37  void SetName(const char* n);
38  void SetAbbreviation(const char* a);
39 
40  bool IsPrimary() const;
41  bool IsDrone() const;
42  bool IsDecoy() const;
43  bool IsProbe() const;
44  bool IsMissile() const;
45  bool IsBeam() const;
46  int Value() const;
47 
48  // weapon list:
49  void AddWeapon(Weapon* w);
50  int NumWeapons() const;
52  bool Contains(const Weapon* w) const;
53 
54  // weapon selection:
55  void SelectWeapon(int n);
56  void CycleWeapon();
57  Weapon* GetWeapon(int n) const;
58  Weapon* GetSelected() const;
59 
60  // operations:
61  bool GetTrigger() const { return trigger; }
62  void SetTrigger(bool t=true) { trigger = t; }
63  int Ammo() const { return ammo; }
64  float Mass() const { return mass; }
65  float Resistance() const { return resist; }
66  void CheckAmmo();
67 
68  void SetTarget(SimObject* t, System* sub=0);
69  SimObject* GetTarget() const;
70  System* GetSubTarget() const;
71  void DropTarget();
72  void SetFiringOrders(int o);
73  int GetFiringOrders() const { return orders; }
74  void SetControlMode(int m);
75  int GetControlMode() const { return control; }
76  void SetSweep(int s);
77  int GetSweep() const { return sweep; }
78  int Status() const;
79 
80  WeaponDesign* GetDesign() const;
81  bool CanTarget(DWORD tgt_class) const;
82 
83  void PowerOn();
84  void PowerOff();
85 
86 protected:
87  // Displayable name:
90 
92 
93  int selected;
94  bool trigger;
95  int ammo;
96 
97  int orders;
98  int control;
99  int sweep;
100 
101  float mass;
102  float resist;
103 };
104 
105 #endif WeaponGroup_h
106