Skip to content

Commit

Permalink
fix building of edict table
Browse files Browse the repository at this point in the history
correct number of edicts and handle free edicts
  • Loading branch information
alexey-lysiuk committed Aug 6, 2023
1 parent 9758435 commit 859b979
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Quake/lua_script.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static int LUA_Vec3String(lua_State* state)

static qboolean LUA_MakeEdictTable(lua_State* state, int index)
{
if (!sv.active || index < 0 || index >= sv.max_edicts)
if (!sv.active || index < 0 || index >= sv.num_edicts)
{
lua_pushnil(state);
return false;
Expand All @@ -66,6 +66,9 @@ static qboolean LUA_MakeEdictTable(lua_State* state, int index)

lua_createtable(state, 0, 0);

if (ed->free)
return true;

for (int fi = 1; fi < progs->numfielddefs; ++fi)
{
etype_t type;
Expand Down

0 comments on commit 859b979

Please sign in to comment.