remove the time pointer (not really needed)

This is an imperfect revision of history.
This commit is contained in:
Bill Currie 2004-11-09 22:32:00 +00:00 committed by Jeff Teunissen
parent f577eba1ab
commit 78d98ea787
7 changed files with 9 additions and 10 deletions

View file

@ -1217,8 +1217,6 @@ struct progs_s {
int localstack[LOCALSTACK_SIZE];
int localstack_used;
double *time;
pr_resource_t *resources;
struct hashtab_s *resource_hash;

View file

@ -90,11 +90,13 @@ ED_Alloc (progs_t *pr)
int start = pr->reserved_edicts ? *pr->reserved_edicts : 0;
int max_edicts = pr->pr_edictareasize / pr->pr_edict_size;
for (i = start + 1; i < *(pr)->num_edicts; i++) {
for (i = start + 1; i < *pr->num_edicts; i++) {
e = EDICT_NUM (pr, i);
// the first couple seconds of server time can involve a lot of
// freeing and allocating, so relax the replacement policy
if (e->free && (e->freetime < 2 || *(pr)->time - e->freetime > 0.5)) {
if (e->free && (!pr->globals.time
|| e->freetime < 2
|| *pr->globals.time - e->freetime > 0.5)) {
ED_ClearEdict (pr, e, 0);
return e;
}
@ -135,7 +137,8 @@ ED_Free (progs_t *pr, edict_t *ed)
ED_ClearEdict (pr, ed, 0);
}
ed->free = true;
ed->freetime = *(pr)->time;
if (pr->globals.time)
ed->freetime = *pr->globals.time;
}
//===========================================================================
@ -198,7 +201,7 @@ ED_Count (progs_t *pr)
for (i = 0; i < *(pr)->num_edicts; i++) {
ent = EDICT_NUM (pr, i);
if (ent->free) {
if (*(pr)->time - ent->freetime <= 0.5)
if (pr->globals.time && *pr->globals.time - ent->freetime <= 0.5)
zombie++;
continue;
}

View file

@ -431,8 +431,6 @@ ED_ParseOld (progs_t *pr, const char *data)
pr_type_t *classname;
ddef_t *def;
*pr->globals.time = *(pr)->time;
while (1) { // parse ents
// parse the opening brace
data = COM_Parse (data);

View file

@ -1011,6 +1011,7 @@ SV_SpawnServer (const char *server)
// serverflags are for cross level information (sigils)
*sv_globals.serverflags = svs.serverflags;
*sv_globals.time = sv.time;
if ((buf = QFS_LoadFile (va ("maps/%s.ent", server), 0))) {
ED_LoadFromFile (&sv_pr_state, buf);
free (buf);

View file

@ -493,7 +493,6 @@ SV_Progs_Init (void)
{
sv_pr_state.edicts = &sv.edicts;
sv_pr_state.num_edicts = &sv.num_edicts;
sv_pr_state.time = &sv.time;
sv_pr_state.reserved_edicts = &svs.maxclients;
sv_pr_state.unlink = SV_UnlinkEdict;
sv_pr_state.parse_field = parse_field;

View file

@ -413,6 +413,7 @@ SV_SpawnServer (const char *server)
SV_ProgStartFrame ();
// load and spawn all other entities
*sv_globals.time = sv.time;
if ((buf = QFS_LoadFile (va ("maps/%s.ent", server), 0))) {
ED_LoadFromFile (&sv_pr_state, buf);
free (buf);

View file

@ -501,7 +501,6 @@ SV_Progs_Init (void)
pr_gametype = "quakeworld";
sv_pr_state.edicts = &sv.edicts;
sv_pr_state.num_edicts = &sv.num_edicts;
sv_pr_state.time = &sv.time;
sv_pr_state.reserved_edicts = &reserved_edicts;
sv_pr_state.unlink = SV_UnlinkEdict;
sv_pr_state.flush = SV_FlushSignon;