void ShipDesign::serialize(Archive& ar, const unsigned int version) { ar & BOOST_SERIALIZATION_NVP(m_id) & BOOST_SERIALIZATION_NVP(m_name) & BOOST_SERIALIZATION_NVP(m_description) & BOOST_SERIALIZATION_NVP(m_designed_on_turn) & BOOST_SERIALIZATION_NVP(m_hull) & BOOST_SERIALIZATION_NVP(m_parts) & BOOST_SERIALIZATION_NVP(m_is_monster) & BOOST_SERIALIZATION_NVP(m_icon) & BOOST_SERIALIZATION_NVP(m_3D_model) & BOOST_SERIALIZATION_NVP(m_name_desc_in_stringtable); if (Archive::is_loading::value) BuildStatCaches(); }
ShipDesign::ShipDesign(const std::string& name, const std::string& description, int designed_on_turn, const std::string& hull, const std::vector<std::string>& parts, const std::string& icon, const std::string& model, bool name_desc_in_stringtable, bool monster) : m_id(INVALID_OBJECT_ID), m_name(name), m_description(description), m_designed_on_turn(designed_on_turn), m_hull(hull), m_parts(parts), m_is_monster(monster), m_icon(icon), m_3D_model(model), m_name_desc_in_stringtable(name_desc_in_stringtable), m_is_armed(false), m_detection(0.0), m_colony_capacity(0.0), m_troop_capacity(0.0), m_stealth(0.0), m_fuel(0.0), m_shields(0.0), m_structure(0.0), m_battle_speed(0.0), m_starlane_speed(0.0), m_min_SR_range(FLT_MAX), m_max_SR_range(0.0), m_min_LR_range(FLT_MAX), m_max_LR_range(0.0), m_min_PD_range(FLT_MAX), m_max_PD_range(0.0), m_min_weapon_range(FLT_MAX), m_max_weapon_range(0.0), m_min_non_PD_weapon_range(FLT_MAX), m_max_non_PD_weapon_range(0.0) { // expand parts list to have empty values if fewer parts are given than hull has slots if (const HullType* hull_type = GetHullType(m_hull)) { if (m_parts.size() < hull_type->NumSlots()) m_parts.resize(hull_type->NumSlots(), ""); } if (!ValidDesign(m_hull, m_parts)) { Logger().errorStream() << "constructing an invalid ShipDesign!"; Logger().errorStream() << Dump(); } BuildStatCaches(); }
ShipDesign::ShipDesign(const std::string& name, const std::string& description, int designed_on_turn, int designed_by_empire, const std::string& hull, const std::vector<std::string>& parts, const std::string& icon, const std::string& model, bool name_desc_in_stringtable, bool monster) : m_id(INVALID_OBJECT_ID), m_name(name), m_description(description), m_designed_on_turn(designed_on_turn), m_designed_by_empire(designed_by_empire), m_hull(hull), m_parts(parts), m_is_monster(monster), m_icon(icon), m_3D_model(model), m_name_desc_in_stringtable(name_desc_in_stringtable), m_is_armed(false), m_can_bombard(false), m_detection(0.0), m_colony_capacity(0.0), m_troop_capacity(0.0), m_stealth(0.0), m_fuel(0.0), m_shields(0.0), m_structure(0.0), m_battle_speed(0.0), m_starlane_speed(0.0), m_research_generation(0.0), m_industry_generation(0.0), m_trade_generation(0.0), m_is_production_location(false) { // expand parts list to have empty values if fewer parts are given than hull has slots if (const HullType* hull_type = GetHullType(m_hull)) { if (m_parts.size() < hull_type->NumSlots()) m_parts.resize(hull_type->NumSlots(), ""); } if (!ValidDesign(m_hull, m_parts)) { ErrorLogger() << "constructing an invalid ShipDesign!"; ErrorLogger() << Dump(); } BuildStatCaches(); }