* Splash a bunch of trees down near (\a xloc, \a yloc). * * Amount of trees is controlled by Micropolis::terrainTreeLevel. * @param xloc Horizontal position of starting point for splashing trees. * @param yloc Vertical position of starting point for splashing trees. * @note Trees are not smoothed. * @bug Function generates trees even if Micropolis::terrainTreeLevel is 0. */
| 298 | * @bug Function generates trees even if Micropolis::terrainTreeLevel is 0. |
| 299 | */ |
| 300 | void Micropolis::treeSplash(short xloc, short yloc) |
| 301 | { |
| 302 | short numTrees; |
| 303 | |
| 304 | if (terrainTreeLevel < 0) { |
| 305 | numTrees = getRandom(150) + 50; |
| 306 | } else { |
| 307 | numTrees = getRandom(100 + (terrainTreeLevel * 2)) + 50; |
| 308 | } |
| 309 | |
| 310 | Position treePos(xloc, yloc); |
| 311 | |
| 312 | while (numTrees > 0) { |
| 313 | Direction2 dir = (Direction2)(DIR2_NORTH + getRandom(7)); |
| 314 | treePos.move(dir); |
| 315 | |
| 316 | if (!treePos.testBounds()) { |
| 317 | return; |
| 318 | } |
| 319 | |
| 320 | if ((map[treePos.posX][treePos.posY] & LOMASK) == DIRT) { |
| 321 | map[treePos.posX][treePos.posY] = WOODS | BLBNBIT; |
| 322 | } |
| 323 | |
| 324 | numTrees--; |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | |
| 329 | /** Splash trees around the world. */ |
nothing calls this directly
no test coverage detected