mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 15:32:33 +00:00
Use FIELDFROM in lua polyobject code
This commit is contained in:
parent
374c19f915
commit
4b0725f36f
1 changed files with 4 additions and 4 deletions
|
@ -99,7 +99,7 @@ static int polyobjvertices_get(lua_State *L)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
numofverts = (size_t)(*(size_t *)(((size_t)polyverts) - (offsetof(polyobj_t, vertices) - offsetof(polyobj_t, numVertices))));
|
numofverts = *(size_t *)FIELDFROM (polyobj_t, polyverts, vertices,/* -> */numVertices);
|
||||||
|
|
||||||
if (!numofverts)
|
if (!numofverts)
|
||||||
return luaL_error(L, "no vertices found!");
|
return luaL_error(L, "no vertices found!");
|
||||||
|
@ -120,7 +120,7 @@ static int polyobjvertices_num(lua_State *L)
|
||||||
if (!polyverts || !(*polyverts))
|
if (!polyverts || !(*polyverts))
|
||||||
return luaL_error(L, "accessed polyobj_t.vertices doesn't exist anymore.");
|
return luaL_error(L, "accessed polyobj_t.vertices doesn't exist anymore.");
|
||||||
|
|
||||||
numofverts = (size_t)(*(size_t *)(((size_t)polyverts) - (offsetof(polyobj_t, vertices) - offsetof(polyobj_t, numVertices))));
|
numofverts = *(size_t *)FIELDFROM (polyobj_t, polyverts, vertices,/* -> */numVertices);
|
||||||
lua_pushinteger(L, numofverts);
|
lua_pushinteger(L, numofverts);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ static int polyobjlines_get(lua_State *L)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
numoflines = (size_t)(*(size_t *)(((size_t)polylines) - (offsetof(polyobj_t, lines) - offsetof(polyobj_t, numLines))));
|
numoflines = *(size_t *)FIELDFROM (polyobj_t, polylines, lines,/* -> */numLines);
|
||||||
|
|
||||||
if (!numoflines)
|
if (!numoflines)
|
||||||
return luaL_error(L, "no lines found!");
|
return luaL_error(L, "no lines found!");
|
||||||
|
@ -177,7 +177,7 @@ static int polyobjlines_num(lua_State *L)
|
||||||
if (!polylines || !(*polylines))
|
if (!polylines || !(*polylines))
|
||||||
return luaL_error(L, "accessed polyobj_t.lines doesn't exist anymore.");
|
return luaL_error(L, "accessed polyobj_t.lines doesn't exist anymore.");
|
||||||
|
|
||||||
numoflines = (size_t)(*(size_t *)(((size_t)polylines) - (offsetof(polyobj_t, lines) - offsetof(polyobj_t, numLines))));
|
numoflines = *(size_t *)FIELDFROM (polyobj_t, polylines, lines,/* -> */numLines);
|
||||||
lua_pushinteger(L, numoflines);
|
lua_pushinteger(L, numoflines);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue