Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
blob: a6a2bf9fccfa8583bcc8ea9ac5be87df3fda4b99 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
   base/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 <iomanip>

#include "auxiliary/functions.h"
#include "base/shipmodel.h"
#include "base/game.h"
#include "sys/sys.h"

namespace game
{

core::InfoType *ShipModel::shipmodel_infotype = 0;

ShipModel::ShipModel() : core::Info(shipmodel_infotype)
{
	//default specifications
	shipmodel_acceleration = 1.0f;	// thruster acceleration in game untits/second^2
	shipmodel_maxspeed = 3.0f;	// maximum thruster speed in game units/second
	shipmodel_turnspeed = 45.0f;	// 45 degrees per second
	shipmodel_maxcargo = 0;

	shipmodel_jumpdrive = false;	// no jumpdrive capability
}

ShipModel::~ShipModel()
{
}

void ShipModel::generate_info()
{
	//clear_text();

	add_text("");
	add_text("^BSpecifications:^N");
	std::stringstream str;
	str << "price:        ^B" << price() << " ^Ncredits";
	add_text(str.str());
	str.str("");

	str << "cargo hold:   ^B" << 0.1f * maxcargo() << " ^Nmetric tonnes";
	add_text(str.str());
	str.str("");

	str << "top speed:    ^B" << 100.0f * maxspeed() << " ^Nmps";
	add_text(str.str());
	str.str("");

	str << "response:     ^B" << turnspeed() << " ^Ndps";
	add_text(str.str());
	str.str("");

	str << "acceleration: ^B" << acceleration() << " ^Nstandard";
	add_text(str.str());
	str.str("");

	if (jumpdrive()) {
		str << "hyperspace jump drive capable";
		add_text(str.str());
		str.str("");
	}
}

ShipModel *ShipModel::find(const std::string & label)
{
	return (ShipModel *) core::Info::find(shipmodel_infotype, label);
}

ShipModel *ShipModel::search(const std::string searchstr)
{
	return (ShipModel *) core::Info::search(shipmodel_infotype, searchstr);
}


void ShipModel::list()
{
	core::Info::list(shipmodel_infotype);
}

}