Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/base/shipmodel.cc')
-rw-r--r--src/game/base/shipmodel.cc43
1 files changed, 25 insertions, 18 deletions
diff --git a/src/game/base/shipmodel.cc b/src/game/base/shipmodel.cc
index 9d905d6..6233120 100644
--- a/src/game/base/shipmodel.cc
+++ b/src/game/base/shipmodel.cc
@@ -1,7 +1,7 @@
/*
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
+ 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>
@@ -10,7 +10,8 @@
#include "base/shipmodel.h"
#include "sys/sys.h"
-namespace game {
+namespace game
+{
// the ship model registry
std::map<std::string, ShipModel *> ShipModel::registry;
@@ -35,7 +36,7 @@ ShipModel::~ShipModel()
void ShipModel::clear()
{
for (iterator smit = registry.begin(); smit != registry.end(); smit++) {
- delete (*smit).second;
+ delete(*smit).second;
}
registry.clear();
}
@@ -43,7 +44,7 @@ void ShipModel::clear()
void ShipModel::print()
{
con_print << "label: ^B" << label() << " ^Nname: ^B" << name() << std::endl;
- con_print << " price: ^B" << price() << std::endl;
+ con_print << " price: ^B" << price() << std::endl;
con_print << " acceleration: ^B" << acceleration() << std::endl;
con_print << " turnspeed: ^B" << turnspeed() << std::endl;
con_print << " max speed: ^B" << maxspeed() << std::endl;
@@ -64,33 +65,39 @@ void ShipModel::generate_info(core::Info *info)
info->add_text("");
info->add_text("^BSpecifications:^N");
- std::stringstream str;
+ std::stringstream str;
str << "price: ^B" << price() << " ^Ncredits";
- info->add_text(str.str()); str.str("");
+ info->add_text(str.str());
+ str.str("");
str << "cargo hold: ^B" << 0.1f * maxcargo() << " ^Nmetric tonnes";
- info->add_text(str.str()); str.str("");
+ info->add_text(str.str());
+ str.str("");
str << "top speed: ^B" << 100.0f * maxspeed() << " ^Nmps";
- info->add_text(str.str()); str.str("");
+ info->add_text(str.str());
+ str.str("");
str << "response: ^B" << turnspeed() << " ^Ndps";
- info->add_text(str.str()); str.str("");
+ info->add_text(str.str());
+ str.str("");
str << "acceleration: ^B" << acceleration() << " ^Nstandard";
- info->add_text(str.str()); str.str("");
+ info->add_text(str.str());
+ str.str("");
- if(shipmodel_jumpdrive) {
+ if (shipmodel_jumpdrive) {
str << "hyperspace jump drive capable";
- info->add_text(str.str()); str.str("");
+ info->add_text(str.str());
+ str.str("");
}
}
void ShipModel::list()
{
for (iterator smit = registry.begin(); smit != registry.end(); smit++) {
- con_print << std::setw(24) << (*smit).second->label()
- << " ^B" << (*smit).second->name() << "\n";
+ con_print << std::setw(24) << (*smit).second->label()
+ << " ^B" << (*smit).second->name() << "\n";
}
con_print << registry.size() << " registered ship models\n";
}
@@ -132,12 +139,12 @@ ShipModel *ShipModel::search(const std::string searchname)
for (iterator smit = registry.begin(); smit != registry.end(); smit++) {
ShipModel *shipmodel = (*smit).second;
-
+
label.assign(shipmodel->label());
if (label.size() && (label.find(strsearchkey) != std::string::npos)) {
return shipmodel;
}
-
+
name.assign(aux::lowercase(shipmodel->name()));
if (name.size() && (name.find(strsearchkey) != std::string::npos)) {
return shipmodel;
@@ -155,7 +162,7 @@ void ShipModel::add(ShipModel *shipmodel)
con_warn << "Duplicate ship model " << shipmodel->label() << "!\n";
delete m;
}
-
+
registry[shipmodel->label()] = shipmodel;
}