From d053170646190f31263ae1ed75ad8cbf95409e91 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 9 Oct 2008 19:40:04 +0000 Subject: Fix crashes when loading the same level twice. Subversion-branch: /branches/raven-branch Subversion-revision: 1348 --- src/hexen/p_mobj.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/hexen/p_mobj.c') diff --git a/src/hexen/p_mobj.c b/src/hexen/p_mobj.c index a99b6a65..4accc36b 100644 --- a/src/hexen/p_mobj.c +++ b/src/hexen/p_mobj.c @@ -1446,11 +1446,18 @@ void P_SpawnMapThing(mapthing_t * mthing) // Check for player starts 5 to 8 if (mthing->type >= 9100 && mthing->type <= 9103) { - mthing->type = 5 + mthing->type - 9100; // Translate to 5 - 8 - playerstarts[mthing->arg1][mthing->type - 1] = *mthing; - if (!deathmatch && !mthing->arg1) + mapthing_t *player_start; + int player; + + player = 4 + mthing->type - 9100; + + player_start = &playerstarts[mthing->arg1][player]; + memcpy(player_start, mthing, sizeof(mapthing_t)); + player_start->type = player + 1; + + if (!deathmatch && !player_start->arg1) { - P_SpawnPlayer(mthing); + P_SpawnPlayer(player_start); } return; } -- cgit v1.2.3