* Spawns 1-16 civilians on a terror mission. * @param max Maximum number of civilians to spawn. */
| 1806 | * @param max Maximum number of civilians to spawn. |
| 1807 | */ |
| 1808 | void BattlescapeGenerator::deployCivilians(int max) |
| 1809 | { |
| 1810 | if (max) |
| 1811 | { |
| 1812 | // inevitably someone will point out that ufopaedia says 0-16 civilians. |
| 1813 | // to that person: i looked at the code and it says otherwise. |
| 1814 | // 0 civilians would only be a possibility if there were already 80 units, |
| 1815 | // or no spawn nodes for civilians. |
| 1816 | int number = RNG::generate(max/2, max); |
| 1817 | |
| 1818 | if (number > 0) |
| 1819 | { |
| 1820 | for (int i = 0; i < number; ++i) |
| 1821 | { |
| 1822 | size_t pick = RNG::generate(0, _terrain->getCivilianTypes().size() -1); |
| 1823 | addCivilian(_game->getRuleset()->getUnit(_terrain->getCivilianTypes().at(pick))); |
| 1824 | } |
| 1825 | } |
| 1826 | } |
| 1827 | } |
| 1828 | |
| 1829 | /** |
| 1830 | * Sets the alien base involved in the battle. |
nothing calls this directly
no test coverage detected