| 711 | } |
| 712 | |
| 713 | void WorldGenerator::replaceBiomeBlocks(ServerTile* tile) { |
| 714 | if (auto blockBiome = m_worldServer->worldTemplate()->biome(tile->blockBiomeIndex)) { |
| 715 | if (tile->foreground == BiomeMaterialId) { |
| 716 | tile->foreground = blockBiome->mainBlock; |
| 717 | tile->foregroundHueShift = m_worldServer->worldTemplate()->biomeMaterialHueShift(tile->blockBiomeIndex, tile->foreground); |
| 718 | } else if ((tile->foreground >= Biome1MaterialId) && (tile->foreground <= Biome5MaterialId)) { |
| 719 | auto& subblocks = blockBiome->subBlocks; |
| 720 | if (subblocks.size()) |
| 721 | tile->foreground = subblocks[(tile->foreground - Biome1MaterialId) % subblocks.size()]; |
| 722 | else |
| 723 | tile->foreground = blockBiome->mainBlock; |
| 724 | tile->foregroundHueShift = m_worldServer->worldTemplate()->biomeMaterialHueShift(tile->blockBiomeIndex, tile->foreground); |
| 725 | } |
| 726 | |
| 727 | if (tile->background == BiomeMaterialId) { |
| 728 | tile->background = blockBiome->mainBlock; |
| 729 | tile->backgroundHueShift = |
| 730 | m_worldServer->worldTemplate()->biomeMaterialHueShift(tile->blockBiomeIndex, tile->background); |
| 731 | } else if ((tile->background >= Biome1MaterialId) && (tile->background <= Biome5MaterialId)) { |
| 732 | auto& subblocks = blockBiome->subBlocks; |
| 733 | if (subblocks.size()) |
| 734 | tile->background = subblocks[(tile->background - Biome1MaterialId) % subblocks.size()]; |
| 735 | else |
| 736 | tile->background = blockBiome->mainBlock; |
| 737 | tile->backgroundHueShift = m_worldServer->worldTemplate()->biomeMaterialHueShift(tile->blockBiomeIndex, tile->background); |
| 738 | } |
| 739 | } else { |
| 740 | if (isBiomeMaterial(tile->foreground)) { |
| 741 | tile->foreground = EmptyMaterialId; |
| 742 | tile->foregroundHueShift = 0; |
| 743 | } |
| 744 | if (isBiomeMod(tile->foregroundMod)) { |
| 745 | tile->foregroundMod = NoModId; |
| 746 | tile->foregroundModHueShift = 0; |
| 747 | } |
| 748 | if (isBiomeMaterial(tile->background)) { |
| 749 | tile->background = EmptyMaterialId; |
| 750 | tile->backgroundHueShift = 0; |
| 751 | } |
| 752 | if (isBiomeMod(tile->backgroundMod)) { |
| 753 | tile->backgroundMod = NoModId; |
| 754 | tile->backgroundModHueShift = 0; |
| 755 | } |
| 756 | } |
| 757 | } |
| 758 | |
| 759 | void WorldGenerator::prepareTiles(WorldStorage* worldStorage, ServerTileSectorArray::Sector const& sector) { |
| 760 | auto materialDatabase = Root::singleton().materialDatabase(); |
no test coverage detected