Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-03-08 14:35:58 +0000
committerStijn Buys <ingar@osirion.org>2008-03-08 14:35:58 +0000
commit343896eeaa97009fb06096dc5bcc097bf1bd287d (patch)
tree204384094ae725f1d9d33f73be867545a049e241 /src/game/shipmodel.cc
parentada8263817ed45e29d4bd63ab0ac635a83eec4f8 (diff)
added ships.ini
Diffstat (limited to 'src/game/shipmodel.cc')
-rw-r--r--src/game/shipmodel.cc57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/game/shipmodel.cc b/src/game/shipmodel.cc
new file mode 100644
index 0000000..f37e5b2
--- /dev/null
+++ b/src/game/shipmodel.cc
@@ -0,0 +1,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);
+}
+
+}