Xonotic
lazy.qh
Go to the documentation of this file.
1
#pragma once
2
3
#include "
oo.qh
"
4
5
CLASS
(
Lazy
,
Object
)
6
ATTRIB
(
Lazy
, m_get,
entity
());
7
CONSTRUCTOR
(
Lazy
,
entity
() _compute)
8
{
9
this.m_get = _compute;
10
}
11
ENDCLASS
(
Lazy
)
12
13
#define LAZY(id) __lazy_##id
14
#define LAZY_NEW(id, compute) \
15
entity LAZY(id)() { \
16
static bool done; \
17
static entity it; \
18
if (!done) { it = compute; done = true; } \
19
return it; \
20
}
Object
CLASS
CLASS(Object) Object
Definition:
oo.qh:318
entity
entity() spawn
ATTRIB
#define ATTRIB(...)
Definition:
oo.qh:136
oo.qh
Lazy
Definition:
lazy.qh:5
ENDCLASS
#define ENDCLASS(cname)
Definition:
oo.qh:269
CONSTRUCTOR
#define CONSTRUCTOR(cname,...)
Definition:
oo.qh:201
lib
lazy.qh
Generated on Thu Mar 17 2022 17:26:29 for Xonotic by
1.8.13