Starshatter_Open
Open source Starshatter engine
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
CombatRoster.cpp
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: CombatRoster.cpp
7
AUTHOR: John DiCamillo
8
9
10
OVERVIEW
11
========
12
The complete roster of all known persistent entities
13
for all combatants in the game.
14
*/
15
16
#include "
MemDebug.h
"
17
#include "
CombatRoster.h
"
18
#include "
CombatGroup.h
"
19
20
#include "
Game.h
"
21
#include "
DataLoader.h
"
22
#include "
Text.h
"
23
24
// +--------------------------------------------------------------------+
25
26
static
CombatRoster
* roster = 0;
27
28
// +--------------------------------------------------------------------+
29
30
CombatRoster::CombatRoster()
31
{
32
DataLoader
* loader =
DataLoader::GetLoader
();
33
loader->
SetDataPath
(
"Campaigns/"
);
34
35
List<Text>
files;
36
loader->
ListFiles
(
"*.def"
, files);
37
38
for
(
int
i = 0; i < files.
size
(); i++) {
39
Text
filename = *files[i];
40
41
if
(!filename.
contains
(
"/"
) && !filename.
contains
(
"\\"
)) {
42
loader->
SetDataPath
(
"Campaigns/"
);
43
CombatGroup
* g =
CombatGroup::LoadOrderOfBattle
(filename, -1, 0);
44
forces.
append
(g);
45
}
46
}
47
48
files.
destroy
();
49
}
50
51
// +--------------------------------------------------------------------+
52
53
CombatRoster::~CombatRoster()
54
{
55
forces.
destroy
();
56
}
57
58
// +--------------------------------------------------------------------+
59
60
CombatGroup
*
61
CombatRoster::GetForce
(
const
char
* name)
62
{
63
ListIter<CombatGroup>
iter = forces;
64
while
(++iter) {
65
CombatGroup
* f = iter.
value
();
66
67
if
(f->
Name
() == name)
68
return
f;
69
}
70
71
return
0;
72
}
73
74
// +--------------------------------------------------------------------+
75
76
void
77
CombatRoster::Initialize
()
78
{
79
roster =
new
(__FILE__,__LINE__)
CombatRoster
();
80
}
81
82
void
83
CombatRoster::Close
()
84
{
85
delete
roster;
86
roster = 0;
87
}
88
89
CombatRoster
*
90
CombatRoster::GetInstance
()
91
{
92
return
roster;
93
}
Stars45
CombatRoster.cpp
Generated on Tue Jun 5 2012 20:46:50 for Starshatter_Open by
1.8.1