Hi
I've been working on all the tips provided in Game Coding Complete 2nd ed. To get all the the concepts 100% I've been gradually implementing the classes from the book. It's been working out pretty good until now, but I've hit a snag after testing the CMessageBox code.
When I show a CMessageBox on WM_CLOSE (Exit confirmation) the first time and hit "No" everything is ok, but the second time windows triggers a breakpoint and I get this error:
HEAP[GameTest.exe]: HEAP: Free Heap block f6f608 modified at f6f69c after it was freed.
There are no more errors after this one and everything seems to work. If this is debugged in release mode the text is garbled.
I've tracked the problem to the DXUTDialog class and the SetTexture(...) function shown below:
for( UINT i = m_Textures.GetSize(); i <= index; i++ )
{
m_Textures.Add( -1 );
}
the lastest point before digging into C/C++ includes is this:
template<typename TYPE> HRESULT CGrowableArray <TYPE>::Add( const TYPE& value )
{
HRESULT hr;
if( FAILED( hr = SetSizeInternal( m_nSize + 1 ) ) )
return hr;
My code is basically the same as the source from the book (latest version) and I don't think I've left anything out. Not that I can rule this out though. hehe
Hope one of you guys can help me.
Edit: It seems that when I add a SoundProcess to the ProcessManager or create my font class the font in the message box gets scrambled or the game breaks with the heap corruption error.
I've been working on all the tips provided in Game Coding Complete 2nd ed. To get all the the concepts 100% I've been gradually implementing the classes from the book. It's been working out pretty good until now, but I've hit a snag after testing the CMessageBox code.
When I show a CMessageBox on WM_CLOSE (Exit confirmation) the first time and hit "No" everything is ok, but the second time windows triggers a breakpoint and I get this error:
HEAP[GameTest.exe]: HEAP: Free Heap block f6f608 modified at f6f69c after it was freed.
There are no more errors after this one and everything seems to work. If this is debugged in release mode the text is garbled.
I've tracked the problem to the DXUTDialog class and the SetTexture(...) function shown below:
for( UINT i = m_Textures.GetSize(); i <= index; i++ )
{
m_Textures.Add( -1 );
}
the lastest point before digging into C/C++ includes is this:
template<typename TYPE> HRESULT CGrowableArray <TYPE>::Add( const TYPE& value )
{
HRESULT hr;
if( FAILED( hr = SetSizeInternal( m_nSize + 1 ) ) )
return hr;
My code is basically the same as the source from the book (latest version) and I don't think I've left anything out. Not that I can rule this out though. hehe
Hope one of you guys can help me.
Edit: It seems that when I add a SoundProcess to the ProcessManager or create my font class the font in the message box gets scrambled or the game breaks with the heap corruption error.
The post was edited 1 time, last by Corvwyn ().