X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=dungeon.c;h=b22997da7c394b1d9d164f16ded7499697e8ae06;hb=da883d53c09875635a9be1730371bebdaf9ef262;hp=0c7ca63d499f08832f7466a7e2a5b70dc1e6da52;hpb=1173a9a265a3132688830c26077129e3c624cd13;p=open-adventure.git diff --git a/dungeon.c b/dungeon.c index 0c7ca63..b22997d 100644 --- a/dungeon.c +++ b/dungeon.c @@ -29,7 +29,6 @@ static long LNLENG; static long LNPOSN; static char INLINE[LINESIZE+1]; static long OLDLOC; -static long MAXDIE; // Storage for what comes out of the database long LINUSE; @@ -198,9 +197,9 @@ void MAPLIN(FILE *OPENED) { while (!feof(OPENED) && INLINE[1] == '#'); LNLENG = 0; - for (size_t 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] + 1; + char val = INLINE[i]; INLINE[i] = ascii_to_advent[(unsigned)val]; if (INLINE[i] != 0) LNLENG = i; @@ -215,7 +214,7 @@ long GETNUM(FILE *source) { * scanned). If we're at the end of the line or encounter an illegal * character (not a digit, hyphen, or blank), we return 0. */ - long DIGIT, GETNUM, SIGN; + long GETNUM, SIGN; if(source != NULL) MAPLIN(source); GETNUM = 0; @@ -236,7 +235,7 @@ long GETNUM(FILE *source) { } while (!(LNPOSN > LNLENG || INLINE[LNPOSN] == 0)) { - DIGIT=INLINE[LNPOSN]-64; + long DIGIT=INLINE[LNPOSN]-64; if(DIGIT < 0 || DIGIT > 9) { GETNUM=0; @@ -562,16 +561,9 @@ void write_files(FILE* c_file, FILE* header_file) // preprocessor defines for the header fprintf(header_file, "#include \"common.h\"\n"); - fprintf(header_file, "#define RTXSIZ 277\n"); - fprintf(header_file, "#define CLSMAX 12\n"); - fprintf(header_file, "#define LINSIZ %d\n", LINSIZ); - fprintf(header_file, "#define TRNSIZ 5\n"); fprintf(header_file, "#define TABSIZ 330\n"); - fprintf(header_file, "#define VRBSIZ 35\n"); fprintf(header_file, "#define HNTSIZ 20\n"); - fprintf(header_file, "#define TRVSIZ 885\n"); fprintf(header_file, "#define TOKLEN %d\n", TOKLEN); - fprintf(header_file, "#define HINTLEN %d\n", HINTLEN); fprintf(header_file, "#define MAXDIE %d\n", MAXDIE); fprintf(header_file, "\n"); @@ -580,25 +572,14 @@ void write_files(FILE* c_file, FILE* header_file) fprintf(c_file, "\n"); // content variables - write_0d(c_file, header_file, LINUSE, "LINUSE"); - write_0d(c_file, header_file, TRVS, "TRVS"); - write_0d(c_file, header_file, CLSSES, "CLSSES"); write_0d(c_file, header_file, TRNVLS, "TRNVLS"); - write_0d(c_file, header_file, TABNDX, "TABNDX"); write_0d(c_file, header_file, HNTMAX, "HNTMAX"); - write_1d(c_file, header_file, PTEXT, NOBJECTS + 1, "PTEXT"); - write_1d(c_file, header_file, RTEXT, RTXSIZ + 1, "RTEXT"); - write_1d(c_file, header_file, CTEXT, CLSMAX + 1, "CTEXT"); write_1d(c_file, header_file, OBJSND, NOBJECTS + 1, "OBJSND"); write_1d(c_file, header_file, OBJTXT, NOBJECTS + 1, "OBJTXT"); - write_1d(c_file, header_file, STEXT, LOCSIZ + 1, "STEXT"); - write_1d(c_file, header_file, LTEXT, LOCSIZ + 1, "LTEXT"); write_1d(c_file, header_file, COND, LOCSIZ + 1, "COND"); write_1d(c_file, header_file, KEY, LOCSIZ + 1, "KEY"); write_1d(c_file, header_file, LOCSND, LOCSIZ + 1, "LOCSND"); - write_1d(c_file, header_file, LINES, LINSIZ + 1, "LINES"); write_1d(c_file, header_file, CVAL, CLSMAX + 1, "CVAL"); - write_1d(c_file, header_file, TTEXT, TRNSIZ + 1, "TTEXT"); write_1d(c_file, header_file, TRNVAL, TRNSIZ + 1, "TRNVAL"); write_1d(c_file, header_file, TRAVEL, TRVSIZ + 1, "TRAVEL"); write_1d(c_file, header_file, KTAB, TABSIZ + 1, "KTAB");