Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2009-08-15 14:06:30 +0000
committerStijn Buys <ingar@osirion.org>2009-08-15 14:06:30 +0000
commit818566a1806f7b51ed8a8ecf1fb9abe0757f610e (patch)
tree7a55aa9bd93716c587f56418443c472b39198a28 /src/game/base/game.cc
parente2934d43ab090b1e559ffc4f866aa39028d8495d (diff)
planet safe distance for launch and goto
Diffstat (limited to 'src/game/base/game.cc')
-rw-r--r--src/game/base/game.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/game/base/game.cc b/src/game/base/game.cc
index 35dfc5f..bcb3567 100644
--- a/src/game/base/game.cc
+++ b/src/game/base/game.cc
@@ -237,7 +237,12 @@ void Game::func_launch(core::Player *player, std::string const &args)
Ship *ship = static_cast<Ship *>(player->control());
ship->shutdown_physics();
core::Entity *dock = player->view();
- ship->get_location().assign(dock->location() + (dock->axis().forward() * (ship->radius()+ dock->radius())));
+
+ if (dock->type() == core::Entity::Globe)
+ ship->get_location().assign(dock->location() + (dock->axis().forward() * (Planet::safe_distance + ship->radius() + dock->radius())));
+ else
+ ship->get_location().assign(dock->location() + (dock->axis().forward() * (ship->radius() + dock->radius())));
+
ship->get_axis().assign(dock->axis());
ship->set_state(core::Entity::Normal);
ship->init_physics(ship->radius());
@@ -265,7 +270,7 @@ void Game::func_respawn(core::Player *player, std::string const &args)
ship->shutdown_physics();
if (dock) {
- ship->get_location().assign(dock->location() + (dock->axis().forward() * ((ship->radius()+ dock->radius()))));
+ ship->get_location().assign(dock->location());
ship->get_axis().assign(dock->axis());
ship->set_state(core::Entity::Docked);
player->set_view(dock);
@@ -303,7 +308,11 @@ void Game::func_goto(core::Player *player, const std::string &args)
if (dock) {
ship->shutdown_physics();
- ship->get_location().assign(dock->location() + (dock->axis().forward() * (ship->radius()+dock->radius())));
+ if (dock->type() == core::Entity::Globe)
+ ship->get_location().assign(dock->location() + (dock->axis().forward() * (Planet::safe_distance + ship->radius() + dock->radius())));
+ else
+ ship->get_location().assign(dock->location() + (dock->axis().forward() * (ship->radius() + dock->radius())));
+
ship->get_axis().assign(dock->axis());
ship->get_axis().change_direction(180.0f);
ship->set_state(core::Entity::Normal);
@@ -953,10 +962,14 @@ bool Game::load_player()
void Game::frame(float seconds)
{
- Physics::frame(seconds);
+#ifdef HAVE_BULLET
if (!running())
return;
+
+ Physics::frame(seconds);
+#endif
+
}
void Game::player_connect(core::Player *player)