MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / getIndex

Method getIndex

Engine/modules/Verve/Core/VTreeNode.cpp:245–279  ·  view source on GitHub ↗

----------------------------------------------------------------------------- VTreeNode::getIndex(); Returns the index of the object in relation to the sibling nodes. -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

243//
244//-----------------------------------------------------------------------------
245int VTreeNode::getIndex( void )
246{
247 if ( !inTree() )
248 {
249 // No Index.
250 return 0;
251 }
252
253 ITreeNode *walk = NULL;
254 if ( mParentNode )
255 {
256 walk = mParentNode->mChildNode;
257 }
258 else
259 {
260 walk = this;
261 while ( walk->mSiblingPrevNode )
262 {
263 // Walk Up.
264 walk = walk->mSiblingPrevNode;
265 }
266 }
267
268 for ( int i = 0; walk; walk = walk->mSiblingNextNode, i++ )
269 {
270 if ( walk == this )
271 {
272 return i;
273 }
274 }
275
276 AssertFatal( false, "VTreeNode::getIndex() - Node List Broken?" );
277
278 return 0;
279}
280
281//-----------------------------------------------------------------------------
282//

Callers 1

VObject.cppFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected