Game Development Community

Strange error.

by Chris "Dark" Evans · in Torque Game Engine · 08/16/2001 (4:21 pm) · 3 replies

ERROR: Attempting to re-link namespace Player from ShapeBase to PlayerData with non-Zero refcount.

Retry/Cancel

That's the error. The error isn't strange, it's why it's happening that is.

In player.cs I changed the player class to Player, instead of Armor. Then I replaced all the functions with Armor::Whatever in the name to Player::Whatever. Deleted all the DSOs as I always do, ran the game (my compiled v12test_DEBUG.exe) and it worked fine.

I did that yesterday. I kept editing, just little things in other files, and the game ran fine each time. Today I did LabRat's particle and footprint fixes, compiled v12test_DEBUG.exe and went into the game. Right when I click Launch Mission that error pops up.

I compiled the original engine without the changes and it still happened. When I changed everything back to Armor:: it worked fine. It's strange that it worked for a while, then it starts giving me this error.

I can run v12Test.exe and it works fine too.

Why would it do that?



Dark

#1
08/16/2001 (4:32 pm)
The only thing I can think of is because Player is an object type and there is already a player class associated with it.
#2
08/16/2001 (4:40 pm)
I think you're right. I just changed it to Player2:: and it works fine. It might have something to do with the model too.

It's strange though that the error wasn't triggered before. Really weird.


Dark
#3
08/17/2001 (8:41 am)
I'm not sure what happened the first time, but you can't use the name "Player". Player is already an existing namespace (which is why you got the error).

Declaring a new Datblock object constructs a new namespace, which allows you to do things like:
datablock PlayerData(Foo)
{
};

function Foo::onAdd() {
 // Function in the Foo namespace!
}
All the internal C++ classes registered with the scripting language are namespaces. This includes almost all the game objects and their datablocks, so Player, PlayerData, Vehicle, Explosion, Item, ItemData, etc...