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