diff options
Diffstat (limited to 'src/game/shipmodel.cc')
-rw-r--r-- | src/game/shipmodel.cc | 57 |
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); +} + +} |