/* base/shipmodel.h This file is part of the Osirion project and is distributed under the terms and conditions of the GNU General Public License version 2 */ #ifndef __INCLUDED_BASE_SHIPMODEL_H__ #define __INCLUDED_BASE_SHIPMODEL_H__ #include #include #include "core/info.h" namespace game { /// ship model specifications class ShipModel { public: ShipModel(); ~ShipModel(); void print(); /// acceleration inline const float acceleration() const { return shipmodel_acceleration; } /// maximum speed inline const float maxspeed() const { return shipmodel_maxspeed; } /// turn speed in rotations per second inline const float turnspeed() const { return shipmodel_turnspeed; } /// label of the ship model inline const std::string &label() const { return shipmodel_label; } /// name of the ship model inline const std::string & name() const { return shipmodel_name; } /// name of the model of the ship inline const std::string & modelname() const { return shipmodel_modelname; } /// price of the ship inline const long price() const { return shipmodel_price; } /// size of the cargo hold inline const float maxcargo() const { return shipmodel_maxcargo; } /// set acceleration inline void set_acceleration(const float acceleration) { shipmodel_acceleration = acceleration; } /// set maximum speed inline void set_maxspeed(const float maxspeed) { shipmodel_maxspeed = maxspeed; } /// set turn speed inline void set_turnspeed(const float turnspeed) { shipmodel_turnspeed = turnspeed; } /// set price inline void set_price(const long price) { shipmodel_price = price; } /// set size of the cargo hold inline void set_maxcargo(const float maxcargo) { shipmodel_maxcargo = maxcargo; } /// generate an info object for this shipmodel void generate_info(core::Info *info); /// indicates of this model can be equiped with a jump drive bool shipmodel_jumpdrive; std::string shipmodel_label; std::string shipmodel_name; std::string shipmodel_modelname; /// info text core::Info::Text shipmodel_infotext; /* ---- static registry ------------------------------------ */ typedef std::map::iterator iterator; /// find an exact match static ShipModel *find(ShipModel *shipmodel); /// find an exact match static ShipModel *find(const std::string label); /// search the registry static ShipModel *search(const std::string label); /// the ship model registry static std::map registry; /// clear the ship model registry static void clear(); /// list the ship model registry static void list(); /// add a new ship model static void add(ShipModel *shipmodel); private: float shipmodel_acceleration; float shipmodel_maxspeed; float shipmodel_turnspeed; float shipmodel_maxcargo; long shipmodel_price; }; } #endif // __INCLUDED_BASE_SHIPMODEL_H__