Hey everone! It's a small thing but I still wanted to know.
So I was working on code from day 34 and this happened:
| internal uint32
GetTileValue(world *World, tile_chunk *TileChunk, uint32 TestTileX, uint32 TestTileY)
{
uint32 TileChunkValue = 0;
if(TileChunk) {
uint32 TileChunkValue = GetTileValueUnchecked(World, TileChunk, TestTileX, TestTileY);
}
return(TileChunkValue);
}
|
See how I have 2
uint32 TileChunkValue definitions? TileChunkValue was 0 all the time because of that. Value from the GetTileValueUnchecked() call was completely ignored. And my tilemap was just empty.
Why C did that? And why compiler ignored that? (I have all same compiler keys as Casey had).
That's a shameful thing, but took me a long time to find it. Any ways to prevent that other than stepping through the code?