Change random tiles to fire or dirt as result of the earthquake */
| 245 | |
| 246 | /** Change random tiles to fire or dirt as result of the earthquake */ |
| 247 | void Micropolis::makeEarthquake() |
| 248 | { |
| 249 | short x, y, z; |
| 250 | |
| 251 | int strength = getRandom(700) + 300; // strength/duration of the earthquake |
| 252 | |
| 253 | doEarthquake(strength); |
| 254 | |
| 255 | sendMessage(MESSAGE_EARTHQUAKE, cityCenterX, cityCenterY, true); |
| 256 | |
| 257 | for (z = 0; z < strength; z++) { |
| 258 | x = getRandom(WORLD_W - 1); |
| 259 | y = getRandom(WORLD_H - 1); |
| 260 | |
| 261 | if (vulnerable(map[x][y])) { |
| 262 | |
| 263 | if ((z & 0x3) != 0) { // 3 of 4 times reduce to rubble |
| 264 | map[x][y] = randomRubble(); |
| 265 | } else { |
| 266 | // 1 of 4 times start fire |
| 267 | map[x][y] = randomFire(); |
| 268 | } |
| 269 | } |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | |
| 274 | /** Start a fire at a random place, random disaster or scenario */ |
no test coverage detected