mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 04:41:23 +00:00
Fix Demo lua archive crash for real this time
This commit is contained in:
parent
b905f20cd4
commit
cbc7fe7b67
1 changed files with 12 additions and 5 deletions
|
@ -1247,6 +1247,14 @@ static UINT8 UnArchiveValue(int TABLESINDEX)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Unarchives from demo_p:
|
||||||
|
// Return values:
|
||||||
|
// 0: Normal
|
||||||
|
// 1: Read table key
|
||||||
|
// 2: Read table value
|
||||||
|
// 3: Don't use setfield
|
||||||
|
|
||||||
static UINT8 UnArchiveValueDemo(int TABLESINDEX, char field[1024])
|
static UINT8 UnArchiveValueDemo(int TABLESINDEX, char field[1024])
|
||||||
{
|
{
|
||||||
UINT8 type = READUINT8(demo_p);
|
UINT8 type = READUINT8(demo_p);
|
||||||
|
@ -1305,7 +1313,8 @@ static UINT8 UnArchiveValueDemo(int TABLESINDEX, char field[1024])
|
||||||
else
|
else
|
||||||
CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n");
|
CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n");
|
||||||
|
|
||||||
break;
|
return 3; // Don't set the field
|
||||||
|
|
||||||
case ARCH_PLAYER:
|
case ARCH_PLAYER:
|
||||||
LUA_PushUserdata(gL, &players[READUINT8(demo_p)], META_PLAYER);
|
LUA_PushUserdata(gL, &players[READUINT8(demo_p)], META_PLAYER);
|
||||||
break;
|
break;
|
||||||
|
@ -1387,10 +1396,8 @@ static void UnArchiveExtVarsDemo(void *pointer)
|
||||||
for (i = 0; i < field_count; i++)
|
for (i = 0; i < field_count; i++)
|
||||||
{
|
{
|
||||||
READSTRING(demo_p, field);
|
READSTRING(demo_p, field);
|
||||||
//CONS_Printf("%s\n", field);
|
if (UnArchiveValueDemo(TABLESINDEX, field) != 3) // This will return 3 if we shouldn't set this field.
|
||||||
CONS_Printf("%s\n", field);
|
lua_setfield(gL, -2, field);
|
||||||
UnArchiveValueDemo(TABLESINDEX, field);
|
|
||||||
lua_setfield(gL, -2, field);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lua_getfield(gL, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
lua_getfield(gL, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
||||||
|
|
Loading…
Reference in a new issue