Try to construct a new ship sprite */
| 1851 | |
| 1852 | /** Try to construct a new ship sprite */ |
| 1853 | void Micropolis::generateShip() |
| 1854 | { |
| 1855 | short x, y; |
| 1856 | |
| 1857 | if (!(getRandom16() & 3)) { |
| 1858 | for (x = 4; x < WORLD_W - 2; x++) { |
| 1859 | if (map[x][0] == CHANNEL) { |
| 1860 | makeShipHere(x, 0); |
| 1861 | return; |
| 1862 | } |
| 1863 | } |
| 1864 | } |
| 1865 | |
| 1866 | if (!(getRandom16() & 3)) { |
| 1867 | for (y = 1; y < WORLD_H - 2; y++) { |
| 1868 | if (map[0][y] == CHANNEL) { |
| 1869 | makeShipHere(0, y); |
| 1870 | return; |
| 1871 | } |
| 1872 | } |
| 1873 | } |
| 1874 | |
| 1875 | if (!(getRandom16() & 3)) { |
| 1876 | for (x = 4; x < WORLD_W - 2; x++) { |
| 1877 | if (map[x][WORLD_H - 1] == CHANNEL) { |
| 1878 | makeShipHere(x, WORLD_H - 1); |
| 1879 | return; |
| 1880 | } |
| 1881 | } |
| 1882 | } |
| 1883 | |
| 1884 | if (!(getRandom16() & 3)) { |
| 1885 | for (y = 1; y < WORLD_H - 2; y++) { |
| 1886 | if (map[WORLD_W - 1][y] == CHANNEL) { |
| 1887 | makeShipHere(WORLD_W - 1, y); |
| 1888 | return; |
| 1889 | } |
| 1890 | } |
| 1891 | } |
| 1892 | } |
| 1893 | |
| 1894 | |
| 1895 | /** |
nothing calls this directly
no outgoing calls
no test coverage detected