diff options
author | Stijn Buys <ingar@osirion.org> | 2010-10-09 22:05:46 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2010-10-09 22:05:46 +0000 |
commit | 43927cc52bdd7e44d62b0e6309612558f565b70f (patch) | |
tree | a3e9ccf69d6ab03c8444b78ac53d49529a52e675 /src/game/base/shipmodel.cc | |
parent | 0ecdd8bc98ba583bbee801b838d785c6f881d7df (diff) |
fix crash introduced with inventory transfer, buywindow credits indicator,
removed impulse drive initialization delay.
Diffstat (limited to 'src/game/base/shipmodel.cc')
-rw-r--r-- | src/game/base/shipmodel.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/game/base/shipmodel.cc b/src/game/base/shipmodel.cc index 9133d28..077fd3e 100644 --- a/src/game/base/shipmodel.cc +++ b/src/game/base/shipmodel.cc @@ -235,13 +235,6 @@ void ShipModel::buy(core::EntityControlable *buyer, core::Entity *seller) player->send("^WCan not afford transaction!"); return; } - - player->add_credits(-price()); - - // player has only ship for now - if (player->control()) { - player->remove_asset(player->control()); - } Ship * ship = new Ship(player, this); ship->set_zone(seller->zone()); @@ -257,9 +250,17 @@ void ShipModel::buy(core::EntityControlable *buyer, core::Entity *seller) } ship->inventory()->set_dirty(); + // remove old ship + if (player->control()) { + player->remove_asset(player->control()); + } + + // set control to new ship player->set_control(ship); player->set_view(seller); - + + player->add_credits(-price()); + // send the ship purchased message std::stringstream msgstr; msgstr << "^BPurchased " << aux::article(name()) << " for " << price() << " credits"; |