| 1526 | } |
| 1527 | |
| 1528 | bool VeinGenerator::place_veins(bool verbose) |
| 1529 | { |
| 1530 | VeinExtent::PVec queue; |
| 1531 | |
| 1532 | init_seeds(); |
| 1533 | |
| 1534 | // Compute the placement queue |
| 1535 | for (auto it = veins.begin(); it != veins.end(); ++it) |
| 1536 | { |
| 1537 | auto &vec = it->second; |
| 1538 | |
| 1539 | for (size_t i = 0; i < vec.size(); i++) |
| 1540 | { |
| 1541 | auto key = vec[i]->vein; |
| 1542 | |
| 1543 | if (vec[i]->num_tiles <= 0) |
| 1544 | continue; |
| 1545 | |
| 1546 | if (!isStoneInorganic(key.first)) |
| 1547 | { |
| 1548 | WARN(process, out).print( |
| 1549 | "Invalid vein material: {}\n", |
| 1550 | MaterialInfo(0, key.first).getToken() |
| 1551 | ); |
| 1552 | |
| 1553 | return false; |
| 1554 | } |
| 1555 | |
| 1556 | if (!is_valid_enum_item(key.second)) |
| 1557 | { |
| 1558 | WARN(process, out).print("Invalid vein type: {}\n", ENUM_AS_STR(key.second)); |
| 1559 | return false; |
| 1560 | } |
| 1561 | |
| 1562 | vec[i]->distribution = get_noise(key); |
| 1563 | |
| 1564 | queue.push_back(vec[i]); |
| 1565 | } |
| 1566 | } |
| 1567 | |
| 1568 | sort(queue.begin(), queue.end(), vein_cmp); |
| 1569 | |
| 1570 | // Place tiles |
| 1571 | TRACE(process,out).print("Processing... ({})", queue.size()); |
| 1572 | |
| 1573 | for (size_t j = 0; j < queue.size(); j++) |
| 1574 | { |
| 1575 | if (queue[j]->parent && !queue[j]->parent->placed) |
| 1576 | { |
| 1577 | WARN(process, out).print( |
| 1578 | "\nParent vein not placed for {} {}.\n", |
| 1579 | MaterialInfo(0,queue[j]->vein.first).getToken(), |
| 1580 | ENUM_KEY_STR(inclusion_type, queue[j]->vein.second) |
| 1581 | ); |
| 1582 | |
| 1583 | return false; |
| 1584 | } |
| 1585 |
no test coverage detected