RenderWare V2.1

Previous Page Index Next Page

RwClump *

RwForAllClumpsInHierarchy(RwClump *root,
RwClump *(*func) (RwClump *clump));

RwClump *

RwForAllClumpsInHierarchyInt(RwClump *root,
RwClump *(*func)(RwClump *clump, RwInt32 arg), RwInt32 arg);

RwClump *

RwForAllClumpsInHierarchyReal(RwClump *root,
RwClump *(*func)(RwClump *clump, RwReal arg), RwReal arg);

RwClump *

RwForAllClumpsInHierarchyPointer(RwClump *root,
RwClump *(*func)(RwClump *clump, void *arg), void *arg);

Description

Applies a call-back function to all clumps in the hierarchy whose root is pointed to by root. If any invocation of the call-back function sets RenderWare’s error status, iteration is terminated. The call-back function can either be a RenderWare API function or a user-defined function. In the latter case, the call-back function should call RwSetUserError() if it fails for any reason.

The difference between RwForAllClumpsInHierarchy() and its variations listed above is that for RwForAllClumpsInHierarchy() 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

The argument clump if successful, and NULL otherwise.

Comments

If the return type of the call-back function is not RwClump *, then the pointer to the call-back function should be cast to the expected type, i.e., a pointer to a function whose return type is RwClump *. For example, in the case of a call-back function named foo whose return type is int, the following C expression should be used:

(RwClump*(*)())foo

The traversal of the clump hierarchy is done in a depth-first manner.

See Also

RwAddChildToClump()

RwFindClump()

RwFindTaggedClump()

RwGetFirstChildClump()

RwGetNextClump()

RwRemoveChildFromClump()

RwSetUserError()