mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 12:52:46 +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 PR_edicts(p) (*(p)->pr_edicts)
|
||||||
|
|
||||||
#define NEXT_EDICT(p,e) ((e) + 1)
|
#define NEXT_EDICT(p,e) ((e) ? (e) + 1 : 0)
|
||||||
#define EDICT_TO_PROG(p,e) ((e)->entnum * (p)->pr_edict_size)
|
#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 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
|
#ifndef PR_PARANOID_PROGS
|
||||||
# define EDICT_NUM(p,n) (PR_edicts (p) + (n))
|
# define EDICT_NUM(p,n) (PR_edicts (p) + (n))
|
||||||
# define NUM_FOR_EDICT(p,e) NUM_FOR_BAD_EDICT ((p), (e))
|
# define NUM_FOR_EDICT(p,e) NUM_FOR_BAD_EDICT ((p), (e))
|
||||||
|
|
Loading…
Reference in a new issue