engine: server: remove MAP_HAS_SPAWNPOINT checks
This commit is contained in:
parent
13a063bf7d
commit
156b2b2b10
4 changed files with 20 additions and 66 deletions
|
@ -44,7 +44,6 @@ extern int SV_UPDATE_BACKUP;
|
||||||
|
|
||||||
// mapvalid flags
|
// mapvalid flags
|
||||||
#define MAP_IS_EXIST BIT( 0 )
|
#define MAP_IS_EXIST BIT( 0 )
|
||||||
#define MAP_HAS_SPAWNPOINT BIT( 1 )
|
|
||||||
#define MAP_HAS_LANDMARK BIT( 2 )
|
#define MAP_HAS_LANDMARK BIT( 2 )
|
||||||
#define MAP_INVALID_VERSION BIT( 3 )
|
#define MAP_INVALID_VERSION BIT( 3 )
|
||||||
|
|
||||||
|
@ -615,7 +614,7 @@ void SV_SetStringArrayMode( qboolean dynamic );
|
||||||
void SV_EmptyStringPool( void );
|
void SV_EmptyStringPool( void );
|
||||||
void SV_PrintStr64Stats_f( void );
|
void SV_PrintStr64Stats_f( void );
|
||||||
sv_client_t *SV_ClientFromEdict( const edict_t *pEdict, qboolean spawned_only );
|
sv_client_t *SV_ClientFromEdict( const edict_t *pEdict, qboolean spawned_only );
|
||||||
uint SV_MapIsValid( const char *filename, const char *spawn_entity, const char *landmark_name );
|
uint SV_MapIsValid( const char *filename, const char *landmark_name );
|
||||||
void SV_StartSound( edict_t *ent, int chan, const char *sample, float vol, float attn, int flags, int pitch );
|
void SV_StartSound( edict_t *ent, int chan, const char *sample, float vol, float attn, int flags, int pitch );
|
||||||
edict_t *SV_FindGlobalEntity( string_t classname, string_t globalname );
|
edict_t *SV_FindGlobalEntity( string_t classname, string_t globalname );
|
||||||
qboolean SV_CreateStaticEntity( struct sizebuf_s *msg, int index );
|
qboolean SV_CreateStaticEntity( struct sizebuf_s *msg, int index );
|
||||||
|
|
|
@ -169,17 +169,11 @@ SV_ValidateMap
|
||||||
check map for typically errors
|
check map for typically errors
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static qboolean SV_ValidateMap( const char *pMapName, qboolean check_spawn )
|
static qboolean SV_ValidateMap( const char *pMapName )
|
||||||
{
|
{
|
||||||
char *spawn_entity;
|
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
// determine spawn entity classname
|
flags = SV_MapIsValid( pMapName, NULL );
|
||||||
if( !check_spawn || (int)sv_maxclients.value <= 1 )
|
|
||||||
spawn_entity = GI->sp_entity;
|
|
||||||
else spawn_entity = GI->mp_entity;
|
|
||||||
|
|
||||||
flags = SV_MapIsValid( pMapName, spawn_entity, NULL );
|
|
||||||
|
|
||||||
if( FBitSet( flags, MAP_INVALID_VERSION ))
|
if( FBitSet( flags, MAP_INVALID_VERSION ))
|
||||||
{
|
{
|
||||||
|
@ -193,12 +187,6 @@ static qboolean SV_ValidateMap( const char *pMapName, qboolean check_spawn )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( check_spawn && !FBitSet( flags, MAP_HAS_SPAWNPOINT ))
|
|
||||||
{
|
|
||||||
Con_Printf( S_ERROR "map %s doesn't have a valid spawnpoint\n", pMapName );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +212,7 @@ static void SV_Map_f( void )
|
||||||
Q_strncpy( mapname, Cmd_Argv( 1 ), sizeof( mapname ));
|
Q_strncpy( mapname, Cmd_Argv( 1 ), sizeof( mapname ));
|
||||||
COM_StripExtension( mapname );
|
COM_StripExtension( mapname );
|
||||||
|
|
||||||
if( !SV_ValidateMap( mapname, true ))
|
if( !SV_ValidateMap( mapname ))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Cvar_DirectSet( &sv_hostmap, mapname );
|
Cvar_DirectSet( &sv_hostmap, mapname );
|
||||||
|
@ -296,7 +284,7 @@ static void SV_MapBackground_f( void )
|
||||||
Q_strncpy( mapname, Cmd_Argv( 1 ), sizeof( mapname ));
|
Q_strncpy( mapname, Cmd_Argv( 1 ), sizeof( mapname ));
|
||||||
COM_StripExtension( mapname );
|
COM_StripExtension( mapname );
|
||||||
|
|
||||||
if( !SV_ValidateMap( mapname, false ))
|
if( !SV_ValidateMap( mapname ))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// background map is always run as singleplayer
|
// background map is always run as singleplayer
|
||||||
|
@ -346,7 +334,7 @@ static void SV_NextMap_f( void )
|
||||||
Cvar_DirectSet( &sv_hostmap, nextmap );
|
Cvar_DirectSet( &sv_hostmap, nextmap );
|
||||||
|
|
||||||
// found current point, check for valid
|
// found current point, check for valid
|
||||||
if( SV_ValidateMap( nextmap, true ))
|
if( SV_ValidateMap( nextmap ))
|
||||||
{
|
{
|
||||||
// found and valid
|
// found and valid
|
||||||
COM_LoadLevel( nextmap, false );
|
COM_LoadLevel( nextmap, false );
|
||||||
|
|
|
@ -777,7 +777,6 @@ void SV_QueueChangeLevel( const char *level, const char *landname )
|
||||||
{
|
{
|
||||||
uint flags, smooth = false;
|
uint flags, smooth = false;
|
||||||
char mapname[MAX_QPATH];
|
char mapname[MAX_QPATH];
|
||||||
char *spawn_entity;
|
|
||||||
|
|
||||||
// hold mapname to other place
|
// hold mapname to other place
|
||||||
Q_strncpy( mapname, level, sizeof( mapname ));
|
Q_strncpy( mapname, level, sizeof( mapname ));
|
||||||
|
@ -786,12 +785,7 @@ void SV_QueueChangeLevel( const char *level, const char *landname )
|
||||||
if( COM_CheckString( landname ))
|
if( COM_CheckString( landname ))
|
||||||
smooth = true;
|
smooth = true;
|
||||||
|
|
||||||
// determine spawn entity classname
|
flags = SV_MapIsValid( mapname, landname );
|
||||||
if( svs.maxclients == 1 )
|
|
||||||
spawn_entity = GI->sp_entity;
|
|
||||||
else spawn_entity = GI->mp_entity;
|
|
||||||
|
|
||||||
flags = SV_MapIsValid( mapname, spawn_entity, landname );
|
|
||||||
|
|
||||||
if( FBitSet( flags, MAP_INVALID_VERSION ))
|
if( FBitSet( flags, MAP_INVALID_VERSION ))
|
||||||
{
|
{
|
||||||
|
@ -825,15 +819,6 @@ void SV_QueueChangeLevel( const char *level, const char *landname )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !smooth && !FBitSet( flags, MAP_HAS_SPAWNPOINT ))
|
|
||||||
{
|
|
||||||
if( sv_validate_changelevel.value )
|
|
||||||
{
|
|
||||||
Con_Printf( S_ERROR "changelevel: %s doesn't have a valid spawnpoint. Ignored.\n", mapname );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// bad changelevel position invoke enables in one-way transition
|
// bad changelevel position invoke enables in one-way transition
|
||||||
if( sv.framecount < 15 )
|
if( sv.framecount < 15 )
|
||||||
{
|
{
|
||||||
|
@ -972,7 +957,7 @@ SV_MapIsValid
|
||||||
Validate map
|
Validate map
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
uint SV_MapIsValid( const char *filename, const char *spawn_entity, const char *landmark_name )
|
uint SV_MapIsValid( const char *filename, const char *landmark_name )
|
||||||
{
|
{
|
||||||
uint flags = 0;
|
uint flags = 0;
|
||||||
char *pfile;
|
char *pfile;
|
||||||
|
@ -988,44 +973,26 @@ uint SV_MapIsValid( const char *filename, const char *spawn_entity, const char *
|
||||||
|
|
||||||
need_landmark = COM_CheckString( landmark_name );
|
need_landmark = COM_CheckString( landmark_name );
|
||||||
|
|
||||||
// g-cont. in-dev mode we can entering on map even without "info_player_start"
|
if( !need_landmark )
|
||||||
if( !need_landmark && host_developer.value )
|
|
||||||
{
|
{
|
||||||
// not transition
|
|
||||||
Mem_Free( ents );
|
Mem_Free( ents );
|
||||||
|
|
||||||
// skip spawnpoint checks in devmode
|
return flags;
|
||||||
return (flags|MAP_HAS_SPAWNPOINT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pfile = ents;
|
pfile = ents;
|
||||||
|
|
||||||
while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL )
|
while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL )
|
||||||
{
|
{
|
||||||
if( !Q_strcmp( token, "classname" ))
|
if( !Q_strcmp( token, "targetname" ))
|
||||||
{
|
|
||||||
// check classname for spawn entity
|
|
||||||
pfile = COM_ParseFile( pfile, check_name, sizeof( check_name ));
|
|
||||||
if( !Q_strcmp( spawn_entity, check_name ))
|
|
||||||
{
|
|
||||||
SetBits( flags, MAP_HAS_SPAWNPOINT );
|
|
||||||
|
|
||||||
// we already find landmark, stop the parsing
|
|
||||||
if( need_landmark && FBitSet( flags, MAP_HAS_LANDMARK ))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( need_landmark && !Q_strcmp( token, "targetname" ))
|
|
||||||
{
|
{
|
||||||
// check targetname for landmark entity
|
// check targetname for landmark entity
|
||||||
pfile = COM_ParseFile( pfile, check_name, sizeof( check_name ));
|
pfile = COM_ParseFile( pfile, check_name, sizeof( check_name ));
|
||||||
|
|
||||||
if( !Q_strcmp( landmark_name, check_name ))
|
if( !Q_strcmp( landmark_name, check_name ))
|
||||||
{
|
{
|
||||||
|
// we found landmark, stop the parsing
|
||||||
SetBits( flags, MAP_HAS_LANDMARK );
|
SetBits( flags, MAP_HAS_LANDMARK );
|
||||||
|
|
||||||
// we already find spawnpoint, stop the parsing
|
|
||||||
if( FBitSet( flags, MAP_HAS_SPAWNPOINT ))
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3740,9 +3707,9 @@ vaild map must contain one info_player_deatchmatch
|
||||||
*/
|
*/
|
||||||
int GAME_EXPORT pfnIsMapValid( char *filename )
|
int GAME_EXPORT pfnIsMapValid( char *filename )
|
||||||
{
|
{
|
||||||
uint flags = SV_MapIsValid( filename, GI->mp_entity, NULL );
|
uint flags = SV_MapIsValid( filename, NULL );
|
||||||
|
|
||||||
if( FBitSet( flags, MAP_IS_EXIST ) && FBitSet( flags, MAP_HAS_SPAWNPOINT ))
|
if( FBitSet( flags, MAP_IS_EXIST ))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2110,7 +2110,7 @@ qboolean SV_LoadGame( const char *pPath )
|
||||||
if( validload )
|
if( validload )
|
||||||
{
|
{
|
||||||
// now check for map problems
|
// now check for map problems
|
||||||
flags = SV_MapIsValid( gameHeader.mapName, GI->sp_entity, NULL );
|
flags = SV_MapIsValid( gameHeader.mapName, NULL );
|
||||||
|
|
||||||
if( FBitSet( flags, MAP_INVALID_VERSION ))
|
if( FBitSet( flags, MAP_INVALID_VERSION ))
|
||||||
{
|
{
|
||||||
|
@ -2386,7 +2386,7 @@ int GAME_EXPORT SV_GetSaveComment( const char *savename, char *comment )
|
||||||
uint flags;
|
uint flags;
|
||||||
|
|
||||||
// now check for map problems
|
// now check for map problems
|
||||||
flags = SV_MapIsValid( mapName, GI->sp_entity, NULL );
|
flags = SV_MapIsValid( mapName, NULL );
|
||||||
|
|
||||||
if( FBitSet( flags, MAP_INVALID_VERSION ))
|
if( FBitSet( flags, MAP_INVALID_VERSION ))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue