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
track.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_TRACK_H
4 #define VEGASTRIKE_GFX_RADAR_TRACK_H
5 
6 #include "gfx/vec.h"
7 
8 class Unit;
9 struct GFXColor; // Edit from class to struct as defined in gfxlib_struct.
10 
11 namespace Radar
12 {
13 
14 class Sensor;
15 
16 // Track is a wrapper for Unit that restricts the available functionality
17 // to that which can be detected through the radar.
18 class Track
19 {
20 public:
21  struct Type
22  {
23  enum Value
24  {
37  };
38  };
39 
40  struct Relation
41  {
42  enum Value
43  {
47  };
48  };
49 
50 public:
51  // Get the track position relative to myself
52  const Vector& GetPosition() const;
53  // Get the relative distance between the track and me
54  float GetDistance() const;
55  // Get the absolute size of the track
56  float GetSize() const;
57  Type::Value GetType() const;
58 
59  // Track is exploding
60  bool IsExploding() const;
61  // The percentage of how far the explosion has come [0; 1]
62  float ExplodingProgress() const;
63 
64  // Track is equipped with weapons
65  bool HasWeapons() const;
66  // Track is equipped with turrets
67  bool HasTurrets() const;
68  // Track has activated ECM
69  bool HasActiveECM() const;
70 
71  // Track is tracking me
72  bool HasLock() const;
73  // Track has a weapon lock on me
74  bool HasWeaponLock() const;
75 
76  // Determine if track is friend or foe
78 
79 protected:
80  // Produced by Sensor::CreateTrack
81  friend class Sensor;
82  Track(Unit *, Unit *);
83  Track(Unit *, Unit *, const Vector&);
84  Track(Unit *, Unit *, const Vector&, float);
85 
86  Type::Value IdentifyType() const;
87 
88 protected:
92  float distance;
94 };
95 
96 } // namespace Radar
97 
98 #endif