Random Chitchat 2012-2016
Why don't you try running your code? You'd see that it's got problems:
- if (biSwampland) -> biSwampland is a nonzero constant, so this "condition" is always met. (Same as writing "if (18)" )
- still having that old part of code with an x-, z- for loop covering the entire chunk's body of water with lily pads.
This should suffice (not tested, may not even compile):
Code:
void cFinishGenLilypad::GenFinish(
    int a_ChunkX, int a_ChunkZ,
    cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change
    cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change
    cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data
    const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to
    cEntityList & a_Entities, // Entities may be added or deleted
    cBlockEntityList & a_BlockEntities // Block entities may be added or deleted
)
{
    // Turn surface water into Lilypads in Swampland

    int NumLilyPads = GetNumLilyPads(a_BiomeMap);
    for (int i = 0; i < NumLilyPads; i++)
    {
        int x = m_Noise.IntNoise3DInt(a_ChunkX + a_ChunkZ, a_ChunkZ, i) % cChunkDef::Width;
        int z = m_Noise.IntNoise3DInt(a_ChunkX - a_ChunkZ, i, a_ChunkZ) % cChunkDef::Width;

        // Place a lily pad at {x, z} if possible (swampland, empty block, water below):
        if (cChunkDef::GetBiome(a_BiomeMap, x, z) != biSwampland)
        {
            // not swampland
            continue;
        }
        int Height = cChunkDef::GetHeight(a_HeightMap, x, z);
        if (cChunkDef::GetBlock(a_BlockTypes, x, Height + 1, z) != E_BLOCK_AIR)
        {
            // not empty block
            continue;
        }
        switch (cChunkDef::GetBlock(a_BlockTypes, x, Height, z))
        {
            case E_BLOCK_WATER:
            case E_BLOCK_STATIONARY_WATER:
            {
                cChunkDef::SetBlock(a_BlockTypes, x, Height + 1, z, E_BLOCK_LILY_PAD);
                cChunkDef::SetHeight(a_HeightMap, x, z, Height + 1);
                break;
            }
        }  // switch (GetBlock)
    }  // for i
}
Thanks given by:
when i see the code visual express says there are 4 errors in the code but i don't know how to fix them Sad


Attached Files Thumbnail(s)
   
Thanks given by:
You are missing a curly brace at the start of the function. That should fix 3 of those. And for m_Noise, you probably need to put it into the class declaration and initialize it with a_Seed in the constructor (same as tree structgen)
Thanks given by:
can you do that Smile i realy need to learn more about c++
Thanks given by:
Done in Rev 647. Also added it into the defaults.
Thanks given by:
cool Smile
i have 2 bugs to note :S
1 sometimes leaves overide logs
2 every type of leaves drops the same sapling
Thanks given by:
Leaves shouldn't override logs, ever. If you find such a case, I want a seed, world.ini settings and coords.

I'm now looking into why VS won't optimize out hottest code, the cNoise object.
Thanks given by:
Seed=1631635336
coords are:
x=-249.058
y=73
z=-330.570
also some jungle trees in the jungle where you spawn next to are some leaves that override.
Thanks given by:
and are you working on something now? Smile
Thanks given by:
I'm in Vienna, enjoying a short holiday with my wife. Returning tomorrow, so I might have some something cooked up on sunday.

Before I left, I started working on ravines, since they are kinda like the wormnest caves, just they are a bit easier Smile
Thanks given by:




Users browsing this thread: 54 Guest(s)