Game Development Community

To many templates bug

by Stephen Howe · in Torque Game Builder · 04/08/2008 (7:12 am) · 1 replies

I'm using the TGB Platformer Starter Kit & TGB 1.7.2. All I did was add a new template to "datablocks.cs" (BobTemplate) & this happened:

img354.imageshack.us/img354/5484/templatebugsb2.th.jpg


I added the following code:
datablock t2dSceneObjectDatablock(BobTemplate)
{
	Class				= "PlayerClass";
	Size				= "17.000 13.000";
	Layer				= "1";
	CollisionPolyList	= "-0.167 -0.820 0.167 -0.820 0.162 0.499 0.000 0.853 -0.167 0.512";
	_Behavior0			= "ActorBehavior";
	_Behavior1			= "ControllerBehavior";
	_Behavior2			= "ActorAnimationBehavior	DatablockPrefix	Bob	ScaleVolume	0";
};

@ end of file:
if ($managedDatablockSet.isMember(BobTemplate)) $managedDatablockSet.remove(BobTemplate);
$managedDatablockSet.add(BobTemplate);
(this is to fix a TGB bug where templates didn't show up in the drop-down boxes).

I left all the dragon template in the file too.

It works fine in the editor & when I run the game & all the templates seem to run the same thing, it's just strange.

BEFORE the previous code is in the datablocks.cs file it lists the templates correctly. If I remove the code after it's been added it keeps adding more templates every time the code is changed & re-loaded:
img171.imageshack.us/img171/8170/moretemplatebugwu0.th.jpg

Strangely, even when I remove parts of the code from the datablock.cs, the template that still shows up still works. IE when I remove "BobTemplate" from datablocks.cs, selecting BobTemplate in the dropdown box still loads the BobTemplate. There's nothing else in my game's scripts called "BobTemplate". It's like it's loading up an ever-growing script file of template from some place I don't know. Very strange!

#1
04/14/2008 (2:31 pm)
Found out what it is from a different thread.

the managed/datablocks.cs file was always adding new datablocks but never removing the old ones. So, every time I made a change it would add a new entry to that file & never clear out an out of date one.