From 3634ba71864f5c95a2bdffa12b942c1c39bdc05c Mon Sep 17 00:00:00 2001 From: skyjake Date: Thu, 4 Aug 2011 18:41:15 +0300 Subject: [PATCH] Fixed: Behavior when there are no free DM startspots Instead of Con_Error() it just selects one of them. --- doomsday/plugins/common/src/p_start.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/doomsday/plugins/common/src/p_start.c b/doomsday/plugins/common/src/p_start.c index befce0a621..30d04473cd 100644 --- a/doomsday/plugins/common/src/p_start.c +++ b/doomsday/plugins/common/src/p_start.c @@ -1047,12 +1047,14 @@ void G_DeathMatchSpawnPlayer(int playerNum) Con_Error("G_DeathMatchSpawnPlayer: Error, minimum of two " "(deathmatch) mapspots required for deathmatch."); - for(i = 0; i < 20; ++i) +#define NUM_TRIES 20 + for(i = 0; i < NUM_TRIES; ++i) { const playerstart_t* start = &deathmatchStarts[P_Random() % numPlayerDMStarts]; - if(P_CheckSpot(start->pos[VX], start->pos[VY])) + // Last attempt will succeed even though blocked. + if(P_CheckSpot(start->pos[VX], start->pos[VY]) || i == NUM_TRIES-1) { spawnPlayer(playerNum, pClass, start->pos[VX], start->pos[VY], start->pos[VZ], start->angle, start->spawnFlags, false, @@ -1060,9 +1062,6 @@ void G_DeathMatchSpawnPlayer(int playerNum) return; } } - - Con_Error("G_DeathMatchSpawnPlayer: Failed to spawn player %i.", - playerNum); } typedef struct {