Game Development Community

Loading straight into mission crashes in TerrainBlock::onAdd()

by Robert Rose · in Torque Game Engine · 11/16/2007 (5:42 pm) · 2 replies

Following other people's examples I'm trying to get the -mission arg to work:

http://www.garagegames.com/mg/forums/result.thread.php?qt=14825
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4533

But when I jump into a mission I created earlier I get a crash when the resource manager tries to load a file using an uninitialized string:

bool TerrainBlock::onAdd()
{
if(!Parent::onAdd())
return false;

setPosition(Point3F(-squareSize * (BlockSize >> 1), -squareSize * (BlockSize >> 1), 0));

Resource terr = ResourceManager->load(mTerrFileName, true); <----

mTerrFileName isn't initialized.. In fact, much of the class appears to be uninitialized.

Ideas?
-robert

#1
11/16/2007 (5:43 pm)
I should add that loading into 'features.mis' that comes with the demo app crashes also at the same spot.
#2
11/16/2007 (5:58 pm)
Found it. There were two problems:

mTerrFileName = 0; needs to be set in the constructor for TerrainBlock.

FORWARDslashes, not backslashes need to be used when specifying paths! :-)