Skip to content

Commit fd02093

Browse files
committed
Check if all gamedata has been included
1 parent 974c60f commit fd02093

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

extension.cpp

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,34 +1549,43 @@ bool SendVarEdit::SDK_OnLoad(char* error, size_t maxlength, bool late)
15491549

15501550
// fill out game info struct
15511551
{
1552-
gameconf->GetOffset("CEntityWriteInfo entity", &g_gameinfo.struct_EWI.entity);
1553-
gameconf->GetOffset("CEntityWriteInfo output", &g_gameinfo.struct_EWI.output);
1554-
gameconf->GetOffset("CEntityWriteInfo client", &g_gameinfo.struct_EWI.client);
1555-
gameconf->GetOffset("CEntityWriteInfo oldpack", &g_gameinfo.struct_EWI.oldpack);
1556-
gameconf->GetOffset("CEntityWriteInfo newpack", &g_gameinfo.struct_EWI.newpack);
1552+
bool all_offsets = true;
1553+
bool all_variables = true;
15571554

1558-
g_variables.GetVariable("SV_DetermineUpdateType entitywriteinfo", &g_gameinfo.vars_DUT.entitywriteinfo);
1559-
g_variables.GetVariable("SV_DetermineUpdateType propcount", &g_gameinfo.vars_DUT.propcount);
1555+
all_offsets &= gameconf->GetOffset("CEntityWriteInfo entity", &g_gameinfo.struct_EWI.entity);
1556+
all_offsets &= gameconf->GetOffset("CEntityWriteInfo output", &g_gameinfo.struct_EWI.output);
1557+
all_offsets &= gameconf->GetOffset("CEntityWriteInfo client", &g_gameinfo.struct_EWI.client);
1558+
all_offsets &= gameconf->GetOffset("CEntityWriteInfo oldpack", &g_gameinfo.struct_EWI.oldpack);
1559+
all_offsets &= gameconf->GetOffset("CEntityWriteInfo newpack", &g_gameinfo.struct_EWI.newpack);
1560+
1561+
all_variables &= g_variables.GetVariable("SV_DetermineUpdateType entitywriteinfo", &g_gameinfo.vars_DUT.entitywriteinfo);
1562+
all_variables &= g_variables.GetVariable("SV_DetermineUpdateType propcount", &g_gameinfo.vars_DUT.propcount);
15601563

15611564
if (!gameconf->GetMemSig("SV_DetermineUpdateType props changed call", &g_gameinfo.points_DUT.props_changed_call))
15621565
RETURN_ERROR("Failed to find SV_DetermineUpdateType props changed call.");
15631566

15641567
if (!gameconf->GetMemSig("SV_DetermineUpdateType positive propcount block", &g_gameinfo.points_DUT.propcount_positive_block))
15651568
RETURN_ERROR("Failed to find SV_DetermineUpdateType positive propcount block.");
15661569

1567-
g_variables.GetVariable("SendTable_WritePropList table", &g_gameinfo.vars_WPL.table);
1568-
g_variables.GetVariable("SendTable_WritePropList output", &g_gameinfo.vars_WPL.output);
1569-
g_variables.GetVariable("SendTable_WritePropList propindex", &g_gameinfo.vars_WPL.propindex);
1570-
g_variables.GetVariable("SendTable_WritePropList output_lastpropindex", &g_gameinfo.vars_WPL.output_lastpropindex);
1570+
all_variables &= g_variables.GetVariable("SendTable_WritePropList table", &g_gameinfo.vars_WPL.table);
1571+
all_variables &= g_variables.GetVariable("SendTable_WritePropList output", &g_gameinfo.vars_WPL.output);
1572+
all_variables &= g_variables.GetVariable("SendTable_WritePropList propindex", &g_gameinfo.vars_WPL.propindex);
1573+
all_variables &= g_variables.GetVariable("SendTable_WritePropList output_lastpropindex", &g_gameinfo.vars_WPL.output_lastpropindex);
15711574

15721575
if (!gameconf->GetMemSig("SendTable_WritePropList loop continue", &g_gameinfo.points_WPL.loop_continue))
15731576
RETURN_ERROR("Failed to find SendTable_WritePropList loop continuation point.");
15741577

15751578
if (!gameconf->GetAddress("&g_PropTypeFns", (void**)&g_gameinfo.proptypefns))
15761579
RETURN_ERROR("Failed to find g_PropTypeFns.");
15771580

1578-
gameconf->GetOffset("CSendTablePrecalc props", &g_gameinfo.struct_STP.props);
1579-
gameconf->GetOffset("CSendTablePrecalc propcount", &g_gameinfo.struct_STP.propcount);
1581+
all_offsets &= gameconf->GetOffset("CSendTablePrecalc props", &g_gameinfo.struct_STP.props);
1582+
all_offsets &= gameconf->GetOffset("CSendTablePrecalc propcount", &g_gameinfo.struct_STP.propcount);
1583+
1584+
if (!all_offsets)
1585+
RETURN_ERROR("Missing offset in gamedata offsets.");
1586+
1587+
if (!all_variables)
1588+
RETURN_ERROR("Missing variable in gamedata variables.");
15801589
}
15811590

15821591
// hook CGameServer::SendClientMessages to catch when the server is about to network stuff to clients

0 commit comments

Comments
 (0)