You should also be doing exception handling:
try{
m_Terrain = new TerrainHandle;
}
catch(std::bad_alloc)
{
MessageBox(hwnd, L"Could not create TerrainHandle object.", L"Error", MB_OK);
return false;
}
Posted 03 January 2013 - 02:55 PM
try{
m_Terrain = new TerrainHandle;
}
catch(std::bad_alloc)
{
MessageBox(hwnd, L"Could not create TerrainHandle object.", L"Error", MB_OK);
return false;
}
Posted 03 January 2013 - 02:52 PM
A better suggestion is to return a integer value depending on the reason for the failure, i.e., 0 for no error, 1 for allocation error, 2 for file not found, etc.