Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Contact.h
Go to the documentation of this file.
1 /* Project STARSHATTER
2  John DiCamillo
3  Copyright © 1997-2002. All Rights Reserved.
4 
5  SUBSYSTEM: Stars.exe
6  FILE: Contact.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Sensor Contact class
13 */
14 
15 #ifndef Contact_h
16 #define Contact_h
17 
18 #include "Types.h"
19 #include "SimObject.h"
20 #include "System.h"
21 #include "Geometry.h"
22 
23 // +--------------------------------------------------------------------+
24 
25 class Ship;
26 class Shot;
27 
28 class Contact : public SimObserver
29 {
30  friend class Sensor;
31 
32 public:
33  static const char* TYPENAME() { return "Contact"; }
34 
35  Contact();
36  Contact(Ship* s, float p, float a);
37  Contact(Shot* s, float p, float a);
38  virtual ~Contact();
39 
40  int operator == (const Contact& c) const;
41 
42  Ship* GetShip() const { return ship; }
43  Shot* GetShot() const { return shot; }
44  Point Location() const { return loc; }
45 
46  double PasReturn() const { return d_pas; }
47  double ActReturn() const { return d_act; }
48  bool PasLock() const;
49  bool ActLock() const;
50  double Age() const;
51  bool IsProbed() const { return probe; }
52 
53  DWORD AcquisitionTime() const { return acquire_time; }
54 
55  int GetIFF(const Ship* observer) const;
56  void GetBearing(const Ship* observer, double& az, double& el, double& r) const;
57  double Range(const Ship* observer,
58  double limit=75e3) const;
59 
60  bool InFront(const Ship* observer) const;
61  bool Threat(const Ship* observer) const;
62  bool Visible(const Ship* observer) const;
63 
64  void Reset();
65  void Merge(Contact* c);
66  void ClearTrack();
67  void UpdateTrack();
68  int TrackLength() const { return ntrack; }
69  Point TrackPoint(int i) const;
70 
71  virtual bool Update(SimObject* obj);
72  virtual const char* GetObserverName() const;
73 
74 private:
75  Ship* ship;
76  Shot* shot;
77  Point loc;
78  DWORD acquire_time;
79  DWORD time;
80 
81  Point* track;
82  int ntrack;
83  DWORD track_time;
84 
85  float d_pas; // power output
86  float d_act; // mass, size
87  bool probe; // scanned by probe
88 };
89 
90 #endif Contact_h
91