RwFindClump(RwClump *root, RwInt32 (*func)(RwClump *clump));
RwFindClumpInt(RwClump *root,
RwBool (*func)(RwClump *clump, RwInt32 arg), RwInt32 arg);
RwFindClumpReal(RwClump *root,
RwBool (*func)(RwClump *clump, RwReal arg), RwReal arg);
RwFindClumpPointer(RwClump *root,
RwBool (*func)(RwClump *clump, void *arg), void *arg);
Description
Finds a particular clump in a hierarchy by applying a boolean call-back function to each clump in the hierarchy in turn. If any invocation of the call-back function returns TRUE, iteration is terminated and the clump passed as the argument to the call-back function is returned.
The call-back function can either be a RenderWare API function or user-defined. It is important to note that a return value of TRUE indicates success (i.e., the clump being sought was found) and stops iteration, while a return value of FALSE indicates that the search should continue. If the search fails (i.e., no predicate returns TRUE), NULL is returned.
The difference between RwFindClump() and its variations listed above is that for RwFindClump() the call-back function takes only one argument (a clump pointer), whereas in the case of its variations, the call-back function takes an additional, user-supplied argument (arg) that can be of type RwInt32, RwReal or void * respectively.
Arguments
root Pointer to the root clump.
func Pointer to the call-back function.
arg A user supplied argument to be passed to the call-back function.
Return Value
A pointer to the clump found if the search was successful, and NULL if the search failed or if any errors occurred. Errors can be checked for using RwGetError().
Comments
The traversal of the clump hierarchy is done in a depth-first manner.
See Also