num = NUM_FOR_EDICT(e) - 1;
if (num >= 0 && num < svs.maxclients)
{
+ eval_t *val;
+ // set colormap and team on newly created player entity
e->v->colormap = num + 1;
e->v->team = (svs.clients[num].colors & 15) + 1;
+ // set netname/clientcolors back to client values so that
+ // DP_SV_CLIENTNAME and DPV_SV_CLIENTCOLORS will not immediately
+ // reset them
e->v->netname = PR_SetString(svs.clients[num].name);
+ if ((val = GETEDICTFIELDVALUE(e, eval_clientcolors)))
+ val->_float = svs.clients[num].colors;
}
}
switch (type)
{
case ev_string:
- strncpy(line, PR_GetString(val->string), sizeof(line));
+ strlcpy (line, PR_GetString (val->string), sizeof (line));
break;
case ev_entity:
//n = NoCrash_NUM_FOR_EDICT(PROG_TO_EDICT(val->edict));
break;
case ev_function:
f = pr_functions + val->function;
- strncpy(line, PR_GetString(f->s_name), sizeof(line));
+ strlcpy (line, PR_GetString (f->s_name), sizeof (line));
break;
case ev_field:
def = ED_FieldAtOfs ( val->_int );
if (strlen(name) > 256)
{
- strncpy(tempstring2, name, 256);
+ memcpy (tempstring2, name, 256);
tempstring2[256] = tempstring2[257] = tempstring2[258] = '.';
tempstring2[259] = 0;
name = tempstring2;
name = PR_ValueString(d->type, (eval_t *)v);
if (strlen(name) > 256)
{
- strncpy(tempstring2, name, 256);
+ memcpy(tempstring2, name, 256);
tempstring2[256] = tempstring2[257] = tempstring2[258] = '.';
tempstring2[259] = 0;
name = tempstring2;
{
while (*s && *s <= ' ')
s++;
- if (!*s)
- break;
- val->vector[i] = atof(s);
+ if (*s)
+ val->vector[i] = atof(s);
+ else
+ val->vector[i] = 0;
while (*s > ' ')
s++;
- if (!*s)
- break;
}
break;
}
pr_global_struct->self = EDICT_TO_PROG(ent);
- PR_ExecuteProgram (func - pr_functions, "");
+ PR_ExecuteProgram (func - pr_functions, "QC function spawn is missing");
spawned++;
if (ent->e->free)
died++;
{ev_entity, "tag_entity"},
{ev_float, "tag_index"},
{ev_float, "light_lev"},
- {ev_float, "color"},
+ {ev_vector, "color"},
{ev_float, "style"},
{ev_float, "pflags"}
};
int i;
dstatement_t *st;
ddef_t *infielddefs;
- void *temp;
dfunction_t *dfunctions;
// flush the non-C variable lookup cache
Mem_EmptyPool(progs_mempool);
Mem_EmptyPool(edictstring_mempool);
- temp = FS_LoadFile ("progs.dat", false);
- if (!temp)
+ progs = (dprograms_t *)FS_LoadFile ("progs.dat", progs_mempool, false);
+ if (!progs)
Host_Error ("PR_LoadProgs: couldn't load progs.dat");
- progs = (dprograms_t *)Mem_Alloc(progs_mempool, fs_filesize);
-
- memcpy(progs, temp, fs_filesize);
- Mem_Free(temp);
-
Con_DPrintf("Programs occupy %iK.\n", fs_filesize/1024);
pr_crc = CRC_Block((qbyte *)progs, fs_filesize);
}
if (strlen(name) > 256)
{
- strncpy(tempstring2, name, 256);
+ memcpy(tempstring2, name, 256);
tempstring2[256] = tempstring2[257] = tempstring2[258] = '.';
tempstring2[259] = 0;
name = tempstring2;
Cvar_RegisterVariable (&pr_boundscheck);
Cvar_RegisterVariable (&pr_traceqc);
- progs_mempool = Mem_AllocPool("progs.dat");
- edictstring_mempool = Mem_AllocPool("edict strings");
+ progs_mempool = Mem_AllocPool("progs.dat", 0, NULL);
+ edictstring_mempool = Mem_AllocPool("edict strings", 0, NULL);
PR_Cmd_Init();
}