Problem with PCZSceneManager init

Problems building or running the engine, queries about how to use features etc.
Post Reply
Darneith
Gnoblar
Posts: 18
Joined: Sun Nov 18, 2007 2:59 am

Problem with PCZSceneManager init

Post by Darneith »

I recently switched my code over to using the PCZSceneManager or at least attempted to. It crashes when I call the init function. I traced it down to line 206 of OgrePCZSceneManager.cpp

Code: Select all

      // create a new default zone
		newZone = mZoneFactoryManager->createPCZone(this, zoneTypeName, zoneName);
My code to create and init the scene manager is below:

Code: Select all

		SceneManager = Root->createSceneManager("PCZSceneManager", "MainScene");
		((Ogre::PCZSceneManager*)SceneManager)->init("ZoneType_Default");
SceneManager is an Ogre::SceneManager.

I feel like I must be missing something somewhere before I'm supposed to init the SM, but I can't find an indication as to what. Any help would be appreciated.
User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Post by xavier »

Is SceneManager an Ogre::SceneManager*?
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.
Darneith
Gnoblar
Posts: 18
Joined: Sun Nov 18, 2007 2:59 am

Post by Darneith »

Yes it is, sorry I neglected to put the asterik.

EDIT: I neglected to put it in my post. The code there was a correct. I realized it wasn't terribly clear and people might see that and think the issue was resolved. It is not.
Chaster
OGRE Expert User
OGRE Expert User
Posts: 557
Joined: Wed May 05, 2004 3:19 pm
Location: Portland, OR, USA
Contact:

Post by Chaster »

Hi Darneith,

What platform are you on? I suspect that it may be related to your use of a string literal in the init call. Some plaforms (Mac? Linux?) seem to have a problem with string literals passed directly in... Try using an assigned String variable. This is what I use in my own project:

Code: Select all

	// We're going to use the Portal Connected Zone Manager
	mSceneMgr = mRoot->createSceneManager("PCZSceneManager", "PCZSceneManager");
	// initialize the scene manager using Default as default zone
	String zoneTypeName = "ZoneType_Default";
	((PCZSceneManager*)mSceneMgr)->init(zoneTypeName);
Hope that helps.

Chaster
Darneith
Gnoblar
Posts: 18
Joined: Sun Nov 18, 2007 2:59 am

Post by Darneith »

Thanks for the reply Chaster. I switched it to an assigned string unfortunately that didn't solve the issue. It's still crashing in the same spot. I'm using XP and VC8, by the way. I traced it to where it's crashing in PCZoneFactoryManager::createPCZone and it's this bit of code.

Code: Select all

mPCZoneFactories.begin()
At first I thought my PCZone Factory wasn't registered but after checking the log I found this line, so now I'm not sure what to think.

Code: Select all

01:21:12: PCZone Factory Type 'ZoneType_Default' registered
Any further help would be appreciated.
JohnM
Gnoblar
Posts: 4
Joined: Sat Sep 06, 2008 3:18 am

Post by JohnM »

I'm having the same problem as darneith - it crashes when I call init(zoneTypeName).

I'm using the new OGRE 1.6.0 RC1 Source For Windows package compiled with Visual C++ 2008 Express.

Here is the code I'm using:

Code: Select all

	mSceneMgr = mRoot->createSceneManager("PCZSceneManager", "PCZSceneManager");
	String zoneTypeName = "ZoneType_Default";
	String zoneFilename = "none";
	((PCZSceneManager*)mSceneMgr)->init(zoneTypeName);
Chaster
OGRE Expert User
OGRE Expert User
Posts: 557
Joined: Wed May 05, 2004 3:19 pm
Location: Portland, OR, USA
Contact:

Post by Chaster »

Darneith (and JohnM),

I'll try to get some time and track down what is going on here. I hate these kinds of bugs (works for me, not for you). If you could send me some sample code which duplicates your problem, that would probably be quite helpful.

Chaster
seiky
Gnoblar
Posts: 7
Joined: Tue Mar 17, 2009 4:15 pm

Re: Problem with PCZSceneManager init

Post by seiky »

Hi,

I have exactly the same issue.
After debugging I found that the mPCZoneFactories is empty in this line :

Code: Select all

for(PCZoneFactoryMap::iterator i = mPCZoneFactories.begin(); i != mPCZoneFactories.end(); ++i)
in this function:

Code: Select all

PCZone* PCZoneFactoryManager::createPCZone(PCZSceneManager * pczsm,  const String& zoneType, const String& zoneName)
however, the factories were previously created, I don't know what happens between?

Can anyone help?

Thanks :)
Post Reply