Prevent P_GetP from treating player indexes that are >= g_mostConcurrentPlayers as player 0, by checking against MAXPLAYERS instead.

Prevents the "gib on spawn in multiplayer" bug, and allows fake players to work properly.

Patch from Striker.

git-svn-id: https://svn.eduke32.com/eduke32@6457 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2017-09-27 02:30:37 +00:00
parent ee94494e3a
commit 029340b3a5

View file

@ -382,7 +382,9 @@ static inline int P_GetP(const void *pSprite)
return 0;
#else
int playerNum = ((const uspritetype *)pSprite)->yvel;
if ((unsigned)playerNum >= (unsigned)g_mostConcurrentPlayers)
// [JM] Check against MAXPLAYERS as opposed to g_mostConcurrentPlayers
// to prevent CON for disconnected/fake players from executing as playernum 0.
if ((unsigned)playerNum >= MAXPLAYERS)
playerNum = 0;
return playerNum;
#endif