Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-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()));