[ioquake3] 87/136: Fix spawn/freed entity logic (specifically harvester skulls)

Simon McVittie smcv at debian.org
Thu Jun 15 09:09:13 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian/master
in repository ioquake3.

commit 4006358492b800db0602ed0eca600166caec22e4
Author: Zack Middleton <zack at cloemail.com>
Date:   Fri Jun 2 21:31:38 2017 -0500

    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.
---
 code/game/g_utils.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

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

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/ioquake3.git



More information about the Pkg-games-commits mailing list