Made things more robust (particuarly with respect to cmd observe)

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@386 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2004-10-29 06:11:33 +00:00
parent cd9c6d7811
commit eb4b6fff0f

View file

@ -902,6 +902,7 @@ void SV_PreSpawn_f (void)
}
}
static void SetUpClientEdict (client_t *cl, edict_t *ent);
/*
==================
SV_Spawn_f
@ -909,7 +910,6 @@ SV_Spawn_f
*/
void SV_Spawn_f (void)
{
extern int pr_teamfield;
int i;
client_t *client, *split;
edict_t *ent;
@ -980,16 +980,7 @@ void SV_Spawn_f (void)
}
else
{
memset (&ent->v, 0, pr_edict_size-svprogparms.edictsize);
ED_Spawned(ent);
ent->v.colormap = NUM_FOR_EDICT(svprogfuncs, ent);
ent->v.team = 0; // FIXME
ent->v.netname = PR_SetString(svprogfuncs, split->name);
if (pr_teamfield)
((int *)&ent->v)[pr_teamfield] = (int)PR_SetString(svprogfuncs, split->team);
split->entgravity = ent->v.gravity = 1.0;
split->maxspeed = ent->v.maxspeed = sv_maxspeed.value;
SetUpClientEdict(split, ent);
}
//
@ -2393,12 +2384,18 @@ void Cmd_SetPos_f(void)
void ED_ClearEdict (progfuncs_t *progfuncs, edict_t *e);
static void SetUpClientEdict (client_t *cl, edict_t *ent)
{
extern int pr_teamfield;
ED_ClearEdict(svprogfuncs, ent);
ED_Spawned(ent);
ent->isfree = false;
ent->v.colormap = NUM_FOR_EDICT(svprogfuncs, ent);
ent->v.netname = PR_SetString(svprogfuncs, cl->name);
if (pr_teamfield)
((int *)&ent->v)[pr_teamfield] = (int)PR_SetString(svprogfuncs, cl->team);
ent->v.gravity = cl->entgravity = 1.0;
ent->v.maxspeed = cl->maxspeed = sv_maxspeed.value;
ent->v.movetype = MOVETYPE_NOCLIP;