Find object by name!

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.

Find object by name!

Postby Isoprog » Fri Jul 20, 2012 10:32 pm

Hi,
I have three nodes with same id mask. While selected each node will behave differently. So, I have to find which node is selected. How do I find it. I am finding it by name. I just want to know what is the right way to find a node while id are same.

Thanks in advance.
User avatar
Isoprog
 
Posts: 76
Joined: Wed Dec 10, 2008 7:53 am

Re: Find object by name!

Postby randomMesh » Sat Jul 21, 2012 12:01 am

Well, if the name is enough to identify the nodes and all works as expected, this IS the right way, i'd say.

You could also compare pointers or implement a comparison operator.
"In fact, nearly every sequence of punctuation is used for something in Perl. So, if you get writer’s block, just let the cat walk across the keyboard, and debug the result."

Katastrophe - A free, open source flocking boids simulation
User avatar
randomMesh
 
Posts: 1138
Joined: Fri Dec 29, 2006 12:04 am

Re: Find object by name!

Postby Isoprog » Sat Jul 21, 2012 1:49 am

Thank you for the reply.

Regards.
User avatar
Isoprog
 
Posts: 76
Joined: Wed Dec 10, 2008 7:53 am

Re: Find object by name!

Postby REDDemon » Sat Jul 21, 2012 3:50 pm

use Irrlicht map or std::map

things like

cpp Code: Select all
 
ObjectType * p = MyMap[string("object name")];
 


are allowed, and search times become O(log(N)) instead of O(N)
OpenGL is not hard. What you have to do is just explained in specifications. What is hard is dealing with poor OpenGL implementations.
User avatar
REDDemon
 
Posts: 831
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Re: Find object by name!

Postby Isoprog » Sun Jul 22, 2012 5:32 pm

I will try that, thanks. I am using strcmp. Once I get rid of other problems I will recheck.

Regards.
User avatar
Isoprog
 
Posts: 76
Joined: Wed Dec 10, 2008 7:53 am


Return to Beginners Help

Who is online

Users browsing this forum: smso and 1 guest