Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
lazy.qh
Go to the documentation of this file.
1#pragma once
2
3#include "oo.qh"
4
5// Only creates entities when they're needed (.m_get)
6
8 ATTRIB(Lazy, m_get, entity());
9 CONSTRUCTOR(Lazy, entity() _compute)
10 {
11 this.m_get = _compute;
12 }
14
15#define LAZY(id) __lazy_##id
16#define LAZY_NEW(id, compute) \
17 entity LAZY(id)() \
18 { \
19 static bool done; \
20 static entity it; \
21 if (!done) \
22 { \
23 it = compute; \
24 done = true; \
25 } \
26 return it; \
27 }
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
Definition lazy.qh:7
ATTRIB(Lazy, m_get, entity())
Lazy(entity() _compute)
Definition lazy.qh:9
#define CLASS(...)
Definition oo.qh:149
#define ENDCLASS(cname)
Definition oo.qh:286
#define CONSTRUCTOR(cname,...)
Definition oo.qh:217