Iterating over mounted objects
by Daniel Buckmaster · in Torque 3D Professional · 03/14/2011 (6:17 pm) · 0 replies
In SceneObject.cpp, I've just come across this:
It's a really minor point, but I'm also kind of wondering whether my shorthand is actually correct code. I'm using it to scope mounted objects, and it doesn't seem to be breaking anything so far!
for ( SceneObject **ptr = &mMount.list; *ptr; ptr = &(*ptr)->mMount.link )And was wondering, would it not be more readable to write:
for(SceneObject *ptr = mMount.list; ptr; ptr = ptr->mMount.link)
It's a really minor point, but I'm also kind of wondering whether my shorthand is actually correct code. I'm using it to scope mounted objects, and it doesn't seem to be breaking anything so far!
About the author
Studying mechatronic engineering and computer science at the University of Sydney. Game development is probably my most time-consuming hobby!