From a6ec8a9595e988db977f0075402ab5279e653af9 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 3 Jan 2024 06:15:04 -0500 Subject: [PATCH] Simplify some dependencies. --- advent.h | 1 - init.c | 3 +-- templates/dungeon.c.tpl | 2 +- templates/dungeon.h.tpl | 5 ++--- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/advent.h b/advent.h index 68890da..394a389 100644 --- a/advent.h +++ b/advent.h @@ -21,7 +21,6 @@ #define LINESIZE 1024 #define TOKLEN 5 // # outputting characters in a token */ -#define NDWARVES 6 // number of dwarves #define PIRATE NDWARVES // must be NDWARVES-1 when zero-origin #define DALTLC LOC_NUGGET // alternate dwarf location #define INVLIMIT 7 // inventory limit (# of objects) diff --git a/init.c b/init.c index aabd1cb..715f3ef 100644 --- a/init.c +++ b/init.c @@ -46,8 +46,7 @@ int initialise(void) int seedval = (int)rand(); set_seed(seedval); - assert(NDWARVES == NDWARFLOCS); - for (int i = 1; i <= NDWARFLOCS; i++) { + for (int i = 1; i <= NDWARVES; i++) { game.dwarves[i].loc = dwarflocs[i-1]; } diff --git a/templates/dungeon.c.tpl b/templates/dungeon.c.tpl index a192adb..03640d5 100644 --- a/templates/dungeon.c.tpl +++ b/templates/dungeon.c.tpl @@ -54,6 +54,6 @@ const travelop_t travel[] = {{ const char *ignore = "{ignore}"; /* Dwarf starting locations */ -const int dwarflocs[NDWARFLOCS] = {{{dwarflocs}}}; +const int dwarflocs[NDWARVES] = {{{dwarflocs}}}; /* end */ diff --git a/templates/dungeon.h.tpl b/templates/dungeon.h.tpl index 2a26917..cf637c8 100644 --- a/templates/dungeon.h.tpl +++ b/templates/dungeon.h.tpl @@ -35,9 +35,8 @@ SPDX-License-Identifier: BSD-2-Clause #define COND_HOGRE 20 /* Trying to deal with ogre */ #define COND_HJADE 21 /* Found all treasures except jade */ -/* Count of dwarf starting locations */ -#define NDWARFLOCS {ndwarflocs} -extern const int dwarflocs[NDWARFLOCS]; +#define NDWARVES {ndwarflocs} // number of dwarves +extern const int dwarflocs[NDWARVES]; typedef struct {{ const char** strs; -- 2.31.1