From 1dac12d236353ad0e77a954ab4ca738f5c73aa5e Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Tue, 5 Aug 2003 01:06:57 +0000 Subject: * Added sanity checks to spawn code to (hopefully) prevent that "really bizarre bug" --- src/game/g_buildable.c | 6 ++++++ src/game/g_client.c | 6 ++++++ src/game/g_cmds.c | 16 +++++++++++++++- 3 files changed, 27 insertions(+), 1 deletion(-) (limited to 'src/game') diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index b3a7e5b4..3219734c 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -833,6 +833,12 @@ void ABooster_Touch( gentity_t *self, gentity_t *other, trace_t *trace ) int ammo, clips, maxClips; gclient_t *client = other->client; + if( !client ) + return; + + if( client && client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) + return; + //only allow boostage once every 30 seconds if( client->lastBoostedTime + BOOSTER_INTERVAL > level.time ) return; diff --git a/src/game/g_client.c b/src/game/g_client.c index 8e3fdaf1..a4d2684a 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -281,6 +281,9 @@ gentity_t *SelectAlienSpawnPoint( void ) trace_t tr; float displacement; + if( level.numAlienSpawns <= 0 ) + return NULL; + VectorSet( mins, -MAX_ALIEN_BBOX, -MAX_ALIEN_BBOX, -MAX_ALIEN_BBOX ); VectorSet( maxs, MAX_ALIEN_BBOX, MAX_ALIEN_BBOX, MAX_ALIEN_BBOX ); @@ -340,6 +343,9 @@ gentity_t *SelectHumanSpawnPoint( void ) gentity_t *ent; trace_t tr; + if( level.numHumanSpawns <= 0 ) + return NULL; + BG_FindBBoxForClass( PCL_H_BASE, mins, maxs, NULL, NULL, NULL ); count = 0; diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index cca0e673..532de22b 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1048,7 +1048,14 @@ void Cmd_Class_f( gentity_t *ent ) } else { - //spawing from a bioegg + //sanity check + if( level.numAlienSpawns <= 0 ) + { + trap_SendServerCommand( ent-g_entities, va( "print \"No suitable spawns available\n\"" ) ); + return; + } + + //spawing from an egg ent->client->pers.pclass = BG_FindClassNumForName( s ); if( ent->client->pers.pclass != PCL_NONE ) @@ -1077,6 +1084,13 @@ void Cmd_Class_f( gentity_t *ent ) } else if( ent->client->pers.pteam == PTE_HUMANS ) { + //sanity check + if( level.numHumanSpawns <= 0 ) + { + trap_SendServerCommand( ent-g_entities, va( "print \"No suitable spawns available\n\"" ) ); + return; + } + //humans cannot use this command whilst alive if( ent->client->ps.stats[ STAT_PCLASS ] != PCL_NONE ) { -- cgit