From f7ccc35e5d273e3515b8ec6679a0a4091ff2b9c7 Mon Sep 17 00:00:00 2001 From: havoc Date: Sun, 3 Feb 2008 12:42:04 +0000 Subject: [PATCH] revert my change and fix the types on Black's changes, which were the real problem (this revert only due to my change being slightly messier) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8068 d7cf8633-e32d-0410-b094-e92efae38249 --- csprogs.c | 4 +--- progsvm.h | 6 +++--- prvm_edict.c | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/csprogs.c b/csprogs.c index 0e5bba3e..c6b38b15 100644 --- a/csprogs.c +++ b/csprogs.c @@ -577,9 +577,7 @@ void CSQC_ReadEntities (void) // make sure no one gets wrong ideas prog->globals.client->self = 0; PRVM_ExecuteProgram(prog->funcoffsets.CSQC_Ent_Spawn, "QC function CSQC_Ent_Spawn is missing"); - entnum = PRVM_G_INT(OFS_RETURN); - PRVM_CHECKEDICTNUM(entnum); - cl.csqc_server2csqcentitynumber[realentnum] = entnum; + cl.csqc_server2csqcentitynumber[realentnum] = PRVM_EDICT( PRVM_G_INT( OFS_RETURN ) ); } } else { diff --git a/progsvm.h b/progsvm.h index e46eed01..2de5ca78 100644 --- a/progsvm.h +++ b/progsvm.h @@ -516,9 +516,9 @@ void PRVM_ED_ParseGlobals (const char *data); void PRVM_ED_LoadFromFile (const char *data); -prvm_edict_t *PRVM_EDICT_NUM_ERROR(unsigned int n, char *filename, int fileline); -#define PRVM_CHECKEDICTNUM(n) (((unsigned)(n) < (unsigned int)prog->max_edicts) ? NULL : PRVM_EDICT_NUM_ERROR((n), __FILE__, __LINE__)) -#define PRVM_EDICT_NUM(n) (PRVM_CHECKEDICTNUM(n), prog->edicts + (n)) +unsigned int PRVM_EDICT_NUM_ERROR(unsigned int n, char *filename, int fileline); +#define PRVM_EDICT(n) (((unsigned)(n) < (unsigned int)prog->max_edicts) ? (unsigned int)(n) : PRVM_EDICT_NUM_ERROR((unsigned int)(n), __FILE__, __LINE__)) +#define PRVM_EDICT_NUM(n) (prog->edicts + PRVM_EDICT(n)) //int NUM_FOR_EDICT_ERROR(prvm_edict_t *e); #define PRVM_NUM_FOR_EDICT(e) ((int)((prvm_edict_t *)(e) - prog->edicts)) diff --git a/prvm_edict.c b/prvm_edict.c index 08aca4e5..56f980f3 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -2107,10 +2107,10 @@ void _PRVM_FreeAll(const char *filename, int fileline) } // LordHavoc: turned PRVM_EDICT_NUM into a #define for speed reasons -prvm_edict_t *PRVM_EDICT_NUM_ERROR(unsigned int n, char *filename, int fileline) +unsigned int PRVM_EDICT_NUM_ERROR(unsigned int n, char *filename, int fileline) { PRVM_ERROR ("PRVM_EDICT_NUM: %s: bad number %i (called at %s:%i)", PRVM_NAME, n, filename, fileline); - return NULL; + return 0; } /* -- 2.39.2