From 27553f8ed1d062c4d8175e7376f5b16cf2c8f9ef Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Sat, 27 Jan 2024 14:14:37 +0100 Subject: Remove stale unit and building types --- src/unit/inc/unit_type.h | 2 -- src/unit/src/unit.c | 28 ++++++++-------------------- 2 files changed, 8 insertions(+), 22 deletions(-) (limited to 'src/unit') diff --git a/src/unit/inc/unit_type.h b/src/unit/inc/unit_type.h index fddd5c9..f023784 100644 --- a/src/unit/inc/unit_type.h +++ b/src/unit/inc/unit_type.h @@ -3,8 +3,6 @@ enum unit_type { - UNIT_TYPE_PEASANT, - MAX_UNIT_TYPES }; diff --git a/src/unit/src/unit.c b/src/unit/src/unit.c index a95cca3..3333797 100644 --- a/src/unit/src/unit.c +++ b/src/unit/src/unit.c @@ -64,14 +64,7 @@ static void get_speed(const struct unit *const u, fix16_t *const x, static const struct speed { fix16_t x, y; - } speed[] = - { - [UNIT_TYPE_PEASANT] = - { - .x = FIX16_C_FROM_INT(1), - .y = FIX16_C_FROM_INT(1) - } - }; + } speed[1]; const struct speed *const s = &speed[u->type]; const int dx = abs(u->rx - u->tx); @@ -258,6 +251,7 @@ typedef const struct static anim_dim *peasant_anim(const struct unit *const u) { +#if 0 static anim_dim t[] = { { @@ -312,6 +306,9 @@ static anim_dim *peasant_anim(const struct unit *const u) return NULL; return &t[ux]; +#else + return NULL; +#endif } struct render_cfg @@ -367,10 +364,7 @@ static int unit_quad(const struct unit *const u, struct render_cfg *const rcfg) { struct instance_render_quad *const qcfg = &rcfg->qcfg; - static anim_dim *(*const f[])(const struct unit *) = - { - [UNIT_TYPE_PEASANT] = peasant_quad - }; + static anim_dim *(*const f[1])(const struct unit *); anim_dim *const dim = f[u->type](u); @@ -418,10 +412,7 @@ static void get_dimensions(const enum unit_type type, short *const w, static const struct dim { short w, h; - } dim[] = - { - [UNIT_TYPE_PEASANT] = {.w = 36, .h = 36} - }; + } dim[1]; const struct dim *const d = &dim[type]; *w = d->w; @@ -451,10 +442,7 @@ void unit_create(const struct unit_cfg *const cfg, struct unit *const u) const char *unit_str(const struct unit *const u) { - static const char *const str[] = - { - [UNIT_TYPE_PEASANT] = "Peasant" - }; + static const char *const str[1]; return str[u->type]; } -- cgit v1.2.3