Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
HardPoint.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: HardPoint.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Hard Point (gun or missile launcher) class
13 */
14 
15 #ifndef HardPoint_h
16 #define HardPoint_h
17 
18 #include "Types.h"
19 #include "Geometry.h"
20 #include "Text.h"
21 
22 // +--------------------------------------------------------------------+
23 
24 class Weapon;
25 class WeaponDesign;
26 
27 // +--------------------------------------------------------------------+
28 
29 class HardPoint
30 {
31 public:
32  static const char* TYPENAME() { return "HardPoint"; }
33 
34  enum CONSTANTS { MAX_DESIGNS=8 };
35 
36  HardPoint(Vec3 muzzle, double az=0, double el=0);
37  HardPoint(const HardPoint& rhs);
38  virtual ~HardPoint();
39 
40  int operator==(const HardPoint& w) const { return this == &w; }
41 
42  virtual void AddDesign(WeaponDesign* dsn);
43  virtual Weapon* CreateWeapon(int type_index=0);
44  virtual double GetCarryMass(int type_index=0);
45  WeaponDesign* GetWeaponDesign(int n) { return designs[n]; }
46 
47  virtual void Mount(Point loc, float rad, float hull=0.5f);
48  Point MountLocation() const { return mount_rel; }
49  double Radius() const { return radius; }
50  double HullProtection() const { return hull_factor; }
51 
52  virtual const char* GetName() const { return name; }
53  virtual void SetName(const char* s) { name = s; }
54  virtual const char* GetAbbreviation() const { return abrv; }
55  virtual void SetAbbreviation(const char* s) { abrv = s; }
56  virtual const char* GetDesign() const { return sys_dsn; }
57  virtual void SetDesign(const char* s) { sys_dsn = s; }
58 
59  virtual double GetAzimuth() const { return aim_azimuth; }
60  virtual void SetAzimuth(double a) { aim_azimuth = (float) a; }
61  virtual double GetElevation() const { return aim_elevation; }
62  virtual void SetElevation(double e) { aim_elevation = (float) e; }
63 
64 protected:
65  // Displayable name:
69 
72  float aim_azimuth;
74 
75  // Mounting:
76  Point mount_rel; // object space
77  float radius;
78  float hull_factor;
79 };
80 
81 #endif HardPoint_h
82