From 78d98ea7872873ed02efc575ad74f9b8cd1bb810 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 9 Nov 2004 22:32:00 +0000 Subject: [PATCH] remove the time pointer (not really needed) This is an imperfect revision of history. --- include/QF/progs.h | 2 -- libs/gamecode/engine/pr_edict.c | 11 +++++++---- libs/gamecode/engine/pr_parse.c | 2 -- nq/source/sv_main.c | 1 + nq/source/sv_progs.c | 1 - qw/source/sv_init.c | 1 + qw/source/sv_progs.c | 1 - 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/include/QF/progs.h b/include/QF/progs.h index f6284eb87..10c8cb3d9 100644 --- a/include/QF/progs.h +++ b/include/QF/progs.h @@ -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; diff --git a/libs/gamecode/engine/pr_edict.c b/libs/gamecode/engine/pr_edict.c index 8f23139d6..5e03e1136 100644 --- a/libs/gamecode/engine/pr_edict.c +++ b/libs/gamecode/engine/pr_edict.c @@ -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; } diff --git a/libs/gamecode/engine/pr_parse.c b/libs/gamecode/engine/pr_parse.c index b675c56d4..b8668a5dd 100644 --- a/libs/gamecode/engine/pr_parse.c +++ b/libs/gamecode/engine/pr_parse.c @@ -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); diff --git a/nq/source/sv_main.c b/nq/source/sv_main.c index 95dd6ce04..597d1071e 100644 --- a/nq/source/sv_main.c +++ b/nq/source/sv_main.c @@ -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); diff --git a/nq/source/sv_progs.c b/nq/source/sv_progs.c index b24453a73..65568603f 100644 --- a/nq/source/sv_progs.c +++ b/nq/source/sv_progs.c @@ -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; diff --git a/qw/source/sv_init.c b/qw/source/sv_init.c index ce5f751fe..7676ae52e 100644 --- a/qw/source/sv_init.c +++ b/qw/source/sv_init.c @@ -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); diff --git a/qw/source/sv_progs.c b/qw/source/sv_progs.c index 84b460def..43302fe66 100644 --- a/qw/source/sv_progs.c +++ b/qw/source/sv_progs.c @@ -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;