From fa063e97106397fdab4bc0c8e942cc7617f79070 Mon Sep 17 00:00:00 2001 From: BjossiAlfreds Date: Sat, 14 Sep 2019 11:59:06 +0000 Subject: [PATCH] Killtarget teamchain cleanup crash fix --- src/g_utils.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/g_utils.c b/src/g_utils.c index 11d11f5..6a6c7f9 100644 --- a/src/g_utils.c +++ b/src/g_utils.c @@ -269,7 +269,6 @@ G_UseTargets(edict_t *ent, edict_t *activator) { edict_t *t; edict_t *master; - qboolean done = false; if (!ent || !activator) { @@ -322,20 +321,17 @@ G_UseTargets(edict_t *ent, edict_t *activator) /* if this entity is part of a train, cleanly remove it */ if (t->flags & FL_TEAMSLAVE) { - if (t->teammaster) + master = t->teammaster; + + while (master) { - master = t->teammaster; - - while (!done) + if (master->teamchain == t) { - if (master->teamchain == t) - { - master->teamchain = t->teamchain; - done = true; - } - - master = master->teamchain; + master->teamchain = t->teamchain; + break; } + + master = master->teamchain; } }