diff options
author | /dev/humancontroller <devhc@example.com> | 2014-07-13 16:54:02 +0200 |
---|---|---|
committer | /dev/humancontroller <devhc@example.com> | 2017-03-09 13:51:10 +0100 |
commit | 293969ceba8548db4f26807a5727aac916f1b774 (patch) | |
tree | 0e5196e07d9ffb5b301c916aec9f22b5ce856ead | |
parent | 26679919179daee5a72c1cd900d54338b5d72efe (diff) |
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
-rw-r--r-- | src/game/g_main.c | 3 | ||||
-rw-r--r-- | src/game/g_spawn.c | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/game/g_main.c b/src/game/g_main.c index efc33a1d..d0e687a8 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -616,6 +616,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 bc42da6d..d7ed7216 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" ); |