* When a UFO crashes, there is a 75% chance for each powersource to explode. */
| 1778 | * When a UFO crashes, there is a 75% chance for each powersource to explode. |
| 1779 | */ |
| 1780 | void BattlescapeGenerator::explodePowerSources() |
| 1781 | { |
| 1782 | for (int i = 0; i < _save->getMapSizeXYZ(); ++i) |
| 1783 | { |
| 1784 | if (_save->getTiles()[i]->getMapData(MapData::O_OBJECT) |
| 1785 | && _save->getTiles()[i]->getMapData(MapData::O_OBJECT)->getSpecialType() == UFO_POWER_SOURCE && RNG::percent(75)) |
| 1786 | { |
| 1787 | Position pos; |
| 1788 | pos.x = _save->getTiles()[i]->getPosition().x*16; |
| 1789 | pos.y = _save->getTiles()[i]->getPosition().y*16; |
| 1790 | pos.z = (_save->getTiles()[i]->getPosition().z*24) +12; |
| 1791 | _save->getTileEngine()->explode(pos, 180+RNG::generate(0,70), DT_HE, 10); |
| 1792 | } |
| 1793 | } |
| 1794 | Tile *t = _save->getTileEngine()->checkForTerrainExplosions(); |
| 1795 | while (t) |
| 1796 | { |
| 1797 | Position p = Position(t->getPosition().x * 16, t->getPosition().y * 16, t->getPosition().z * 24); |
| 1798 | p += Position(8,8,0); |
| 1799 | _save->getTileEngine()->explode(p, t->getExplosive(), DT_HE, t->getExplosive() / 10); |
| 1800 | t = _save->getTileEngine()->checkForTerrainExplosions(); |
| 1801 | } |
| 1802 | } |
| 1803 | |
| 1804 | /** |
| 1805 | * Spawns 1-16 civilians on a terror mission. |
nothing calls this directly
no test coverage detected