Skip to content
Snippets Groups Projects
Commit 3e8fb8db authored by LJ Sonic's avatar LJ Sonic
Browse files

Optimise boolean archiving

parent 2e3c1105
No related branches found
No related tags found
2 merge requests!985Shaders next merge,!904Optimise net-archiving of Lua strings, numbers and booleans
...@@ -730,7 +730,8 @@ void LUA_InvalidatePlayer(player_t *player) ...@@ -730,7 +730,8 @@ void LUA_InvalidatePlayer(player_t *player)
enum enum
{ {
ARCH_NULL=0, ARCH_NULL=0,
ARCH_BOOLEAN, ARCH_TRUE,
ARCH_FALSE,
ARCH_SIGNED, ARCH_SIGNED,
ARCH_SMALLSTRING, ARCH_SMALLSTRING,
ARCH_LARGESTRING, ARCH_LARGESTRING,
...@@ -818,8 +819,7 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) ...@@ -818,8 +819,7 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
WRITEUINT8(save_p, ARCH_NULL); WRITEUINT8(save_p, ARCH_NULL);
return 2; return 2;
case LUA_TBOOLEAN: case LUA_TBOOLEAN:
WRITEUINT8(save_p, ARCH_BOOLEAN); WRITEUINT8(save_p, lua_toboolean(gL, myindex) ? ARCH_TRUE : ARCH_FALSE);
WRITEUINT8(save_p, lua_toboolean(gL, myindex));
break; break;
case LUA_TNUMBER: case LUA_TNUMBER:
{ {
...@@ -1187,8 +1187,12 @@ static UINT8 UnArchiveValue(int TABLESINDEX) ...@@ -1187,8 +1187,12 @@ static UINT8 UnArchiveValue(int TABLESINDEX)
case ARCH_NULL: case ARCH_NULL:
lua_pushnil(gL); lua_pushnil(gL);
break; break;
case ARCH_BOOLEAN: case ARCH_TRUE:
lua_pushboolean(gL, READUINT8(save_p)); lua_pushboolean(gL, true);
break;
case ARCH_FALSE:
lua_pushboolean(gL, false);
break;
break; break;
case ARCH_SIGNED: case ARCH_SIGNED:
lua_pushinteger(gL, READFIXED(save_p)); lua_pushinteger(gL, READFIXED(save_p));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment