From 1d22a86161abe2e4ed3f1420e4dcde7193b8bee7 Mon Sep 17 00:00:00 2001
From: Spoike <acceptthis@users.sourceforge.net>
Date: Thu, 23 Mar 2006 18:41:31 +0000
Subject: [PATCH] Let the QC know which player the spectator is spectating over
 mapchanges.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2129 fc73d0e0-1445-4013-8a0c-d673dee63da5
---
 engine/server/sv_user.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c
index 20fe45679..2f5f068b8 100644
--- a/engine/server/sv_user.c
+++ b/engine/server/sv_user.c
@@ -1245,6 +1245,8 @@ void SV_Begin_f (void)
 		return;
 	}
 
+	host_client->edict->v->playerclass = host_client->playerclass;	//make sure it's set the same as the userinfo
+
 	for (split = host_client; split; split = split->controlled)
 	{
 #ifdef Q2SERVER
@@ -1277,6 +1279,13 @@ void SV_Begin_f (void)
 
 				if (SpectatorConnect)
 				{
+					//keep the spectator tracking the player from the previous map
+					if (split->spec_track > 0)
+						split->edict->v->goalentity = EDICT_TO_PROG(svprogfuncs, svs.clients[split->spec_track-1].edict);
+					else
+						split->edict->v->goalentity = 0;
+
+
 					// copy spawn parms out of the client_t
 					for (i=0 ; i< NUM_SPAWN_PARMS ; i++)
 					{
@@ -1365,7 +1374,6 @@ void SV_Begin_f (void)
 	host_client->netchan.good_count = 0;
 
 	//check he's not cheating
-
 	if (progstype == PROG_QW)
 	{
 		pmodel = atoi(Info_ValueForKey (host_client->userinfo, "pmodel"));