diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-06-08 14:16:39 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-06-08 14:16:39 +0200 |
commit | fbabf9ee8c7f0940e6f7d01e0362849bf4f6396b (patch) | |
tree | c382dcd205dfc8b2dd61005332709029181715f7 /source/cChunkGenerator.cpp | |
parent | Configurable classic composition generator (diff) | |
download | cuberite-fbabf9ee8c7f0940e6f7d01e0362849bf4f6396b.tar cuberite-fbabf9ee8c7f0940e6f7d01e0362849bf4f6396b.tar.gz cuberite-fbabf9ee8c7f0940e6f7d01e0362849bf4f6396b.tar.bz2 cuberite-fbabf9ee8c7f0940e6f7d01e0362849bf4f6396b.tar.lz cuberite-fbabf9ee8c7f0940e6f7d01e0362849bf4f6396b.tar.xz cuberite-fbabf9ee8c7f0940e6f7d01e0362849bf4f6396b.tar.zst cuberite-fbabf9ee8c7f0940e6f7d01e0362849bf4f6396b.zip |
Diffstat (limited to '')
-rw-r--r-- | source/cChunkGenerator.cpp | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/source/cChunkGenerator.cpp b/source/cChunkGenerator.cpp index d595f333f..7a1e4ad14 100644 --- a/source/cChunkGenerator.cpp +++ b/source/cChunkGenerator.cpp @@ -224,19 +224,23 @@ void cChunkGenerator::InitHeightGen(cIniFile & a_IniFile) +
+
BLOCKTYPE ResolveBlock(AString BlockType, BLOCKTYPE DefaultBlock)
{
- int Block = BlockStringToType(BlockType);
- if(Block < 0)
- {
- LOGWARN("[Generator] Could not parse block value \"%s\". Using default.", BlockType.c_str());
- return DefaultBlock;
- }
- return (BLOCKTYPE) Block;
+ int Block = BlockStringToType(BlockType);
+ if(Block < 0)
+ {
+ LOGWARN("[Generator] Could not parse block value \"%s\". Using default.", BlockType.c_str());
+ return DefaultBlock;
+ }
+ return (BLOCKTYPE) Block;
}
+
+
void cChunkGenerator::InitCompositionGen(cIniFile & a_IniFile)
{
AString CompoGenName = a_IniFile.GetValue("Generator", "CompositionGen", "");
@@ -271,14 +275,16 @@ void cChunkGenerator::InitCompositionGen(cIniFile & a_IniFile) int SeaLevel = a_IniFile.GetValueI("Generator", "ClassicSeaLevel", 60);
int BeachHeight = a_IniFile.GetValueI("Generator", "ClassicBeachHeight", 2);
int BeachDepth = a_IniFile.GetValueI("Generator", "ClassicBeachDepth", 4);
- BLOCKTYPE BlockTop = ResolveBlock(a_IniFile.GetValue("Generator", "ClassicBlockTop", "grass"), E_BLOCK_GRASS);
- BLOCKTYPE BlockMiddle = ResolveBlock(a_IniFile.GetValue("Generator", "ClassicBlockMiddle", "dirt"), E_BLOCK_DIRT);
- BLOCKTYPE BlockBottom = ResolveBlock(a_IniFile.GetValue("Generator", "ClassicBlockBottom", "stone"), E_BLOCK_STONE);
- BLOCKTYPE BlockBeach = ResolveBlock(a_IniFile.GetValue("Generator", "ClassicBlockBeach", "sand"), E_BLOCK_SAND);
- BLOCKTYPE BlockBeachBottom = ResolveBlock(a_IniFile.GetValue("Generator", "ClassicBlockBeachBottom", "sandstone"), E_BLOCK_SANDSTONE);
- BLOCKTYPE BlockSea = ResolveBlock(a_IniFile.GetValue("Generator", "ClassicBlockSea", "9"), E_BLOCK_STATIONARY_WATER);
- m_CompositionGen = new cCompoGenClassic(SeaLevel, BeachHeight, BeachDepth, BlockTop, BlockMiddle, BlockBottom, BlockBeach,
- BlockBeachBottom, BlockSea);
+ BLOCKTYPE BlockTop = ResolveBlock(a_IniFile.GetValue("Generator", "ClassicBlockTop", "grass"), E_BLOCK_GRASS);
+ BLOCKTYPE BlockMiddle = ResolveBlock(a_IniFile.GetValue("Generator", "ClassicBlockMiddle", "dirt"), E_BLOCK_DIRT);
+ BLOCKTYPE BlockBottom = ResolveBlock(a_IniFile.GetValue("Generator", "ClassicBlockBottom", "stone"), E_BLOCK_STONE);
+ BLOCKTYPE BlockBeach = ResolveBlock(a_IniFile.GetValue("Generator", "ClassicBlockBeach", "sand"), E_BLOCK_SAND);
+ BLOCKTYPE BlockBeachBottom = ResolveBlock(a_IniFile.GetValue("Generator", "ClassicBlockBeachBottom", "sandstone"), E_BLOCK_SANDSTONE);
+ BLOCKTYPE BlockSea = ResolveBlock(a_IniFile.GetValue("Generator", "ClassicBlockSea", "9"), E_BLOCK_STATIONARY_WATER);
+ m_CompositionGen = new cCompoGenClassic(
+ SeaLevel, BeachHeight, BeachDepth, BlockTop, BlockMiddle, BlockBottom, BlockBeach,
+ BlockBeachBottom, BlockSea
+ );
}
else
{
|