diff options
author | Simon Howard | 2008-10-09 19:40:04 +0000 |
---|---|---|
committer | Simon Howard | 2008-10-09 19:40:04 +0000 |
commit | d053170646190f31263ae1ed75ad8cbf95409e91 (patch) | |
tree | 8fdabc0b2008e5be729965db7043d28d8cb59365 /src/hexen/p_mobj.c | |
parent | 88dd6235bcf78c545796795ac6a1f0732e4fab9e (diff) | |
download | chocolate-doom-d053170646190f31263ae1ed75ad8cbf95409e91.tar.gz chocolate-doom-d053170646190f31263ae1ed75ad8cbf95409e91.tar.bz2 chocolate-doom-d053170646190f31263ae1ed75ad8cbf95409e91.zip |
Fix crashes when loading the same level twice.
Subversion-branch: /branches/raven-branch
Subversion-revision: 1348
Diffstat (limited to 'src/hexen/p_mobj.c')
-rw-r--r-- | src/hexen/p_mobj.c | 15 |
1 files changed, 11 insertions, 4 deletions
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; } |