From 43927cc52bdd7e44d62b0e6309612558f565b70f Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 9 Oct 2010 22:05:46 +0000 Subject: fix crash introduced with inventory transfer, buywindow credits indicator, removed impulse drive initialization delay. --- src/game/base/ship.cc | 6 ++++-- src/game/base/shipmodel.cc | 17 +++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) (limited to 'src/game') diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc index 696033c..a588122 100644 --- a/src/game/base/ship.cc +++ b/src/game/base/ship.cc @@ -416,11 +416,13 @@ void Ship::frame(float seconds) // clamp input values target_thrust = 0.0f; + target_afterburner = 0.0f; math::clamp(target_pitch, -1.0f, 1.0f); math::clamp(target_roll, -1.0f, 1.0f); math::clamp(target_direction, -1.0f, 1.0f); - math::clamp(target_afterburner, -1.0f, 1.0f); - + + actual_maxspeed = Game::g_impulsespeed->value(); + actual_acceleration = Game::g_impulseacceleration->value(); actual_turnspeed *= 0.5; } 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"; -- cgit v1.2.3