-
-
Save AltimorTASDK/55b8b28e552eba0f6162 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "netvar_test.h" | |
#include "client_class.h" | |
#include "IBaseClientDLL.h" | |
#include <utility> | |
/** | |
* netvar_tree - Constructor | |
* | |
* Call populate_nodes on every RecvTable under client->GetAllClasses() | |
*/ | |
netvar_tree::netvar_tree() | |
{ | |
const auto *client_class = client->GetAllClasses(); | |
while (client_class != nullptr) { | |
const auto class_info = std::make_shared<node>(0); | |
auto *recv_table = client_class->m_pRecvTable; | |
populate_nodes(recv_table, &class_info->nodes); | |
nodes.emplace(recv_table->GetName(), class_info); | |
client_class = client_class->m_pNext; | |
} | |
} | |
/** | |
* populate_nodes - Populate a node map with brances | |
* @recv_table: Table the map corresponds to | |
* @map: Map pointer | |
* | |
* Add info for every prop in the recv table to the node map. If a prop is a | |
* datatable itself, initiate a recursive call to create more branches. | |
*/ | |
void netvar_tree::populate_nodes(RecvTable *recv_table, map_type *map) | |
{ | |
for (auto i = 0; i < recv_table->GetNumProps(); i++) { | |
const auto *prop = recv_table->GetProp(i); | |
const auto prop_info = std::make_shared<node>(prop->GetOffset()); | |
if (prop->GetType() == DPT_DataTable) | |
populate_nodes(prop->GetDataTable(), &prop_info->nodes); | |
map->emplace(prop->GetName(), prop_info); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment