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>2015-02-08 22:25:56 +0000
committerStijn Buys <ingar@osirion.org>2015-02-08 22:25:56 +0000
commit114de658928969c7ac84f0ea0617d5afc4ebb870 (patch)
tree782ee1069755c3dff0441220ec7bd2eba3befe47
parent77d877160d5c3b8a7e9c30e81bd6ca1f4060b5f9 (diff)
Corrected a bug in the launching code where the axis of the wrong slot was used.
-rw-r--r--src/game/base/ship.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc
index 0a64c0e..15b995c 100644
--- a/src/game/base/ship.cc
+++ b/src/game/base/ship.cc
@@ -548,15 +548,20 @@ void Ship::launch()
if (nbdocks) {
// choose a random dock to launch from
- core::Slots::iterator slit = ship_dock->slots()->begin();
-
int launchbay_index = math::randomi(nbdocks);
- for (int i = 0; i < launchbay_index; ++slit) {
+ int i = 0;
+ core::Slot *launchbay = 0;
+
+ for (core::Slots::iterator slit = ship_dock->slots()->begin(); slit != ship_dock->slots()->end(); ++slit) {
if ((*slit)->type() == model::Slot::Dock) {
- ++i;
+ if (i == launchbay_index) {
+ launchbay = (*slit);
+ break;
+ }
+
+ i++;
}
}
- core::Slot *launchbay = (*slit);
get_axis().assign(ship_dock->axis() * launchbay->axis());
get_location().assign(ship_dock->location() + ship_dock->axis() * ( launchbay->location() + launchbay->axis().forward() * radius()));