Theme_Treasure initializes the treasure theme. Parameters: - t: theme number (index into themes array).
| 665 | // Parameters: |
| 666 | // - t: theme number (index into themes array). |
| 667 | void Theme_Treasure(int t) |
| 668 | { |
| 669 | int xp, yp; |
| 670 | int i; |
| 671 | char treasrnd[4] = { 4, 9, 7, 10 }; |
| 672 | char monstrnd[4] = { 6, 8, 3, 7 }; |
| 673 | |
| 674 | GetRndSeed(); |
| 675 | for (yp = 0; yp < MAXDUNY; yp++) { |
| 676 | for (xp = 0; xp < MAXDUNX; xp++) { |
| 677 | if (dTransVal[xp][yp] == themes[t].ttval && !nSolidTable[dPiece[xp][yp]]) { |
| 678 | int rv = random_(0, treasrnd[leveltype - 1]); |
| 679 | // BUGFIX: the `2*` in `2*random_(0, treasrnd...) == 0` has no effect, should probably be `random_(0, 2*treasrnd...) == 0` |
| 680 | if ((2 * random_(0, treasrnd[leveltype - 1])) == 0) { |
| 681 | CreateTypeItem(xp, yp, FALSE, ITYPE_GOLD, IMISC_NONE, FALSE, TRUE); |
| 682 | ItemNoFlippy(); |
| 683 | } |
| 684 | if (rv == 0) { |
| 685 | CreateRndItem(xp, yp, FALSE, FALSE, TRUE); |
| 686 | ItemNoFlippy(); |
| 687 | } |
| 688 | if (rv == 0 || rv >= treasrnd[leveltype - 1] - 2) { |
| 689 | i = ItemNoFlippy(); |
| 690 | if (rv >= treasrnd[leveltype - 1] - 2 && leveltype != DTYPE_CATHEDRAL) { |
| 691 | item[i]._ivalue >>= 1; |
| 692 | } |
| 693 | } |
| 694 | } |
| 695 | } |
| 696 | } |
| 697 | PlaceThemeMonsts(t, monstrnd[leveltype - 1]); |
| 698 | } |
| 699 | |
| 700 | // Theme_Library initializes the library theme. |
| 701 | // |
no test coverage detected