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

Method ReverseLookupTreeDependency

src/network/network_content.cpp:934–950  ·  view source on GitHub ↗

* Reverse lookup the dependencies of all parents over a given child. * @param tree list to store all parents in (is not cleared) * @param child the child to search the parents' dependencies for */

Source from the content-addressed store, hash-verified

932 * @param child the child to search the parents' dependencies for
933 */
934void ClientNetworkContentSocketHandler::ReverseLookupTreeDependency(ConstContentVector &tree, const ContentInfo *child) const
935{
936 tree.push_back(child);
937
938 /* First find all direct parents. We can't use the "normal" iterator as
939 * we are including stuff into the vector and as such the vector's data
940 * store can be reallocated (and thus move), which means our iterating
941 * pointer gets invalid. So fall back to the indices. */
942 for (size_t i = 0; i < tree.size(); i++) {
943 ConstContentVector parents;
944 this->ReverseLookupDependency(parents, *tree[i]);
945
946 for (const ContentInfo *ci : parents) {
947 include(tree, ci);
948 }
949 }
950}
951
952/**
953 * Check the dependencies (recursively) of this content info

Callers 3

Receive_SERVER_INFOMethod · 0.95
CheckDependencyStateMethod · 0.95
DrawDetailsMethod · 0.80

Calls 4

includeFunction · 0.85
push_backMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected