MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GroupIsInGroup

Function GroupIsInGroup

src/group_cmd.cpp:909–919  ·  view source on GitHub ↗

* Test if GroupID group is a descendant of (or is) GroupID search * @param search The GroupID to search in * @param group The GroupID to search for * @return True iff group is search or a descendant of search */

Source from the content-addressed store, hash-verified

907 * @return True iff group is search or a descendant of search
908 */
909bool GroupIsInGroup(GroupID search, GroupID group)
910{
911 if (!Group::IsValidID(search)) return search == group;
912
913 do {
914 if (search == group) return true;
915 search = Group::Get(search)->parent;
916 } while (search != GroupID::Invalid());
917
918 return false;
919}

Callers 3

CmdAlterGroupFunction · 0.85
GetEngineReplacementFunction · 0.85
GenerateVehicleSortListFunction · 0.85

Calls 1

InvalidFunction · 0.85

Tested by

no test coverage detected