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.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc
index 338bc04..9c2605d 100644
--- a/src/game/base/ship.cc
+++ b/src/game/base/ship.cc
@@ -441,8 +441,7 @@ void Ship::explode()
}
if (percentage > 0) {
- core::Inventory::Items::iterator it = inventory()->items().begin();
-
+ core::Inventory::Items::iterator it = inventory()->items().begin();
while (it != inventory()->items().end()) {
if ((*it)->info()->type() == Cargo::infotype()) {
long loss = (*it)->amount() * ((long) percentage) / 100l;
@@ -454,6 +453,19 @@ void Ship::explode()
++it;
}
}
+
+ if (!owner()) {
+ core::Inventory::Items::iterator it = inventory()->items().begin();
+ while (it != inventory()->items().end()) {
+ if ((*it)->info()->type() == Weapon::infotype()) {
+ if (math::randomf(100.0f) < 10.0f) {
+ eject((*it++), (*it)->amount(), false);
+ continue;
+ }
+ }
+ ++it;
+ }
+ }
};