mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-27 06:34:11 +00:00
define G_POINTER convenince macro. null progs pointers will be null in C
redefine G_STRUCT to use G_POINTER
This commit is contained in:
parent
ea36fceec5
commit
dc3f106faf
1 changed files with 8 additions and 1 deletions
|
@ -136,7 +136,8 @@ int NUM_FOR_BAD_EDICT(progs_t *pr, edict_t *e);
|
||||||
#define G_VECTOR(p,o) G_var (p, o, vector)
|
#define G_VECTOR(p,o) G_var (p, o, vector)
|
||||||
#define G_STRING(p,o) PR_GetString (p, G_var (p, o, string))
|
#define G_STRING(p,o) PR_GetString (p, G_var (p, o, string))
|
||||||
#define G_FUNCTION(p,o) G_var (p, o, func)
|
#define G_FUNCTION(p,o) G_var (p, o, func)
|
||||||
#define G_STRUCT(p,t,o) (*(t *)&(p)->pr_globals[o])
|
#define G_POINTER(p,o) PR_Pointer (p, o)
|
||||||
|
#define G_STRUCT(p,t,o) (*(t *)G_POINTER (p, o))
|
||||||
|
|
||||||
#define RETURN_STRING(p, s) ((p)->pr_globals[OFS_RETURN].integer_var = PR_SetString((p), s))
|
#define RETURN_STRING(p, s) ((p)->pr_globals[OFS_RETURN].integer_var = PR_SetString((p), s))
|
||||||
#define RETURN_EDICT(p, e) ((p)->pr_globals[OFS_RETURN].integer_var = EDICT_TO_PROG(p, e))
|
#define RETURN_EDICT(p, e) ((p)->pr_globals[OFS_RETURN].integer_var = EDICT_TO_PROG(p, e))
|
||||||
|
@ -355,4 +356,10 @@ struct progs_s {
|
||||||
} fields;
|
} fields;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline pr_type_t *
|
||||||
|
PR_Pointer (progs_t *pr, int o)
|
||||||
|
{
|
||||||
|
return o ? pr->pr_globals + o : 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif//__QF_progs_h
|
#endif//__QF_progs_h
|
||||||
|
|
Loading…
Reference in a new issue