/* 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 #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); } }