* Make a small 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. */
| 540 | * @return Last used local terrain direction. |
| 541 | */ |
| 542 | Direction2 Micropolis::doSRiver(const Position &riverPos, |
| 543 | Direction2 riverDir, Direction2 terrainDir) |
| 544 | { |
| 545 | int rate1, rate2; |
| 546 | |
| 547 | if (terrainCurveLevel < 0) { |
| 548 | rate1 = 100; |
| 549 | rate2 = 200; |
| 550 | } else { |
| 551 | rate1 = terrainCurveLevel + 10; |
| 552 | rate2 = terrainCurveLevel + 100; |
| 553 | } |
| 554 | |
| 555 | Position pos(riverPos); |
| 556 | |
| 557 | while (testBounds(pos.posX + 3, pos.posY + 3)) { |
| 558 | //printf("doSRiver %d %d td %d rd %d\n", pos.posX, pos.posY, terrainDir, riverDir); |
| 559 | plopSRiver(pos); |
| 560 | if (getRandom(rate1) < 10) { |
| 561 | terrainDir = riverDir; |
| 562 | } else { |
| 563 | if (getRandom(rate2) > 90) { |
| 564 | terrainDir = rotate45(terrainDir); |
| 565 | } |
| 566 | if (getRandom(rate2) > 90) { |
| 567 | terrainDir = rotate45(terrainDir, 7); |
| 568 | } |
| 569 | } |
| 570 | pos.move(terrainDir); |
| 571 | } |
| 572 | |
| 573 | return terrainDir; |
| 574 | } |
| 575 | |
| 576 | |
| 577 | /** |
nothing calls this directly
no test coverage detected