* Place deposits of minerals (gold and misc gems) in the stone * surrounding the rooms on the map. * Also place kelp in water. * mineralize(-1, -1, -1, -1, FALSE); => "default" behavior */
| 1446 | * mineralize(-1, -1, -1, -1, FALSE); => "default" behavior |
| 1447 | */ |
| 1448 | void |
| 1449 | mineralize(int kelp_pool, int kelp_moat, int goldprob, int gemprob, |
| 1450 | boolean skip_lvl_checks) |
| 1451 | { |
| 1452 | s_level *sp; |
| 1453 | struct obj *otmp; |
| 1454 | coordxy x, y; |
| 1455 | int cnt; |
| 1456 | |
| 1457 | if (kelp_pool < 0) |
| 1458 | kelp_pool = 10; |
| 1459 | if (kelp_moat < 0) |
| 1460 | kelp_moat = 30; |
| 1461 | |
| 1462 | /* Place kelp, except on the plane of water */ |
| 1463 | if (!skip_lvl_checks && In_endgame(&u.uz)) |
| 1464 | return; |
| 1465 | for (x = 2; x < (COLNO - 2); x++) |
| 1466 | for (y = 1; y < (ROWNO - 1); y++) |
| 1467 | if (water_has_kelp(x, y, kelp_pool, kelp_moat)) |
| 1468 | (void) mksobj_at(KELP_FROND, x, y, TRUE, FALSE); |
| 1469 | |
| 1470 | /* determine if it is even allowed; |
| 1471 | almost all special levels are excluded */ |
| 1472 | if (!skip_lvl_checks |
| 1473 | && (In_hell(&u.uz) || In_V_tower(&u.uz) || Is_rogue_level(&u.uz) |
| 1474 | || svl.level.flags.arboreal |
| 1475 | || ((sp = Is_special(&u.uz)) != 0 && !Is_oracle_level(&u.uz) |
| 1476 | && (!In_mines(&u.uz) || sp->flags.town)))) |
| 1477 | return; |
| 1478 | |
| 1479 | /* basic level-related probabilities */ |
| 1480 | if (goldprob < 0) |
| 1481 | goldprob = 20 + depth(&u.uz) / 3; |
| 1482 | if (gemprob < 0) |
| 1483 | gemprob = goldprob / 4; |
| 1484 | |
| 1485 | /* mines have ***MORE*** goodies - otherwise why mine? */ |
| 1486 | if (!skip_lvl_checks) { |
| 1487 | if (In_mines(&u.uz)) { |
| 1488 | goldprob *= 2; |
| 1489 | gemprob *= 3; |
| 1490 | } else if (In_quest(&u.uz)) { |
| 1491 | goldprob /= 4; |
| 1492 | gemprob /= 6; |
| 1493 | } |
| 1494 | } |
| 1495 | |
| 1496 | /* |
| 1497 | * Seed rock areas with gold and/or gems. |
| 1498 | * We use fairly low level object handling to avoid unnecessary |
| 1499 | * overhead from placing things in the floor chain prior to burial. |
| 1500 | */ |
| 1501 | for (x = 2; x < (COLNO - 2); x++) |
| 1502 | for (y = 1; y < (ROWNO - 1); y++) |
| 1503 | if (levl[x][y + 1].typ != STONE) { /* <x,y> spot not eligible */ |
| 1504 | y += 2; /* next two spots aren't eligible either */ |
| 1505 | } else if (levl[x][y].typ != STONE) { /* this spot not eligible */ |
no test coverage detected