From 343896eeaa97009fb06096dc5bcc097bf1bd287d Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 8 Mar 2008 14:35:58 +0000 Subject: added ships.ini --- src/game/shipmodel.cc | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/game/shipmodel.cc (limited to 'src/game/shipmodel.cc') 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::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); +} + +} -- cgit v1.2.3