Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sensor.h
Go to the documentation of this file.
1 // -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
2 
3 #ifndef VEGASTRIKE_GFX_RADAR_SENSOR_H
4 #define VEGASTRIKE_GFX_RADAR_SENSOR_H
5 
6 #include <vector>
7 #include "track.h"
8 
9 class Unit;
10 struct GFXColor; // Edit from class to struct as defined in gfxlib_struct.
11 
12 namespace Radar
13 {
14 
15 // Sensor is a proxy for two types of information:
16 // 1. The operational parameters of the radar (e.g. range)
17 // 2. Information detected by the radar (e.g. tracks)
18 class Sensor
19 {
20 public:
21  typedef std::vector<Track> TrackCollection;
22 
23  struct Capability
24  {
25  enum Value
26  {
27  None = 0,
28  FriendFoe = 1 << 0,
29  ObjectType = 1 << 1,
31  };
32  };
33 
34  struct ThreatLevel
35  {
36  enum Value
37  {
38  None, // Not attacking
39  Low, // Lock
40  Medium, // Capship with lock
41  High // Missile
42  };
43  };
44 
45 public:
46  Sensor(Unit *player);
47 
48  Unit *GetPlayer() const;
49  float GetCloseRange() const;
50  float GetMaxRange() const;
51  float GetMaxCone() const;
52  float GetLockCone() const;
53  // Does the sensor support the Identify Friend or Foe capability?
54  bool UseFriendFoe() const;
55  // Can the sensor distinguish ships from planets?
56  bool UseObjectRecognition() const;
57  // Can the sensor detect harmful ships
58  bool UseThreatAssessment() const;
59 
60  Track CreateTrack(Unit *) const;
61  Track CreateTrack(Unit *, const Vector&) const;
62 
63  // I am tracking target
64  bool IsTracking(const Track&) const;
65  bool InsideNebula() const;
66  bool InRange(const Track&) const;
67 
68  const TrackCollection& FindTracksInRange() const;
69 
71 
72  GFXColor GetColor(const Track&) const;
73 
74 protected:
76  float closeRange;
79 };
80 
81 } // namespace Radar
82 
83 #endif