Skip to content

Add access to CGameRules and its properties #363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Dec 21, 2020
Prev Previous commit
Cache SendTable
  • Loading branch information
Ayuto committed Dec 14, 2020
commit 4a466cc3b49fe7ef9c3436cf0fb37900096b3418
10 changes: 8 additions & 2 deletions src/core/modules/engines/engines_gamerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,14 @@ extern INetworkStringTableContainer *networkstringtable;
//-----------------------------------------------------------------------------
int find_game_rules_property_offset(const char* name)
{
ServerClass* cls = ServerClassExt::find_server_class(find_game_rules_proxy_name());
int offset = SendTableSharedExt::find_offset(cls->m_pTable, name);
static SendTable* s_table = NULL;
if (!s_table)
{
ServerClass* cls = ServerClassExt::find_server_class(find_game_rules_proxy_name());
s_table = cls->m_pTable;
}

int offset = SendTableSharedExt::find_offset(s_table, name);

if (offset == -1)
BOOST_RAISE_EXCEPTION(PyExc_ValueError, "Unable to find property '%s'.", name)
Expand Down