Assign a server player in replays for Lua purposes

Unfortunately this doesn't seem to help sync much. It
at least prevents constant Lua errors I guess....
This commit is contained in:
fickleheart 2019-03-03 20:24:35 -06:00
parent 766ceabf91
commit d560fef930
2 changed files with 4 additions and 2 deletions

View file

@ -9812,7 +9812,7 @@ static inline int lib_getenum(lua_State *L)
lua_pushinteger(L, mapmusflags); lua_pushinteger(L, mapmusflags);
return 1; return 1;
} else if (fastcmp(word,"server")) { } else if (fastcmp(word,"server")) {
if ((!multiplayer || !netgame) && !playeringame[serverplayer]) if ((!multiplayer || !(netgame || demoplayback)) && !playeringame[serverplayer])
return 0; return 0;
LUA_PushUserdata(L, &players[serverplayer], META_PLAYER); LUA_PushUserdata(L, &players[serverplayer], META_PLAYER);
return 1; return 1;

View file

@ -6847,6 +6847,8 @@ void G_DoPlayDemo(char *defdemoname)
// Load players that were in-game when the map started // Load players that were in-game when the map started
p = READUINT8(demo_p); p = READUINT8(demo_p);
secondarydisplayplayer = thirddisplayplayer = fourthdisplayplayer = INT32_MAX;
while (p != 0xFF) while (p != 0xFF)
{ {
spectator = false; spectator = false;
@ -6857,7 +6859,7 @@ void G_DoPlayDemo(char *defdemoname)
slots[numslots] = p; numslots++; slots[numslots] = p; numslots++;
if (!playeringame[displayplayer] || players[displayplayer].spectator) if (!playeringame[displayplayer] || players[displayplayer].spectator)
displayplayer = consoleplayer = secondarydisplayplayer = thirddisplayplayer = fourthdisplayplayer = p; displayplayer = consoleplayer = serverplayer = p;
/*else if (!spectator && splitscreen < 3) { /*else if (!spectator && splitscreen < 3) {
if (splitscreen == 0) { if (splitscreen == 0) {
splitscreen = 1; splitscreen = 1;