mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
At end of G_RestoreMapState(), update g_player[].ps->i from STAT_PLAYER sprites.
This fixes a potential crash caused by violating the expected invariant sprite[g_player[player_index].ps->i].yvel == player_index otherwise. git-svn-id: https://svn.eduke32.com/eduke32@4114 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
335957800b
commit
ab7d3679df
1 changed files with 13 additions and 0 deletions
|
@ -5662,6 +5662,19 @@ void G_RestoreMapState(void)
|
|||
|
||||
Gv_RefreshPointers();
|
||||
#endif
|
||||
// Update g_player[].ps->i (sprite indices of players) to be consistent
|
||||
// with just loaded sprites.
|
||||
// Otherwise, crashes may ensue: e.g. WGR2 SVN r391, map spiderden:
|
||||
// - walk forward (to door leading to other level "Shadowpine Forest")
|
||||
// - in new level, walk backward to get back to the Spider Den
|
||||
// - walk backward to the door leading to Shadowpine Forest --> crash.
|
||||
for (SPRITES_OF(STAT_PLAYER, i))
|
||||
{
|
||||
int32_t snum = sprite[i].yvel;
|
||||
Bassert((unsigned)snum < MAXPLAYERS);
|
||||
g_player[snum].ps->i = i;
|
||||
}
|
||||
|
||||
for (i=0; i<playerswhenstarted; i++)
|
||||
sprite[g_player[i].ps->i].extra = phealth[i];
|
||||
|
||||
|
|
Loading…
Reference in a new issue