From 4293e8854a30443e4d5818fc55df404976dbfd9b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 14 Nov 2009 14:14:21 +0000 Subject: update the info system, fixes network info exchange --- src/game/base/game.cc | 42 +++++++++++------------------------------- src/game/base/game.h | 1 - src/game/base/shipdealer.cc | 2 +- src/game/base/shipmodel.cc | 14 ++------------ src/game/base/shipmodel.h | 4 ---- 5 files changed, 14 insertions(+), 49 deletions(-) (limited to 'src/game') diff --git a/src/game/base/game.cc b/src/game/base/game.cc index c20e42a..6c15c75 100644 --- a/src/game/base/game.cc +++ b/src/game/base/game.cc @@ -59,17 +59,6 @@ core::Module *factory() return new Game(); } -// list the ship model registry -void Game::func_list_ship(std::string const &args) -{ - ShipModel *shipmodel = ShipModel::search(args); - - if (shipmodel) - shipmodel->print(); - else - ShipModel::list(); -} - // a player joins the game void Game::func_join(core::Player *player, std::string const &args) { @@ -195,27 +184,27 @@ void Game::func_dock(core::Player *player, core::Entity *entity) void Game::func_buy(core::Player *player, const std::string &args) { std::istringstream is(args); - std::string itemclass; - std::string itemtype; + std::string typestr; + std::string labelstr; - if (!(is >> itemclass)) { - player->send("usage: buy [string] [string] buy an item of a specified class and type"); + if (!(is >> typestr)) { + player->send("Usage: buy [string] [string] buy an item, specify type and label"); return; } else { - aux::to_label(itemclass); + aux::to_label(typestr); } - if (!(is >> itemtype)) { - itemtype.clear(); + if (!(is >> labelstr)) { + labelstr.clear(); } else { - aux::to_label(itemtype); + aux::to_label(labelstr); } - if (itemclass.compare("ship") == 0) { - ShipDealer::func_buy(player, itemtype); + if (typestr.compare("ship") == 0) { + ShipDealer::func_buy(player, labelstr); } else { - player->send("unkown item class '" + itemclass + "'"); + player->send("unkown item type '" + typestr + "'"); } return; @@ -333,7 +322,6 @@ void Game::func_goto(core::Player *player, const std::string &args) Game::Game() : core::Module("Project::OSiRiON", true) { Default::clear(); - ShipModel::clear(); Physics::init(); @@ -360,9 +348,6 @@ Game::Game() : core::Module("Project::OSiRiON", true) // add engine functions core::Func *func = 0; - func = core::Func::add("list_ship", Game::func_list_ship); - func->set_info("[string] list ship statistics"); - func = core::Func::add("join", Game::func_join); func->set_info("join the game"); @@ -412,14 +397,9 @@ Game::~Game() g_impulsespeed = 0; // game functions are automaticly removed - // remove engine core functions - core::Func::remove("list_ship"); - // we explicity clear game data to prevent bullet from beeing confused core::game()->clear(); - ShipModel::clear(); - Physics::shutdown(); } diff --git a/src/game/base/game.h b/src/game/base/game.h index a7e476e..fc0274b 100644 --- a/src/game/base/game.h +++ b/src/game/base/game.h @@ -97,7 +97,6 @@ private: /* ---- engine functions ----------------------------------- */ - static void func_list_ship(std::string const &args); static void func_join(core::Player *player, std::string const &args); static void func_spectate(core::Player *player, std::string const &args); static void func_hail(core::Player *player, std::string const &args); diff --git a/src/game/base/shipdealer.cc b/src/game/base/shipdealer.cc index 69b4543..b38855b 100644 --- a/src/game/base/shipdealer.cc +++ b/src/game/base/shipdealer.cc @@ -84,7 +84,7 @@ void ShipDealer::func_buy(core::Player *player, const std::string &args) if (!shipmodel) { ShipModel::list(); - player->send("Usage: buy ship model"); + player->send("Usage: buy ship label"); return; } diff --git a/src/game/base/shipmodel.cc b/src/game/base/shipmodel.cc index 9bd7573..4f219eb 100644 --- a/src/game/base/shipmodel.cc +++ b/src/game/base/shipmodel.cc @@ -35,10 +35,10 @@ ShipModel::~ShipModel() void ShipModel::generate_info() { - clear_text(); + //clear_text(); add_text(""); - add_text("^B" + name() + " specifications:^N"); + add_text("^BSpecifications:^N"); std::stringstream str; str << "price: ^B" << price() << " ^Ncredits"; add_text(str.str()); @@ -67,16 +67,6 @@ void ShipModel::generate_info() } } -void ShipModel::list() -{ - core::Info::list_class(shipmodel_infotype); -} - -ShipModel *ShipModel::find(const unsigned int id) -{ - return (ShipModel *) core::Info::find(shipmodel_infotype, id); -} - ShipModel *ShipModel::find(const std::string & label) { return (ShipModel *) core::Info::find(shipmodel_infotype, label); diff --git a/src/game/base/shipmodel.h b/src/game/base/shipmodel.h index 19b2a77..dc56033 100644 --- a/src/game/base/shipmodel.h +++ b/src/game/base/shipmodel.h @@ -82,10 +82,6 @@ public: /* --- static registry functions ---------------------------------- */ - static void list(); - - static ShipModel *find(const unsigned int id); - static ShipModel *find(const std::string & label); static ShipModel *search(const std::string searchstr); -- cgit v1.2.3