Starshatter_Open
Open source Starshatter engine
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Component.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: Component.h
7
AUTHOR: John DiCamillo
8
9
10
OVERVIEW
11
========
12
Generic ship system sub-component class
13
*/
14
15
#ifndef Component_h
16
#define Component_h
17
18
#include "
Types.h
"
19
#include "
Geometry.h
"
20
#include "
Text.h
"
21
22
// +--------------------------------------------------------------------+
23
24
class
ComponentDesign
25
{
26
public
:
27
static
const
char
*
TYPENAME
() {
return
"ComponentDesign"
; }
28
29
ComponentDesign
();
30
~ComponentDesign
();
31
int
operator ==
(
const
ComponentDesign
& rhs)
const
{
return
(
name
== rhs.
name
); }
32
33
// identification:
34
Text
name
;
35
Text
abrv
;
36
37
float
repair_time
;
38
float
replace_time
;
39
int
spares
;
40
DWORD
affects
;
41
};
42
43
// +--------------------------------------------------------------------+
44
45
class
System
;
46
47
// +--------------------------------------------------------------------+
48
49
class
Component
50
{
51
public
:
52
static
const
char
*
TYPENAME
() {
return
"Component"
; }
53
54
enum
STATUS
{
DESTROYED
,
CRITICAL
,
DEGRADED
,
NOMINAL
,
REPLACE
,
REPAIR
};
55
enum
DAMAGE
{
DAMAGE_EFFICIENCY
= 0x01,
56
DAMAGE_SAFETY
= 0x02,
57
DAMAGE_STABILITY
= 0x04 };
58
59
Component
(
ComponentDesign
* d,
System
* s);
60
Component
(
const
Component
& c);
61
virtual
~Component
();
62
63
const
char
*
Name
()
const
{
return
design
->
name
; }
64
const
char
*
Abbreviation
()
const
{
return
design
->
abrv
; }
65
float
RepairTime
()
const
{
return
design
->
repair_time
; }
66
float
ReplaceTime
()
const
{
return
design
->
replace_time
; }
67
68
bool
DamageEfficiency
()
const
{
return
(
design
->
affects
&
DAMAGE_EFFICIENCY
)?
true
:
false
; }
69
bool
DamageSafety
()
const
{
return
(
design
->
affects
&
DAMAGE_SAFETY
)?
true
:
false
; }
70
bool
DamageStability
()
const
{
return
(
design
->
affects
&
DAMAGE_STABILITY
)?
true
:
false
; }
71
72
STATUS
Status
()
const
{
return
status
; }
73
float
Availability
()
const
;
74
float
TimeRemaining
()
const
;
75
int
SpareCount
()
const
;
76
bool
IsJerried
()
const
;
77
int
NumJerried
()
const
;
78
79
void
SetSystem
(
System
* s) {
system
= s; }
80
System
*
GetSystem
()
const
{
return
system
; }
81
82
virtual
void
ApplyDamage
(
double
damage);
83
virtual
void
ExecMaintFrame
(
double
seconds);
84
virtual
void
Repair
();
85
virtual
void
Replace
();
86
87
protected
:
88
ComponentDesign
*
design
;
89
90
// Component health status:
91
STATUS
status
;
92
float
availability
;
93
float
time_remaining
;
94
int
spares
;
95
int
jerried
;
96
System
*
system
;
97
};
98
99
#endif Component_h
100
Stars45
Component.h
Generated on Tue Jun 5 2012 20:46:50 for Starshatter_Open by
1.8.1