Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/base/game.cc10
-rw-r--r--src/game/base/ship.cc8
2 files changed, 15 insertions, 3 deletions
diff --git a/src/game/base/game.cc b/src/game/base/game.cc
index d8af507..c116b8b 100644
--- a/src/game/base/game.cc
+++ b/src/game/base/game.cc
@@ -324,7 +324,9 @@ void Game::func_give(core::Player *player, const std::string &args)
player->send("^WNot enough cargo space to transfer inventory!");
return;
}
-
+ assert(player->control()->moduletype() == ship_enttype);
+ Ship * oldship = static_cast<Ship *>(player->control());
+
Ship * ship = new Ship(player, shipmodel);
core::Entity *view = player->view();
if (view && (view == player->control())) {
@@ -342,6 +344,7 @@ void Game::func_give(core::Player *player, const std::string &args)
ship->set_zone(player->control()->zone());
ship->get_location().assign(player->control()->location());
ship->set_state(player->control()->state());
+ ship->set_dock(oldship->dock());
ship->get_axis().assign(player->control()->axis());
ship->set_thrust(player->control()->thrust());
ship->reset();
@@ -1534,6 +1537,11 @@ bool Game::validate_zone(core::Zone *zone)
if ((entity->entity_moduletypeid == planet_enttype) || (entity->model())) {
entity->reset();
}
+
+ if (entity->model()) {
+ entity->add_slots();
+ entity->slots()->load(entity->model());
+ }
}
return true;
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc
index 9a6d02e..ba30d67 100644
--- a/src/game/base/ship.cc
+++ b/src/game/base/ship.cc
@@ -75,6 +75,11 @@ Ship::Ship(core::Player *owner, const ShipModel *shipmodel) : core::EntityContro
add_inventory();
inventory()->set_capacity(ship_shipmodel->maxcargo());
}
+
+ if (model()) {
+ add_slots();
+ slots()->load(model());
+ }
// menus for docked players
if (ship_shipmodel->dockable()) {
@@ -354,8 +359,7 @@ void Ship::set_dock(core::Entity *dock)
get_location().assign(dock->location());
get_axis().assign(dock->axis());
ship_dock = dock;
-
-
+
// if the dock is not owned by a player. set it as spawn
set_state(core::Entity::Docked);
const core::Player *owner = (dock->type() == core::Entity::Controlable ? static_cast<core::EntityControlable *>(dock)->owner() : 0 );