X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=dungeon.c;h=5b94d9508e1a584f33d0be84e40782f8fa1c7b90;hb=d844c2a3913e1c7d331b080a4a09631e515d9364;hp=9719b946930148afe6df38051af6dd38c40cd423;hpb=c4c28e10db763e10f1366eace99daa85c35503f6;p=open-adventure.git diff --git a/dungeon.c b/dungeon.c index 9719b94..5b94d95 100644 --- a/dungeon.c +++ b/dungeon.c @@ -21,9 +21,6 @@ #include #include -/* hard limit, will be propagated to database.h */ -#define NOBJECTS 100 - // Global variables for use in functions below that can gradually disappear as code is cleaned up static long LNLENG; static long LNPOSN; @@ -149,7 +146,6 @@ static void BUG(long NUM) { } static void MAPLIN(FILE *OPENED) { - size_t i; /* Read a line of input, from the specified input source, * translate the chars to integers in the range 0-126 and store * them in the common array "INLINE". Integer values are as follows: @@ -183,7 +179,7 @@ static void MAPLIN(FILE *OPENED) { while (!feof(OPENED) && INLINE[1] == '#'); LNLENG = 0; - for (i = 1; i < sizeof(INLINE) && INLINE[i] != 0; ++i) + for (size_t i = 1; i < sizeof(INLINE) && INLINE[i] != 0; ++i) { char val = INLINE[i]; INLINE[i] = ascii_to_advent[(unsigned)val]; @@ -491,12 +487,12 @@ static int read_database(FILE* database) { * whether the abbreviated description is printed. Counts modulo 5 * unless "LOOK" is used. */ -static void write_0d(FILE* header_file, long single, char* varname) +static void write_0d(FILE* header_file, long single, const char* varname) { fprintf(header_file, "LOCATION long %s INITIALIZE(= %ld);\n", varname, single); } -static void write_1d(FILE* header_file, long array[], long dim, char* varname) +static void write_1d(FILE* header_file, long array[], long dim, const char* varname) { fprintf(header_file, "LOCATION long %s[] INITIALIZE(= {\n", varname); for (int i = 0; i < dim; ++i) @@ -512,7 +508,7 @@ static void write_1d(FILE* header_file, long array[], long dim, char* varname) fprintf(header_file, "\n});\n"); } -static void write_hints(FILE* header_file, long matrix[][HINTLEN], long dim1, long dim2, char* varname) +static void write_hints(FILE* header_file, long matrix[][HINTLEN], long dim1, long dim2, const char* varname) { fprintf(header_file, "LOCATION long %s[][%ld] INITIALIZE(= {\n", varname, dim2); for (int i = 0; i < dim1; ++i) @@ -529,8 +525,8 @@ static void write_hints(FILE* header_file, long matrix[][HINTLEN], long dim1, lo static void write_file(FILE* header_file) { - int i, MAXDIE; - for (i=0; i<=4; i++) { + int MAXDIE; + for (int i=0; i<=4; i++) { long x = 2*i+81; if(RTEXT[x] != 0) MAXDIE=i+1;