Starshatter_Open
Open source Starshatter engine
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Element.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: Element.h
7
AUTHOR: John DiCamillo
8
9
10
OVERVIEW
11
========
12
Package Element (e.g. Flight) class
13
*/
14
15
#ifndef Element_h
16
#define Element_h
17
18
#include "
Types.h
"
19
#include "
Geometry.h
"
20
#include "
SimObject.h
"
21
#include "
List.h
"
22
#include "
Text.h
"
23
24
// +--------------------------------------------------------------------+
25
26
class
Ship
;
27
class
Instruction
;
28
class
RadioMessage
;
29
30
class
CombatGroup
;
31
class
CombatUnit
;
32
33
// +--------------------------------------------------------------------+
34
35
class
Element
:
public
SimObserver
36
{
37
public
:
38
// CONSTRUCTORS:
39
Element
(
const
char
* call_sign,
int
iff
,
int
type
=0
/*PATROL*/
);
40
virtual
~Element
();
41
42
int
operator ==
(
const
Element
& e)
const
{
return
id
== e.
id
; }
43
44
// GENERAL ACCESSORS:
45
int
Identity
()
const
{
return
id
; }
46
int
Type
()
const
{
return
type
; }
47
const
Text
&
Name
()
const
{
return
name
; }
48
void
SetName
(
const
char
* s) {
name
= s; }
49
virtual
int
GetIFF
()
const
{
return
iff
; }
50
int
Player
()
const
{
return
player
; }
51
void
SetPlayer
(
int
p) {
player
= p; }
52
DWORD
GetLaunchTime
()
const
{
return
launch_time
; }
53
void
SetLaunchTime
(DWORD t);
54
int
IntelLevel
()
const
{
return
intel
; }
55
void
SetIntelLevel
(
int
i) {
intel
= i; }
56
57
// ELEMENT COMPONENTS:
58
int
NumShips
()
const
{
return
ships
.
size
(); }
59
int
AddShip
(
Ship
*,
int
index=-1);
60
void
DelShip
(
Ship
*);
61
Ship
*
GetShip
(
int
index);
62
int
GetShipClass
();
63
int
FindIndex
(
const
Ship
* s);
64
bool
Contains
(
const
Ship
* s);
65
bool
IsActive
()
const
;
66
bool
IsFinished
()
const
;
67
bool
IsNetObserver
()
const
;
68
bool
IsSquadron
()
const
;
69
bool
IsStatic
()
const
;
70
bool
IsHostileTo
(
const
Ship
* s)
const
;
71
bool
IsHostileTo
(
int
iff_code)
const
;
72
bool
IsObjectiveTargetOf
(
const
Ship
* s)
const
;
73
bool
IsRogue
()
const
{
return
rogue
; }
74
bool
IsPlayable
()
const
{
return
playable
; }
75
int
*
Loadout
() {
return
load
; }
76
77
void
SetRogue
(
bool
r) {
rogue
= r; }
78
void
SetPlayable
(
bool
p) {
playable
= p; }
79
void
SetLoadout
(
int
* l);
80
virtual
void
SetIFF
(
int
iff);
81
82
virtual
void
ExecFrame
(
double
seconds);
83
virtual
bool
Update
(
SimObject
* obj);
84
virtual
const
char
*
GetObserverName
()
const
;
85
86
// OBJECTIVES:
87
void
ClearObjectives
();
88
void
AddObjective
(
Instruction
* obj);
89
Instruction
*
GetObjective
(
int
index);
90
Instruction
*
GetTargetObjective
();
91
int
NumObjectives
()
const
{
return
objectives
.
size
(); }
92
93
void
ClearInstructions
();
94
void
AddInstruction
(
const
char
* instr);
95
Text
GetInstruction
(
int
index);
96
int
NumInstructions
()
const
{
return
instructions
.
size
(); }
97
98
// ORDERS AND NAVIGATION:
99
double
GetHoldTime
();
100
void
SetHoldTime
(
double
t);
101
bool
GetZoneLock
();
102
void
SetZoneLock
(
bool
z);
103
void
AddNavPoint
(
Instruction
* pt,
Instruction
* afterPoint=0,
bool
send=
true
);
104
void
DelNavPoint
(
Instruction
* pt,
bool
send=
true
);
105
void
ClearFlightPlan
(
bool
send=
true
);
106
Instruction
*
GetNextNavPoint
();
107
int
GetNavIndex
(
const
Instruction
* n);
108
List<Instruction>
&
GetFlightPlan
();
109
int
FlightPlanLength
();
110
virtual
void
HandleRadioMessage
(
RadioMessage
* msg);
111
112
// CHAIN OF COMMAND:
113
Element
*
GetCommander
()
const
{
return
commander
; }
114
void
SetCommander
(
Element
* e) {
commander
= e; }
115
Element
*
GetAssignment
()
const
{
return
assignment
; }
116
void
SetAssignment
(
Element
* e) {
assignment
= e; }
117
void
ResumeAssignment
();
118
bool
CanCommand
(
Element
* e);
119
Ship
*
GetCarrier
()
const
{
return
carrier
; }
120
void
SetCarrier
(
Ship
* c) {
carrier
= c; }
121
int
GetCommandAILevel
()
const
{
return
command_ai
; }
122
void
SetCommandAILevel
(
int
n) {
command_ai
= n; }
123
const
Text
&
GetSquadron
()
const
{
return
squadron
; }
124
void
SetSquadron
(
const
char
* s) {
squadron
= s; }
125
126
// DYNAMIC CAMPAIGN:
127
CombatGroup
*
GetCombatGroup
() {
return
combat_group
; }
128
void
SetCombatGroup
(
CombatGroup
* g) {
combat_group
= g; }
129
CombatUnit
*
GetCombatUnit
() {
return
combat_unit
; }
130
void
SetCombatUnit
(
CombatUnit
* u) {
combat_unit
= u; }
131
132
// SQUADRON STUFF:
133
int
GetCount
()
const
{
return
count
; }
134
void
SetCount
(
int
n) {
count
= n; }
135
136
protected
:
137
int
id
;
138
int
iff
;
139
int
type
;
140
int
player
;
141
int
command_ai
;
142
int
respawns
;
143
int
intel
;
144
Text
name
;
145
146
// squadron elements only:
147
int
count
;
148
149
List<Ship>
ships
;
150
List<Text>
ship_names
;
151
List<Text>
instructions
;
152
List<Instruction>
objectives
;
153
List<Instruction>
flight_plan
;
154
155
Element
*
commander
;
156
Element
*
assignment
;
157
Ship
*
carrier
;
158
Text
squadron
;
159
160
CombatGroup
*
combat_group
;
161
CombatUnit
*
combat_unit
;
162
DWORD
launch_time
;
163
double
hold_time
;
164
165
bool
rogue
;
166
bool
playable
;
167
bool
zone_lock
;
168
int
load
[16];
169
};
170
171
#endif Element_h
172
Stars45
Element.h
Generated on Thu May 31 2012 16:31:06 for Starshatter_Open by
1.8.1