commit 07e79a0822fcb986f5734a11f878fd6b3517e910 Author: devhc Date: Fri May 13 23:35:57 2011 +0200 ensure that ent->classname is always non-null (for entity numbers up to level.num_entities-1, and ENTITYNUM_WORLD, and ENTITYNUM_NONE), for player entities and #ENTITYNUM_NONE in particular diff --git a/src/game/g_main.c b/src/game/g_main.c index 507a5d6..5d42930 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -622,6 +622,9 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) // range are NEVER anything but clients level.num_entities = MAX_CLIENTS; + for( i = 0; i < MAX_CLIENTS; i++ ) + g_entities[ i ].classname = "clientslot"; + // let the server system know where the entites are trap_LocateGameData( level.gentities, level.num_entities, sizeof( gentity_t ), &level.clients[ 0 ].ps, sizeof( level.clients[ 0 ] ) ); diff --git a/src/game/g_spawn.c b/src/game/g_spawn.c index bdb5ff7..b249a10 100644 --- a/src/game/g_spawn.c +++ b/src/game/g_spawn.c @@ -600,8 +600,13 @@ void SP_worldspawn( void ) trap_Cvar_Set( "g_disabledBuildables", s ); g_entities[ ENTITYNUM_WORLD ].s.number = ENTITYNUM_WORLD; + g_entities[ ENTITYNUM_WORLD ].r.ownerNum = ENTITYNUM_NONE; g_entities[ ENTITYNUM_WORLD ].classname = "worldspawn"; + g_entities[ ENTITYNUM_NONE ].s.number = ENTITYNUM_NONE; + g_entities[ ENTITYNUM_NONE ].r.ownerNum = ENTITYNUM_NONE; + g_entities[ ENTITYNUM_NONE ].classname = "nothing"; + if( g_restarted.integer ) trap_Cvar_Set( "g_restarted", "0" );