mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
[gamecode] Make edict macros more robust to null
A null edict pointer should product a null entity, not a segfault.
This commit is contained in:
parent
f94d5e9fdb
commit
529253e6d9
1 changed files with 3 additions and 3 deletions
|
@ -352,10 +352,10 @@ void ED_EntityParseFunction (progs_t *pr);
|
|||
|
||||
#define PR_edicts(p) (*(p)->pr_edicts)
|
||||
|
||||
#define NEXT_EDICT(p,e) ((e) + 1)
|
||||
#define EDICT_TO_PROG(p,e) ((e)->entnum * (p)->pr_edict_size)
|
||||
#define NEXT_EDICT(p,e) ((e) ? (e) + 1 : 0)
|
||||
#define EDICT_TO_PROG(p,e) ((e) ? (e)->entnum * (p)->pr_edict_size : 0)
|
||||
#define PROG_TO_EDICT(p,e) (&PR_edicts(p)[(e) / (p)->pr_edict_size])
|
||||
#define NUM_FOR_BAD_EDICT(p,e) ((e)->entnum)
|
||||
#define NUM_FOR_BAD_EDICT(p,e) ((e) ? (e)->entnum : 0)
|
||||
#ifndef PR_PARANOID_PROGS
|
||||
# define EDICT_NUM(p,n) (PR_edicts (p) + (n))
|
||||
# define NUM_FOR_EDICT(p,e) NUM_FOR_BAD_EDICT ((p), (e))
|
||||
|
|
Loading…
Reference in a new issue