////////////////////////////////////////////////////////////////////////////////////////////////////////////////// cTerrainCompositionGen:
| 33 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 34 | // cTerrainCompositionGen: |
| 35 | cTerrainCompositionGen * cTerrainCompositionGen::CreateCompositionGen(cIniFile & a_IniFile, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen, int a_Seed) |
| 36 | { |
| 37 | AString CompoGenName = a_IniFile.GetValueSet("Generator", "CompositionGen", ""); |
| 38 | if (CompoGenName.empty()) |
| 39 | { |
| 40 | LOGWARN("[Generator] CompositionGen value not set in world.ini, using \"Biomal\"."); |
| 41 | CompoGenName = "Biomal"; |
| 42 | a_IniFile.SetValue("Generator", "CompositionGen", CompoGenName); |
| 43 | } |
| 44 | |
| 45 | cTerrainCompositionGen * res = NULL; |
| 46 | if (NoCaseCompare(CompoGenName, "sameblock") == 0) |
| 47 | { |
| 48 | res = new cCompoGenSameBlock; |
| 49 | } |
| 50 | else if (NoCaseCompare(CompoGenName, "debugbiomes") == 0) |
| 51 | { |
| 52 | res = new cCompoGenDebugBiomes; |
| 53 | } |
| 54 | else if (NoCaseCompare(CompoGenName, "classic") == 0) |
| 55 | { |
| 56 | res = new cCompoGenClassic; |
| 57 | } |
| 58 | else if (NoCaseCompare(CompoGenName, "DistortedHeightmap") == 0) |
| 59 | { |
| 60 | res = new cDistortedHeightmap(a_Seed, a_BiomeGen); |
| 61 | } |
| 62 | else if (NoCaseCompare(CompoGenName, "end") == 0) |
| 63 | { |
| 64 | res = new cEndGen(a_Seed); |
| 65 | } |
| 66 | else if (NoCaseCompare(CompoGenName, "nether") == 0) |
| 67 | { |
| 68 | res = new cCompoGenNether(a_Seed); |
| 69 | } |
| 70 | else if (NoCaseCompare(CompoGenName, "Noise3D") == 0) |
| 71 | { |
| 72 | res = new cNoise3DComposable(a_Seed); |
| 73 | } |
| 74 | else if (NoCaseCompare(CompoGenName, "biomal") == 0) |
| 75 | { |
| 76 | res = new cCompoGenBiomal(a_Seed); |
| 77 | |
| 78 | /* |
| 79 | // Performance-testing: |
| 80 | LOGINFO("Measuring performance of cCompoGenBiomal..."); |
| 81 | clock_t BeginTick = clock(); |
| 82 | for (int x = 0; x < 500; x++) |
| 83 | { |
| 84 | cChunkDesc Desc(200 + x * 8, 200 + x * 8); |
| 85 | a_BiomeGen->GenBiomes(Desc.GetChunkX(), Desc.GetChunkZ(), Desc.GetBiomeMap()); |
| 86 | a_HeightGen->GenHeightMap(Desc.GetChunkX(), Desc.GetChunkZ(), Desc.GetHeightMap()); |
| 87 | res->ComposeTerrain(Desc); |
| 88 | } |
| 89 | clock_t Duration = clock() - BeginTick; |
| 90 | LOGINFO("CompositionGen for 500 chunks took %d ticks (%.02f sec)", Duration, (double)Duration / CLOCKS_PER_SEC); |
| 91 | //*/ |
| 92 | } |
nothing calls this directly
no test coverage detected