C4 Engine
C4 Engine API Documentation

Structure::FindStructure

Defined in:  TSOpenDDL.h
Finds a named structure using a local reference.
Prototype

Structure *FindStructure(const StructureRef& reference, int32 index = 0) const;

Parameters
reference The reference to the structure to find.
index The index of the name to search for within the reference's name array. This is used internally and should be set to its default value of 0.
Description
The FindStructure function finds the structure referenced by the sequence of names stored in the reference parameter and returns a pointer to it. If no such structure exists, then the return value is nullptr. Only structures belonging to the subtree of the structure for which this function is called can be returned by this function. The sequence of names in the reference identify a branch along the subtree leading to the referenced structure.

The reference must be a local reference, meaning that the first name stored in the reference is a local name as indicated by a value of false being returned by the StructureRef::GetGlobalRefFlag function. If the reference is not a local reference, then this function always returns nullptr. The DataDescription::FindStructure function should be used to find a structure through a global reference.

If the specified reference has an empty name array, then the return value is always nullptr. The empty name array is assigned to a reference data value when null appears in the OpenDDL file.
See Also

StructureRef

Structure::GetStructureName

Structure::GetGlobalNameFlag

DataDescription::FindStructure

DataDescription::GetRootStructure