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')
-rw-r--r--src/game/base/game.cc64
1 files changed, 44 insertions, 20 deletions
diff --git a/src/game/base/game.cc b/src/game/base/game.cc
index 108c13f..8c39c5c 100644
--- a/src/game/base/game.cc
+++ b/src/game/base/game.cc
@@ -82,7 +82,6 @@ void Game::func_join(core::Player *player, std::string const &args)
player->set_view(dock);
}
-
std::string message("^B");
message.append(player->name());
message.append("^B joins the game.");
@@ -168,7 +167,7 @@ void Game::func_target_dock(core::Player *player, core::Entity *entity)
range += planet_safe_distance;
}
- core::Player *owner = (entity->type() == core::Entity::Controlable ? static_cast<core::EntityControlable *>(entity)->owner() : 0 );
+ core::Player *owner = (entity->type() == core::Entity::Controlable ? static_cast<core::EntityControlable *>(entity)->owner() : 0 );
if (math::distance(entity->location(), ship->location()) > range) {
if (owner) {
player->send("^B" + owner->name() + "^B's " + entity->name() + " is out of range");
@@ -477,40 +476,65 @@ void Game::func_specs(core::Player *player, const std::string &args)
}
} else {
+ std::stringstream msgstr;
float value;
- if (!(is >> value))
- return;
+ // specs label
aux::to_label(str);
- std::stringstream msgstr;
if (str.compare("thrust") == 0) {
- ship->set_thrust_force(value);
- msgstr << "Ship thrust force set to " << value;
+ if (is >> value) {
+ ship->set_thrust_force(value);
+ msgstr << "Ship thrust force set to " << value;
+ } else {
+ msgstr << "Ship thrust at " << ship->thrust_force();
+ }
} else if (str.compare("impulse") == 0) {
- ship->set_impulse_force(value);
- msgstr << "Ship impulse force set to " << value;
+ if (is >> value) {
+ ship->set_impulse_force(value);
+ msgstr << "Ship impulse force set to " << value;
+ } else {
+ msgstr << "Ship impulse force at " << ship->impulse_force();
+ }
} else if (str.compare("strafe") == 0) {
- ship->set_strafe_force(value) ;
- msgstr << "Ship strafe force set to " << value;
+ if (is >> value) {
+ ship->set_strafe_force(value) ;
+ msgstr << "Ship strafe force set to " << value;
+ } else {
+ msgstr << "Ship impulse force at " << ship->strafe_force();
+ }
} else if (str.compare("turn") == 0) {
- ship->set_turn_force(value);
- msgstr << "Ship turn force set to " << value;
+ if (is >> value) {
+ ship->set_turn_force(value);
+ msgstr << "Ship turn force set to " << value;
+ } else {
+ msgstr << "Ship turn force at " << ship->turn_force();
+ }
} else if (str.compare("roll") == 0) {
- ship->set_roll_force(value);
- msgstr << "Ship roll force set to " << value;
+ if (is >> value) {
+ ship->set_roll_force(value);
+ msgstr << "Ship roll force set to " << value;
+ } else {
+ msgstr << "Ship roll force at " << ship->roll_force();
+ }
} else if (str.compare("damping") == 0) {
- float a;
- if (!(is >> a)) {
- a = value;
+ if (is >> value) {
+ float a;
+ if (!(is >> a)) {
+ a = value;
+ }
+ ship->body()->setDamping(value, a);
+ msgstr << "Ship damping set to " << value << " " << a;
+ } else {
+ msgstr << "Ship damping at " << ship->body()->getLinearDamping() << " " << ship->body()->getAngularDamping();
}
- ship->body()->setDamping(value, a);
-
+ } else if (str.compare("mass") == 0) {
+ msgstr << "Ship mass at " << ship->mass();
} else {
msgstr << "^WUnknown ship engine specification '" << str << "'";
}