From: Eric S. Raymond Date: Fri, 23 Jun 2017 02:33:24 +0000 (-0400) Subject: Toss unused parts of dungeon.c and init.c X-Git-Tag: 1.1~152 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=44abab29e31359eb21038ee2ba8f8f43480b4caa;p=open-adventure.git Toss unused parts of dungeon.c and init.c --- diff --git a/common.h b/common.h index e98384b..670767e 100644 --- a/common.h +++ b/common.h @@ -38,11 +38,7 @@ enum bugtype { TOO_MANY_TRAVEL_OPTIONS, // 3 TOO_MANY_VOCABULARY_WORDS, // 4 REQUIRED_VOCABULARY_WORD_NOT_FOUND, // 5 - TOO_MANY_RTEXT_MESSAGES, // 6 - TOO_MANY_HINTS, // 7 - LOCATION_HAS_CONDITION_BIT_BEING_SET_TWICE, // 8 INVALID_SECTION_NUMBER_IN_DATABASE, // 9 - TOO_MANY_LOCATIONS, // 10 SPECIAL_TRAVEL_500_GT_L_GT_300_EXCEEDS_GOTO_LIST = 20, // 20 RAN_OFF_END_OF_VOCABULARY_TABLE, // 21 VOCABULARY_TYPE_N_OVER_1000_NOT_BETWEEN_0_AND_3, // 22 diff --git a/dungeon.c b/dungeon.c index 6ef3525..2e5d296 100644 --- a/dungeon.c +++ b/dungeon.c @@ -5,7 +5,6 @@ */ #define LINESIZE 100 -#define RTXSIZ 277 #define CLSMAX 12 #define LINSIZ 12600 #define TRNSIZ 5 @@ -13,8 +12,6 @@ #define VRBSIZ 35 #define TRVSIZ 885 #define TOKLEN 5 -#define HINTLEN 5 -#define HNTSIZ 20 #include #include @@ -33,18 +30,11 @@ long LINUSE; long TRVS; long TRNVLS; long TABNDX; -long HNTMAX; -long PTEXT[NOBJECTS + 1]; -long RTEXT[RTXSIZ + 1]; long OBJSND[NOBJECTS + 1]; long OBJTXT[NOBJECTS + 1]; -long STEXT[LOCSIZ + 1]; -long LTEXT[LOCSIZ + 1]; long KEY[LOCSIZ + 1]; long LOCSND[LOCSIZ + 1]; long LINES[LINSIZ + 1]; -long TTEXT[TRNSIZ + 1]; -long TRNVAL[TRNSIZ + 1]; long TRAVEL[TRVSIZ + 1]; long KTAB[TABSIZ + 1]; long ATAB[TABSIZ + 1]; @@ -211,24 +201,18 @@ static void read_messages(FILE* database, long sect) /* now parsed from YAML */ continue; } - if (sect == 6) { - if (loc > RTXSIZ) - BUG(TOO_MANY_RTEXT_MESSAGES); - RTEXT[loc] = LINUSE; + if (sect == 5) { + /* Now handled in YAML */ continue; } - if (sect == 5) { - if (loc > 0 && loc <= NOBJECTS)PTEXT[loc] = LINUSE; + if (sect == 6) { + /* Now handled in YAML */ continue; } - if (loc > LOCSIZ) - BUG(TOO_MANY_LOCATIONS); if (sect == 1) { - LTEXT[loc] = LINUSE; + /* Now handled in YAML */ continue; } - - STEXT[loc] = LINUSE; } } @@ -309,15 +293,11 @@ static void read_conditions(FILE* database) static void read_hints(FILE* database) { long K; - HNTMAX = 0; while ((K = GETNUM(database)) != -1) { - if (K <= 0 || K > HNTSIZ) - BUG(TOO_MANY_HINTS); for (int I = 1; I <= 4; I++) { - /* consume - actual arrqy-building now done in YAML. */ + /* consume - actual array-building now done in YAML. */ GETNUM(NULL); } /* end loop */ - HNTMAX = (HNTMAX > K ? HNTMAX : K); } } @@ -346,22 +326,14 @@ static int read_database(FILE* database) * the next pointer (i.e. the word following the end of the * line). The pointer is negative if this is first line of a * message. The text-pointer arrays contain indices of - * pointer-words in lines. STEXT(N) is short description of - * location N. LTEXT(N) is long description. PTEXT(N) points to + * pointer-words in lines. PTEXT(N) points to * message for game.prop(N)=0. Successive prop messages are - * found by chasing pointers. RTEXT contains section 6's stuff. - * TTEXT is for section 14. */ + * found by chasing pointers. */ for (int I = 1; I <= NOBJECTS; I++) { - PTEXT[I] = 0; OBJSND[I] = 0; OBJTXT[I] = 0; } - for (int I = 1; I <= RTXSIZ; I++) { - RTEXT[I] = 0; - } for (int I = 1; I <= LOCSIZ; I++) { - STEXT[I] = 0; - LTEXT[I] = 0; KEY[I] = 0; LOCSND[I] = 0; } @@ -458,7 +430,6 @@ static void write_file(FILE* header_file) fprintf(header_file, "#include \"common.h\"\n"); fprintf(header_file, "#define TABSIZ 330\n"); - fprintf(header_file, "#define HNTSIZ 20\n"); fprintf(header_file, "#define TOKLEN %d\n", TOKLEN); fprintf(header_file, "\n"); diff --git a/init.c b/init.c index 03c93f1..dbeac0a 100644 --- a/init.c +++ b/init.c @@ -14,15 +14,13 @@ * 12600 words of message text (LINES, LINSIZ). * 885 travel options (TRAVEL, TRVSIZ). * 330 vocabulary words (KTAB, ATAB, TABSIZ). - * 185 locations (LTEXT, STEXT, KEY, COND, game.abbrev, game.atloc, - * LOCSND, LOCSIZ). + * 185 locations (KEY, COND, game.abbrev, game.atloc, LOCSND, LOCSIZ). * 100 objects (PLAC, game.place, FIXD, game.fixed, game.link (twice), - * PTEXT, game.prop, OBJSND, OBJTXT). + * ogame.prop, OBJSND, OBJTXT). * 35 "action" verbs (ACTSPK, VRBSIZ). - * 277 random messages (RTEXT, RTXSIZ). * 12 different player classifications (CTEXT, CVAL, CLSMAX). * 20 hints (game.hintlc, game.hinted, HINTS, HNTSIZ). - * 5 "# of turns" threshholds (TTEXT, TRNVAL, TRNSIZ). + * 5 "# of turns" threshholds (TRNSIZ). * There are also limits which cannot be exceeded due to the structure of * the database. (E.G., The vocabulary uses n/1000 to determine word type, * so there can't be more than 1000 words.) These upper limits are: @@ -134,8 +132,7 @@ * bit; see section 9), the number of turns he must be at the right loc(s) * before triggering the hint, the points deducted for taking the hint, * the message number (section 6) of the question, and the message number - * of the hint. These values are stashed in the "hints" array. HNTMAX is - * set to the max hint number (<= HNTSIZ). + * of the hint. These values are stashed in the "hints" array. * Section 12: Unused in this version. * Section 13: Sounds and text. Each line contains either 2 or 3 numbers. If * 2 (call them N and S), N is a location and message ABS(S) from section