T2dTextObject addAutoFontSize() crash bug with FIX
by Eric Robinson · in Torque Game Builder · 03/27/2007 (1:27 am) · 0 replies
Try the following:
1) add a generic t2dTextObject to your a level and write some text in it.
2) name the t2dTextObject "testText" in the Scripting Rollout.
3) simulate the level.
4) in the console, enter the following:
FIX:
In t2dTextObject.cc, go to line 1372 (the return statement within the addAutoFontSize ConsoleMethod definition) and change
1) add a generic t2dTextObject to your a level and write some text in it.
2) name the t2dTextObject "testText" in the Scripting Rollout.
3) simulate the level.
4) in the console, enter the following:
testText.addAutoFontSize(1024, 0, 10);The important thing is the zero. If you send "0" as the %cameraHeight argument your game will crash.
FIX:
In t2dTextObject.cc, go to line 1372 (the return statement within the addAutoFontSize ConsoleMethod definition) and change
return object->addFontSize( S32( characterHeight / cameraHeight * screenHeight ) );to
return cameraHeight != 0 ? object->addFontSize( S32( characterHeight / cameraHeight * screenHeight ) ) : false;No more crashies... err... from Divide-by-Zero in this function... Heh.