Game Development Community

Torque, inheritance and compiling

by Tim Doty · in Torque Game Builder · 04/11/2005 (7:36 pm) · 2 replies

Okay, this one is a problem that involves the OO resource. Code that was working isn't. Literally. To make a test I copied it into another file and loaded it from there (I know you can just delete the .dso's and I've done that, but when you can do a diff between today and yesterday where there is no change and it doesn't work any more you get paranoid). It still failed.

The second test was to simply rename the object in the new file. That's it, no actual code changes at all, just a search and replace. And guess what? It works. Mostly.

So what isn't working?

Case 1: Original Code
This is a case of subclassing fxStaticSprite2D. What doesn't work is the subclass. There isn't any error instantiating, but any attempt to use an fxStaticSprite2D function results in an error. Note that not only did the same code work yesterday (and earlier today) but I use the exact same structure for another class which is still working perfectly.

Case 2: Renamed Class
It's a bit strange, but what seems to happen is that even though the fxStaticSprite2D functions are recognized as being there (no error when calling them) they don't work right. At least, setSize() doesn't.

I tried wiping out all .dso files, eliminating the ~/.garagegames/torqueDemo directory where it likes to hide things and took out the entire game directory. But that didn't help either.

The last thing I tried was swapping the names between the two files. That prevented either one from working. Swap the names back and the testObject (which is identical code to the original) works again).

I really hope someone has an idea because I've run out of them.

#1
04/11/2005 (7:55 pm)
I tried the swapping again and it worked... that is:

test.cs : copy of original code, s & r to change class name to testObject, s & r to change class name back
orig.cs : s & r to change class name to testObject

The difference from the first time I did this was that I selected just the block of code for the class and did the s & r on it alone (should've done it that way the first time). The only other class in the original file is related (it spawns the problem class) so the first time I did the s & r was pointless.

So the name isn't "poisoned" -- I was starting to wonder if it was the bad luck name. So I copied the contents of test.cs to the end of the orig.cs file, removed the exec'ing of test.cs and tried again. No luck, it didn't work.
#2
04/11/2005 (8:17 pm)
I'm not sure what was corrupt in the file, but I copied both classes into separate files and everything is working.