blob: f37e5b24dd6714793b9400bfd5b0ec3b1c16d2a8 (
plain)
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
|
/*
game/shipmodel.cc
This file is part of the Osirion project and is distributed under
the terms and conditions of the GNU General Public License version 2
*/
#include "sys/sys.h"
#include "game/shipmodel.h"
namespace game {
// the ship model registry
std::list<ShipModel *> ShipModel::registry;
ShipModel::ShipModel()
{
//default specifications
shipmodel_acceleration = 1.5f;
shipmodel_maxspeed = 4.0f;
shipmodel_turnspeed = 0.5f;
add(this);
}
ShipModel::~ShipModel()
{}
// clear the ship model registry
void ShipModel::clear()
{
for (std::list< ShipModel *>::iterator smit=registry.begin(); smit != registry.end(); smit++) {
delete (*smit);
}
registry.clear();
}
void ShipModel::list()
{
for (std::list< ShipModel *>::iterator smit=registry.begin(); smit != registry.end(); smit++) {
con_print <<
" " << (*smit)->modelname() <<
" " << (*smit)->name() <<
" accel " << (*smit)->acceleration() <<
" max " << (*smit)->maxspeed() <<
" turn " << (*smit)->turnspeed() << "\n";
}
con_print << registry.size() << " registered ship models\n";
}
// add a new ship model
void ShipModel::add(ShipModel *shipmodel)
{
registry.push_back(shipmodel);
}
}
|