1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
|
/* Starshatter: The Open Source Project
Copyright (c) 2021-2024, Starshatter: The Open Source Project Contributors
Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
Copyright (c) 1997-2006, Destroyer Studios LLC.
AUTHOR: John DiCamillo
OVERVIEW
========
Simulation Universe and Region classes
*/
#ifndef Mission_h
#define Mission_h
#include "Types.h"
#include "Intel.h"
#include "RLoc.h"
#include "Universe.h"
#include "Scene.h"
#include "Skin.h"
#include "Physical.h"
#include "Geometry.h"
#include "List.h"
#include "Text.h"
// +--------------------------------------------------------------------+
class Mission;
class MissionElement;
class MissionLoad;
class MissionEvent;
class MissionShip;
class CombatGroup;
class CombatUnit;
class Ship;
class System;
class Element;
class ShipDesign;
class WeaponDesign;
class StarSystem;
class Instruction;
class Term;
class TermArray;
class TermStruct;
// +--------------------------------------------------------------------+
class Mission
{
public:
static const char* TYPENAME() { return "Mission"; }
enum TYPE
{
PATROL,
SWEEP,
INTERCEPT,
AIR_PATROL,
AIR_SWEEP,
AIR_INTERCEPT,
STRIKE, // ground attack
ASSAULT, // starship attack
DEFEND,
ESCORT,
ESCORT_FREIGHT,
ESCORT_SHUTTLE,
ESCORT_STRIKE,
INTEL,
SCOUT,
RECON,
BLOCKADE,
FLEET,
BOMBARDMENT,
FLIGHT_OPS,
TRANSPORT,
CARGO,
TRAINING,
OTHER
};
Mission(int id, const char* filename=0, const char* path=0);
virtual ~Mission();
int operator == (const Mission& m) const { return id == m.id; }
virtual void Validate();
virtual bool Load(const char* filename=0, const char* path=0);
virtual bool Save();
virtual bool ParseMission(const char* buffer);
virtual void SetPlayer(MissionElement* player_element);
virtual MissionElement* GetPlayer();
// accessors/mutators:
int Identity() const { return id; }
const char* FileName() const { return filename; }
const char* Name() const { return name; }
const char* Description() const { return desc; }
const char* Situation() const { return sitrep; }
const char* Objective() const { return objective; }
const char* Subtitles() const;
int Start() const { return start; }
double Stardate() const { return stardate; }
int Type() const { return type; }
const char* TypeName() const { return RoleName(type); }
int Team() const { return team; }
bool IsOK() const { return ok; }
bool IsActive() const { return active; }
bool IsComplete() const { return complete; }
StarSystem* GetStarSystem() const { return star_system; }
List<StarSystem>& GetSystemList() { return system_list; }
const char* GetRegion() const { return region; }
List<MissionElement>& GetElements() { return elements; }
virtual MissionElement* FindElement(const char* name);
virtual void AddElement(MissionElement* elem);
List<MissionEvent>& GetEvents() { return events; }
MissionEvent* FindEvent(int event_type) const;
virtual void AddEvent(MissionEvent* event);
MissionElement* GetTarget() const { return target; }
MissionElement* GetWard() const { return ward; }
void SetName(const char* n) { name = n; }
void SetDescription(const char* d) { desc = d; }
void SetSituation(const char* sit) { sitrep = sit; }
void SetObjective(const char* obj) { objective = obj; }
void SetStart(int s) { start = s; }
void SetType(int t) { type = t; }
void SetTeam(int iff) { team = iff; }
void SetStarSystem(StarSystem* s);
void SetRegion(const char* rgn) { region = rgn; }
void SetOK(bool a) { ok = a; }
void SetActive(bool a) { active = a; }
void SetComplete(bool c) { complete = c; }
void SetTarget(MissionElement* t) { target = t; }
void SetWard(MissionElement* w) { ward = w; }
void ClearSystemList();
void IncreaseElemPriority(int index);
void DecreaseElemPriority(int index);
void IncreaseEventPriority(int index);
void DecreaseEventPriority(int index);
static const char* RoleName(int role);
static int TypeFromName(const char* n);
Text ErrorMessage() const { return errmsg; }
void AddError(Text err);
Text Serialize(const char* player_elem=0, int player_index=0);
protected:
MissionElement* ParseElement(TermStruct* val);
MissionEvent* ParseEvent(TermStruct* val);
MissionShip* ParseShip(TermStruct* val, MissionElement* element);
Instruction* ParseInstruction(TermStruct* val, MissionElement* element);
void ParseLoadout(TermStruct* val, MissionElement* element);
RLoc* ParseRLoc(TermStruct* val);
int id;
char filename[64];
char path[64];
Text region;
Text name;
Text desc;
int type;
int team;
int start;
double stardate;
bool ok;
bool active;
bool complete;
bool degrees;
Text objective;
Text sitrep;
Text errmsg;
Text subtitles;
StarSystem* star_system;
List<StarSystem> system_list;
List<MissionElement> elements;
List<MissionEvent> events;
MissionElement* target;
MissionElement* ward;
MissionElement* current;
};
// +--------------------------------------------------------------------+
class MissionElement
{
friend class Mission;
public:
static const char* TYPENAME() { return "MissionElement"; }
MissionElement();
~MissionElement();
int operator == (const MissionElement& r) const { return id == r.id; }
int Identity() const { return id; }
const Text& Name() const { return name; }
Text Abbreviation() const;
const Text& Carrier() const { return carrier; }
const Text& Commander() const { return commander; }
const Text& Squadron() const { return squadron; }
const Text& Path() const { return path; }
int ElementID() const { return elem_id; }
const ShipDesign* GetDesign() const { return design; }
const Skin* GetSkin() const { return skin; }
int Count() const { return count; }
int MaintCount() const { return maint_count; }
int DeadCount() const { return dead_count; }
int GetIFF() const { return IFF_code; }
int IntelLevel() const { return intel; }
int MissionRole() const { return mission_role; }
int Player() const { return player; }
Text RoleName() const;
Color MarkerColor() const;
bool IsStarship() const;
bool IsDropship() const;
bool IsStatic() const;
bool IsGroundUnit() const;
bool IsSquadron() const;
bool IsCarrier() const;
bool IsAlert() const { return alert; }
bool IsPlayable() const { return playable; }
bool IsRogue() const { return rogue; }
bool IsInvulnerable() const { return invulnerable; }
int RespawnCount() const { return respawns; }
int HoldTime() const { return hold_time; }
int CommandAI() const { return command_ai; }
int ZoneLock() const { return zone_lock; }
const Text& Region() const { return rgn_name; }
Point Location() const;
RLoc& GetRLoc() { return rloc; }
double Heading() const { return heading; }
Text GetShipName(int n) const;
Text GetRegistry(int n) const;
List<Instruction>& Objectives() { return objectives; }
List<Text>& Instructions() { return instructions; }
List<Instruction>& NavList() { return navlist; }
List<MissionLoad>& Loadouts() { return loadouts; }
List<MissionShip>& Ships() { return ships; }
void SetName(const char* n) { name = n; }
void SetCarrier(const char* c) { carrier = c; }
void SetCommander(const char* c) { commander = c; }
void SetSquadron(const char* s) { squadron = s; }
void SetPath(const char* p) { path = p; }
void SetElementID(int id) { elem_id = id; }
void SetDesign(const ShipDesign* d){ design = d; }
void SetSkin(const Skin* s) { skin = s; }
void SetCount(int n) { count = n; }
void SetMaintCount(int n) { maint_count = n; }
void SetDeadCount(int n) { dead_count = n; }
void SetIFF(int iff) { IFF_code = iff; }
void SetIntelLevel(int i) { intel = i; }
void SetMissionRole(int r) { mission_role = r; }
void SetPlayer(int p) { player = p; }
void SetPlayable(bool p) { playable = p; }
void SetRogue(bool r) { rogue = r; }
void SetInvulnerable(bool n) { invulnerable = n; }
void SetAlert(bool a) { alert = a; }
void SetCommandAI(int a) { command_ai = a; }
void SetRegion(const char* rgn) { rgn_name = rgn; }
void SetLocation(const Point& p);
void SetRLoc(const RLoc& r);
void SetHeading(double h) { heading = h; }
void SetRespawnCount(int r) { respawns = r; }
void SetHoldTime(int t) { hold_time = t; }
void SetZoneLock(int z) { zone_lock = z; }
void AddNavPoint(Instruction* pt, Instruction* afterPoint=0);
void DelNavPoint(Instruction* pt);
void ClearFlightPlan();
int GetNavIndex(const Instruction* n);
void AddObjective(Instruction* obj) { objectives.append(obj); }
void AddInstruction(const char* i) { instructions.append(new Text(i)); }
CombatGroup* GetCombatGroup() { return combat_group; }
void SetCombatGroup(CombatGroup* g) { combat_group = g; }
CombatUnit* GetCombatUnit() { return combat_unit; }
void SetCombatUnit(CombatUnit* u) { combat_unit = u; }
protected:
int id;
Text name;
Text carrier;
Text commander;
Text squadron;
Text path;
int elem_id;
const ShipDesign* design;
const Skin* skin;
int count;
int maint_count;
int dead_count;
int IFF_code;
int mission_role;
int intel;
int respawns;
int hold_time;
int zone_lock;
int player;
int command_ai;
bool alert;
bool playable;
bool rogue;
bool invulnerable;
Text rgn_name;
RLoc rloc;
double heading;
CombatGroup* combat_group;
CombatUnit* combat_unit;
List<Instruction> objectives;
List<Text> instructions;
List<Instruction> navlist;
List<MissionLoad> loadouts;
List<MissionShip> ships;
};
// +--------------------------------------------------------------------+
class MissionLoad
{
friend class Mission;
public:
static const char* TYPENAME() { return "MissionLoad"; }
MissionLoad(int ship=-1, const char* name=0);
~MissionLoad();
int GetShip() const;
void SetShip(int ship);
Text GetName() const;
void SetName(Text name);
int* GetStations();
int GetStation(int index);
void SetStation(int index, int selection);
protected:
int ship;
Text name;
int load[16];
};
// +--------------------------------------------------------------------+
class MissionShip
{
friend class Mission;
public:
static const char* TYPENAME() { return "MissionShip"; }
MissionShip();
~MissionShip() { }
const Text& Name() const { return name; }
const Text& RegNum() const { return regnum; }
const Text& Region() const { return region; }
const Skin* GetSkin() const { return skin; }
const Point& Location() const { return loc; }
const Point& Velocity() const { return velocity; }
int Respawns() const { return respawns; }
double Heading() const { return heading; }
double Integrity() const { return integrity; }
int Decoys() const { return decoys; }
int Probes() const { return probes; }
const int* Ammo() const { return ammo; }
const int* Fuel() const { return fuel; }
void SetName(const char* n) { name = n; }
void SetRegNum(const char* n) { regnum = n; }
void SetRegion(const char* n) { region = n; }
void SetSkin(const Skin* s) { skin = s; }
void SetLocation(const Point& p) { loc = p; }
void SetVelocity(const Point& p) { velocity = p; }
void SetRespawns(int r) { respawns = r; }
void SetHeading(double h) { heading = h; }
void SetIntegrity(double n) { integrity = n; }
void SetDecoys(int d) { decoys = d; }
void SetProbes(int p) { probes = p; }
void SetAmmo(const int* a);
void SetFuel(const int* f);
protected:
Text name;
Text regnum;
Text region;
const Skin* skin;
Point loc;
Point velocity;
int respawns;
double heading;
double integrity;
int decoys;
int probes;
int ammo[16];
int fuel[4];
};
#endif // Mission_h
|