Game Development Community

WaterBlocks disappear bug without Terrain: uninitialized array

by Clint S. Brewer · in Torque Game Engine · 07/20/2006 (3:44 pm) · 0 replies

If you have no terrain in your scene random waterblocks can dissapear

problem:
in
void fluid::RebuildMasks( void )


pGrid is MALLOC'd and later checked without being initialized

If you have a terrain, then it should be initialized (unless if for some reason fluid's m_pTerrain pointer is not set when RebuildMasks is called)

In our case we have no terrain, so this results in random dissapearances of sections of water.


solution:

right after pGrid is MALLOC'd
MEMSET it to 1, signifying that all grid blocks are accepted.


unless there is some deeper initialization inside dMalloc I didn't see of course!