Crash when setStaticTile() bounds exceed createTileLayer()
by Terry Greenlaw · in Torque Game Builder · 04/12/2005 (7:26 pm) · 3 replies
I created a 256x256 tile layer when I meant to create a 512x512. Instead of getting a bazillion range errors back from setStaticTile(), T2D GPFed.
It's probably a bug in the code that prints "YOU ARE AN IDIOT" after the 500th runtime error :-)
%tileMap = new fxTileMap2D() { scenegraph = t2dSceneGraph; };
// THIS LINE WORKS - %ground = %tileMap.createTileLayer( "512 512 1024 1024" );
// THIS LINE DOESN'T - %ground = %tileMap.createTileLayer( "256 256 1024 1024" );
%ground.setSize("524288 524288");
%ground.setPosition( "0 0" );
%ground.setWrap( true, true );
%ground.setLayer( 30 );
%ground.setImmovable();
for (%x=0; %x<511; %x++) {
for (%y=0; %y<511; %y++) {
%ground.setStaticTile(%x SPC %y,grassIM);
}
}It's probably a bug in the code that prints "YOU ARE AN IDIOT" after the 500th runtime error :-)
#2
You even led me conveniently into my feature request :-)
Can you add something to the engine (or can we?) that does a callback after a developer-chosen number of errors occurs?
Or better yet, can the error() call be overridden? I definitely need to take a better look at the console code :-)
04/13/2005 (6:09 am)
Thanks once again, Melv!You even led me conveniently into my feature request :-)
Can you add something to the engine (or can we?) that does a callback after a developer-chosen number of errors occurs?
Or better yet, can the error() call be overridden? I definitely need to take a better look at the console code :-)
#3
When we merge with TGE v1.4 we'll get the improvements made there. One of which is report of warnings/errors in the drop-down console (in a status pane).
This won't help you restrict the number of errors/warnings reported though.
- Melv.
04/13/2005 (7:17 am)
You can do anything in the C++ platform code, it's all there. :)When we merge with TGE v1.4 we'll get the improvements made there. One of which is report of warnings/errors in the drop-down console (in a status pane).
This won't help you restrict the number of errors/warnings reported though.
- Melv.
Associate Melv May
That one has already been fixed and will be in the next update. Here's the fix in-case you're interested...
Replace the following function with the one below...
//----------------------------------------------------------------------------- // Get Tile Object Node. //----------------------------------------------------------------------------- bool fxTileLayer2D::getTileObject( U32 tileX, U32 tileY, tTileObject** ppTileObject ) { // Return Nothing if we've not got a tile array. if ( !mppTileObjectArray ) return false; // Check Tile Bounds. if ( tileX < 0 || tileX >= mTileCountX || tileY < 0 || tileY >= mTileCountY ) return false; // Set Tile Object Pointer. *ppTileObject = mppTileObjectArray[tileX + ( tileY * mTileCountX )]; // Return Okay. return true; }Thanks for mentioning it though. :)
EDIT: Just thought I'd add that if you try your code above with this fix then you will encounter a big delay into setting-up the tilemap as you will get approximately a quarter-million error messages telling you that the tile is invalid so this will take some time on slower machines.
- Melv.