Initial commit
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
#pragma once
|
||||
|
||||
struct netvar_t
|
||||
{
|
||||
char name[128];
|
||||
ulong offset;
|
||||
};
|
||||
|
||||
struct netvar_table_t
|
||||
{
|
||||
char name[128];
|
||||
stl::c_linked_list<netvar_t> props;
|
||||
};
|
||||
|
||||
class c_netvar_manager
|
||||
{
|
||||
public:
|
||||
bool initialize();
|
||||
bool is_prop_garbage(const char* name);
|
||||
|
||||
void process_table(respawn::recv_table* table);
|
||||
void process_prop(respawn::recv_table* table, respawn::recv_prop* prop, stl::c_linked_list<netvar_t>& list);
|
||||
|
||||
ulong get(const char* table_name, const char* prop_name) noexcept
|
||||
{
|
||||
stl::c_linked_list<netvar_t>* props_head = nullptr;
|
||||
|
||||
for (auto i = 0ull; i < m_list.count(); i++)
|
||||
{
|
||||
auto* const table = m_list[i];
|
||||
|
||||
if (table == nullptr)
|
||||
continue;
|
||||
|
||||
if (stl::strcmp(table_name, table->name))
|
||||
continue;
|
||||
|
||||
props_head = &table->props;
|
||||
}
|
||||
|
||||
if (props_head == nullptr)
|
||||
return 0;
|
||||
|
||||
ulong result{};
|
||||
|
||||
for (auto i = 0ull; i < props_head->count(); i++)
|
||||
{
|
||||
auto* const prop = (*props_head)[i];
|
||||
|
||||
if (!stl::strcmp(prop_name, prop->name))
|
||||
{
|
||||
result = prop->offset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
private:
|
||||
stl::c_linked_list<netvar_table_t> m_list;
|
||||
};
|
||||
|
||||
#define NETVAR(TABLE, NAME) g::p::netvar_mgr.get(_XS(TABLE), _XS(NAME))
|
||||
Reference in New Issue
Block a user