Fix spawn/freed entity logic (specifically harvester skulls)

- Actually use the second 'force' pass in G_Spawn when out of
available slots.
- Make G_EntitiesFree return qtrue if we can open a new slot.
(Only used when spawning Harvester skulls.)

Fixes not spawning Harvester skulls when there are no 'open freed
slots', but we have other slots available to open.
This commit is contained in:
Zack Middleton 2017-06-02 21:31:38 -05:00
parent 4227d97958
commit 4006358492
1 changed files with 7 additions and 2 deletions

View File

@ -411,11 +411,11 @@ gentity_t *G_Spawn( void ) {
G_InitGentity( e ); G_InitGentity( e );
return e; return e;
} }
if ( i != MAX_GENTITIES ) { if ( level.num_entities < ENTITYNUM_MAX_NORMAL ) {
break; break;
} }
} }
if ( i == ENTITYNUM_MAX_NORMAL ) { if ( level.num_entities == ENTITYNUM_MAX_NORMAL ) {
for (i = 0; i < MAX_GENTITIES; i++) { for (i = 0; i < MAX_GENTITIES; i++) {
G_Printf("%4i: %s\n", i, g_entities[i].classname); G_Printf("%4i: %s\n", i, g_entities[i].classname);
} }
@ -442,6 +442,11 @@ qboolean G_EntitiesFree( void ) {
int i; int i;
gentity_t *e; gentity_t *e;
if ( level.num_entities < ENTITYNUM_MAX_NORMAL ) {
// can open a new slot if needed
return qtrue;
}
e = &g_entities[MAX_CLIENTS]; e = &g_entities[MAX_CLIENTS];
for ( i = MAX_CLIENTS; i < level.num_entities; i++, e++) { for ( i = MAX_CLIENTS; i < level.num_entities; i++, e++) {
if ( e->inuse ) { if ( e->inuse ) {