* Make a big river. * @param pos Start position of making a river. * @param riverDir Global direction of the river. * @param terrainDir Local direction of the terrain. * @return Last used local terrain direction. */
| 500 | * @return Last used local terrain direction. |
| 501 | */ |
| 502 | Direction2 Micropolis::doBRiver(const Position &riverPos, |
| 503 | Direction2 riverDir, Direction2 terrainDir) |
| 504 | { |
| 505 | int rate1, rate2; |
| 506 | |
| 507 | if (terrainCurveLevel < 0) { |
| 508 | rate1 = 100; |
| 509 | rate2 = 200; |
| 510 | } else { |
| 511 | rate1 = terrainCurveLevel + 10; |
| 512 | rate2 = terrainCurveLevel + 100; |
| 513 | } |
| 514 | |
| 515 | Position pos(riverPos); |
| 516 | |
| 517 | while (testBounds(pos.posX + 4, pos.posY + 4)) { |
| 518 | plopBRiver(pos); |
| 519 | if (getRandom(rate1) < 10) { |
| 520 | terrainDir = riverDir; |
| 521 | } else { |
| 522 | if (getRandom(rate2) > 90) { |
| 523 | terrainDir = rotate45(terrainDir); |
| 524 | } |
| 525 | if (getRandom(rate2) > 90) { |
| 526 | terrainDir = rotate45(terrainDir, 7); |
| 527 | } |
| 528 | } |
| 529 | pos.move(terrainDir); |
| 530 | } |
| 531 | |
| 532 | return terrainDir; |
| 533 | } |
| 534 | |
| 535 | /** |
| 536 | * Make a small river. |
nothing calls this directly
no test coverage detected