Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/base/game.cc')
-rw-r--r--src/game/base/game.cc44
1 files changed, 24 insertions, 20 deletions
diff --git a/src/game/base/game.cc b/src/game/base/game.cc
index 48e1b05..c591ba4 100644
--- a/src/game/base/game.cc
+++ b/src/game/base/game.cc
@@ -47,7 +47,12 @@ core::Module *factory()
// list the ship model registry
void Game::func_list_ship(std::string const &args)
{
- ShipModel::list();
+ ShipModel *shipmodel = ShipModel::search(args);
+
+ if (shipmodel)
+ shipmodel->print();
+ else
+ ShipModel::list();
}
// a player joins the game
@@ -233,19 +238,7 @@ void Game::func_goto(core::Player *player, const std::string &args)
if (!player->control())
return;
- core::Entity *dock = 0;
- std::string label(args);
- aux::to_label(label);
-
- core::Zone *zone = player->control()->zone();
- for (core::Zone::Content::iterator it = zone->content().begin(); it != zone->content().end(); it ++) {
- std::string str((*it)->label());
- aux::to_label(str);
- if (str.find(label) != std::string::npos) {
- dock = (*it);
- }
- }
-
+ core::Entity *dock = player->control()->zone()->search_entity(args);
if (dock) {
player->control()->entity_location.assign(dock->location() + (dock->axis().forward() * (player->control()->radius()+dock->radius())*2.0f));
player->control()->entity_axis.assign(dock->axis());
@@ -752,6 +745,8 @@ bool Game::load_ships()
ShipModel *shipmodel = 0;
std::string label;
bool b;
+ long l;
+ float f;
while (shipsini.getline()) {
if (shipsini.got_key()) {
@@ -768,17 +763,26 @@ bool Game::load_ships()
} else if (shipsini.got_key_bool("default", b)) {
if (b) default_shipmodel = shipmodel;
continue;
+ } else if (shipsini.got_key_long("price", l)) {
+ shipmodel->set_price(l);
+ continue;
+ } else if (shipsini.got_key_float("cargo", f)) {
+ shipmodel->set_maxcargo(f);
+ continue;
} else if (shipsini.got_key_bool("jumpdrive", shipmodel->shipmodel_jumpdrive)) {
continue;
- } else if (shipsini.got_key_float("acceleration", shipmodel->shipmodel_acceleration)) {
+ } else if (shipsini.got_key_float("acceleration",f)) {
+ shipmodel->set_acceleration(f);
continue;
- } else if (shipsini.got_key_float("maxspeed", shipmodel->shipmodel_maxspeed)) {
+ } else if (shipsini.got_key_float("maxspeed", f)) {
+ shipmodel->set_maxspeed(f);
continue;
- } else if (shipsini.got_key_float("turnspeed", shipmodel->shipmodel_turnspeed)) {
- math::clamp(shipmodel->shipmodel_turnspeed, 0.0f, 90.0f);
+ } else if (shipsini.got_key_float("turnspeed", f)) {
+ math::clamp(f, 0.0f, 90.0f);
+ shipmodel->set_turnspeed(f);
continue;
} else {
- con_warn << shipsini.name() << " unknown key '" << shipsini.key() << "' at line " << shipsini.line() << std::endl;
+ shipsini.unkown_key();
}
}
} else if (shipsini.got_section("ship")) {
@@ -788,7 +792,7 @@ bool Game::load_ships()
default_shipmodel = shipmodel;
} else if (shipsini.got_section()) {
- con_warn << shipsini.name() << " unknown section '" << shipsini.section() << "' at line " << shipsini.line() << std::endl;
+ shipsini.unknown_section();
}
}
shipsini.close();