From a95028547981614e06ea7a6d22b853b85418cea3 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 15 Apr 2009 17:08:51 +0000 Subject: added info registry, list_info added network info transfer added info based buy menu and related game changes --- src/game/base/shipmodel.cc | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'src/game/base/shipmodel.cc') diff --git a/src/game/base/shipmodel.cc b/src/game/base/shipmodel.cc index 78dc125..fc4781a 100644 --- a/src/game/base/shipmodel.cc +++ b/src/game/base/shipmodel.cc @@ -43,11 +43,42 @@ void ShipModel::clear() void ShipModel::print() { con_print << "label: ^B" << label() << " ^Nname: ^B" << name() << std::endl; + con_print << " price: ^B" << price() << std::endl; con_print << " acceleration: ^B" << acceleration() << std::endl; con_print << " turnspeed: ^B" << turnspeed() << std::endl; con_print << " max speed: ^B" << maxspeed() << std::endl; - con_print << " max cargo: ^B" << maxcargo() << std::endl; - con_print << " price: ^B" << price() << std::endl; + con_print << " cargo: ^B" << maxcargo() << std::endl; +} + +void ShipModel::generate_info(core::Info *info) +{ + info->clear_text(); + + info->set_name(name()); + info->set_modelname(modelname()); + + // info text form ships.ini + for (core::Info::Text::iterator it = shipmodel_infotext.begin(); it != shipmodel_infotext.end(); it++) { + info->add_text((*it)); + } + + info->add_text(""); + info->add_text("^BSpecifications:^N"); + std::stringstream str; + str << "price: ^B" << price() << " ^Ncredits"; + info->add_text(str.str()); str.str(""); + + str << "cargo hold: ^B" << 0.1f * maxcargo() << " ^Nmetric tonnes"; + info->add_text(str.str()); str.str(""); + + str << "top speed: ^B" << 100.0f * maxspeed() << " ^Nmps"; + info->add_text(str.str()); str.str(""); + + str << "response: ^B" << turnspeed() << " ^Ndps"; + info->add_text(str.str()); str.str(""); + + str << "acceleration: ^B" << acceleration() << " ^Nstandard"; + info->add_text(str.str()); str.str(""); } void ShipModel::list() -- cgit v1.2.3