aboutsummaryrefslogtreecommitdiff
path: root/src/unit
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2022-02-08 15:39:56 +0100
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2022-03-30 08:20:21 +0200
commit98f0d3e026f978d556cc91cfaa815d92a0b182c8 (patch)
treebd9f39354da8fcbed0453bf45152c39e803abbf6 /src/unit
parent56286a0a962119ddebf26df58d4a7c5d2f6a3fc7 (diff)
downloadjancity-98f0d3e026f978d556cc91cfaa815d92a0b182c8.tar.gz
Replace x_get functions with macros
The PS1 port relies on a heap for primitives since the GPU renders the scene asynchronously. However, SDL-based platforms render primitives synchronously, so structures can be allocated on the stack instead.
Diffstat (limited to 'src/unit')
-rw-r--r--src/unit/src/unit.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/unit/src/unit.c b/src/unit/src/unit.c
index bb8e243..8d208a1 100644
--- a/src/unit/src/unit.c
+++ b/src/unit/src/unit.c
@@ -561,11 +561,6 @@ static int unit_quad(const struct unit *const u, struct render_cfg *const rcfg)
{
struct instance_render_quad *const qcfg = &rcfg->qcfg;
- qcfg->q = quad_get();
-
- if (!qcfg->q)
- return -1;
-
static anim_dim *(*const f[])(const struct unit *) =
{
[UNIT_TYPE_PEASANT] = peasant_quad
@@ -594,6 +589,9 @@ int unit_render(const struct unit *const u, const struct camera *const cam,
struct render_cfg rcfg;
+ quad_get_or_ret(q, -1);
+ rcfg.qcfg.q = q;
+
if (unit_quad(u, &rcfg))
return -1;