Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Instruction.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: Instruction.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Instruction (NavPoint / Order / Objective) class declaration
13 */
14 
15 #ifndef Instruction_h
16 #define Instruction_h
17 
18 #include "Types.h"
19 #include "Geometry.h"
20 #include "SimObject.h"
21 #include "Text.h"
22 #include "RLoc.h"
23 
24 // +--------------------------------------------------------------------+
25 
26 class Ship;
27 
28 // +--------------------------------------------------------------------+
29 
30 class Instruction : public SimObserver
31 {
32 public:
33  static const char* TYPENAME() { return "Instruction"; }
34 
35  enum ACTION
36  {
40  RTB,
41 
47  STRIKE, // ground attack
48  ASSAULT, // starship attack
50 
51  //RECALL,
52  //DEPLOY,
53 
55  };
56 
57  enum STATUS
58  {
65 
67  };
68 
69  enum FORMATION
70  {
73  BOX,
75 
77  };
78 
79  enum PRIORITY
80  {
81  PRIMARY = 1,
84  };
85 
86  Instruction(int action, const char* tgt);
87  Instruction(const char* rgn, Point loc, int act=VECTOR);
88  Instruction(SimRegion* rgn, Point loc, int act=VECTOR);
89  Instruction(const Instruction& instr);
90  virtual ~Instruction();
91 
93 
94  // accessors:
95  static const char* ActionName(int a);
96  static const char* StatusName(int s);
97  static const char* FormationName(int f);
98  static const char* PriorityName(int p);
99 
100  const char* RegionName() const { return rgn_name; }
101  SimRegion* Region() const { return region; }
102  Point Location() const;
103  RLoc& GetRLoc() { return rloc; }
104  int Action() const { return action; }
105  int Status() const { return status; }
106  int Formation() const { return formation; }
107  int Speed() const { return speed; }
108  int EMCON() const { return emcon; }
109  int WeaponsFree() const { return wep_free; }
110  int Priority() const { return priority; }
111  int Farcast() const { return farcast; }
112  double HoldTime() const { return hold_time; }
113 
114  const char* TargetName() const { return tgt_name; }
115  const char* TargetDesc() const { return tgt_desc; }
116  SimObject* GetTarget();
117 
118  void Evaluate(Ship* s);
119  const char* GetShortDescription() const;
120  const char* GetDescription() const;
121 
122  // mutators:
123  void SetRegion(SimRegion* r) { region = r; }
124  void SetLocation(const Point& l);
125  void SetAction(int s) { action = s; }
126  void SetStatus(int s);
127  void SetFormation(int s) { formation = s; }
128  void SetSpeed(int s) { speed = s; }
129  void SetEMCON(int e) { emcon = e; }
130  void SetWeaponsFree(int f) { wep_free = f; }
131  void SetPriority(int p) { priority = p; }
132  void SetFarcast(int f) { farcast = f; }
133  void SetHoldTime(double t) { hold_time = t; }
134 
135  void SetTarget(const char* n);
136  void SetTarget(SimObject* s);
137  void SetTargetDesc(const char* d);
138  void ClearTarget();
139 
140  virtual bool Update(SimObject* s);
141  virtual const char* GetObserverName() const;
142 
143 protected:
147  int action;
149  int status;
150  int speed;
151 
155  int emcon;
156  int wep_free;
157  int priority;
158  int farcast;
159 
160  double hold_time;
161 };
162 
163 // +--------------------------------------------------------------------+
164 
165 #endif Instruction_h
166