mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-03-14 15:11:40 +00:00
Properly bound lua displayplayers and displayplayers.iterate to splitscreen
This is fixes crashes in replays because splitscreen displayplayers are initialized to INT32_MAX there.
This commit is contained in:
parent
a8529f0855
commit
1f74d7533e
1 changed files with 3 additions and 1 deletions
|
|
@ -118,7 +118,7 @@ static int lib_iterateDisplayplayers(lua_State *L)
|
|||
|
||||
for (i++; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[displayplayers[i]] || i > splitscreen)
|
||||
if (i > splitscreen || !playeringame[displayplayers[i]])
|
||||
return 0; // Stop! There are no more players for us to go through. There will never be a player gap in displayplayers.
|
||||
|
||||
if (!players[displayplayers[i]].mo)
|
||||
|
|
@ -139,6 +139,8 @@ static int lib_getDisplayplayers(lua_State *L)
|
|||
lua_Integer i = luaL_checkinteger(L, 2);
|
||||
if (i < 0 || i >= MAXSPLITSCREENPLAYERS)
|
||||
return luaL_error(L, "displayplayers[] index %d out of range (0 - %d)", i, MAXSPLITSCREENPLAYERS-1);
|
||||
if (i > splitscreen)
|
||||
return 0;
|
||||
if (!playeringame[displayplayers[i]])
|
||||
return 0;
|
||||
if (!players[displayplayers[i]].mo)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue