Document the YAML, remove some dead code, fix typos.
This commit is contained in:
parent
f6373dd32e
commit
b37f9f4b2d
3 changed files with 48 additions and 26 deletions
|
@ -1,3 +1,38 @@
|
||||||
|
# This YAML file gets processed into a collection of data structure and
|
||||||
|
# variable initializers describing Colossal Cave. It replaces an ad-hoc
|
||||||
|
# text database shipped with Adventure versions up to 2.6. The format
|
||||||
|
# change enabled a lot of use of symbolic names where there were previously
|
||||||
|
# inscrutable numeric literals.
|
||||||
|
#
|
||||||
|
# We define a bunch of YAML structures:
|
||||||
|
#
|
||||||
|
# locations: Each item contains a long and short description. Some
|
||||||
|
# short descriptions are empty. Order of these locations is significant;
|
||||||
|
# see the macros OUTSID and INDEEP.
|
||||||
|
#
|
||||||
|
# arbitrary_messages: These are arguments to RSPEAK(). Some spans of
|
||||||
|
# these messages need to be kept adjacent and ordered. To see which,
|
||||||
|
# grep for RSPEAK calls containing expressions with arithmetic.
|
||||||
|
#
|
||||||
|
# classes: Each item contains a point threshold and a message
|
||||||
|
# describing a classification of player. point thresholds must be
|
||||||
|
# in ascending order. The scoring code selects the appropriate
|
||||||
|
# message, where each message is considered to apply to players
|
||||||
|
# whose scores are higher than the previous N but not higher than
|
||||||
|
# this N. Note that these scores probably change with every
|
||||||
|
# modification (and particularly expansion) of the program.
|
||||||
|
#
|
||||||
|
# turn_thresholds: Each item contains a number and a message
|
||||||
|
# berating the player for taking so many turns. The messages must
|
||||||
|
# be in the proper (ascending) order. The message gets printed if
|
||||||
|
# the player exceeds N % 100000 turns, at which time N/100000
|
||||||
|
# points get deducted from his score.
|
||||||
|
#
|
||||||
|
# objects: Each item contains a description for use in the inventory command
|
||||||
|
# and one or more messages describing the object in different states.
|
||||||
|
# If the inventory desription begins with "*" the object is dungeon
|
||||||
|
# furniture that cannot be taken or carried.
|
||||||
|
#
|
||||||
locations: !!omap
|
locations: !!omap
|
||||||
- LOC_NOWHERE:
|
- LOC_NOWHERE:
|
||||||
description:
|
description:
|
||||||
|
@ -575,7 +610,7 @@ locations: !!omap
|
||||||
description:
|
description:
|
||||||
long: 'You are in a large chamber with passages to the west and north.'
|
long: 'You are in a large chamber with passages to the west and north.'
|
||||||
short: !!null
|
short: !!null
|
||||||
- LOC_SOTOREROOM:
|
- LOC_STOREROOM:
|
||||||
description:
|
description:
|
||||||
long: 'You are in the ogre''s storeroom. The only exit is to the south.'
|
long: 'You are in the ogre''s storeroom. The only exit is to the south.'
|
||||||
short: !!null
|
short: !!null
|
||||||
|
|
1
common.h
1
common.h
|
@ -21,7 +21,6 @@ enum bugtype {
|
||||||
LOCATION_HAS_CONDITION_BIT_BEING_SET_TWICE, // 8
|
LOCATION_HAS_CONDITION_BIT_BEING_SET_TWICE, // 8
|
||||||
INVALID_SECTION_NUMBER_IN_DATABASE, // 9
|
INVALID_SECTION_NUMBER_IN_DATABASE, // 9
|
||||||
TOO_MANY_LOCATIONS, // 10
|
TOO_MANY_LOCATIONS, // 10
|
||||||
TOO_MANY_CLASS_OR_TURN_MESSAGES, // 11
|
|
||||||
SPECIAL_TRAVEL_500_GT_L_GT_300_EXCEEDS_GOTO_LIST = 20, // 20
|
SPECIAL_TRAVEL_500_GT_L_GT_300_EXCEEDS_GOTO_LIST = 20, // 20
|
||||||
RAN_OFF_END_OF_VOCABULARY_TABLE, // 21
|
RAN_OFF_END_OF_VOCABULARY_TABLE, // 21
|
||||||
VOCABULARY_TYPE_N_OVER_1000_NOT_BETWEEN_0_AND_3, // 22
|
VOCABULARY_TYPE_N_OVER_1000_NOT_BETWEEN_0_AND_3, // 22
|
||||||
|
|
36
dungeon.c
36
dungeon.c
|
@ -35,7 +35,6 @@ long TABNDX;
|
||||||
long HNTMAX;
|
long HNTMAX;
|
||||||
long PTEXT[NOBJECTS + 1];
|
long PTEXT[NOBJECTS + 1];
|
||||||
long RTEXT[RTXSIZ + 1];
|
long RTEXT[RTXSIZ + 1];
|
||||||
long CTEXT[CLSMAX + 1];
|
|
||||||
long OBJSND[NOBJECTS + 1];
|
long OBJSND[NOBJECTS + 1];
|
||||||
long OBJTXT[NOBJECTS + 1];
|
long OBJTXT[NOBJECTS + 1];
|
||||||
long STEXT[LOCSIZ + 1];
|
long STEXT[LOCSIZ + 1];
|
||||||
|
@ -217,15 +216,7 @@ static void read_messages(FILE* database, long sect)
|
||||||
if (loc == OLDLOC) continue;
|
if (loc == OLDLOC) continue;
|
||||||
OLDLOC = loc;
|
OLDLOC = loc;
|
||||||
LINES[LINUSE] = -KK;
|
LINES[LINUSE] = -KK;
|
||||||
if (sect == 14) {
|
if (sect == 10 || sect == 14) {
|
||||||
TRNVLS = TRNVLS + 1;
|
|
||||||
if (TRNVLS > TRNSIZ)
|
|
||||||
BUG(TOO_MANY_CLASS_OR_TURN_MESSAGES);
|
|
||||||
TTEXT[TRNVLS] = LINUSE;
|
|
||||||
TRNVAL[TRNVLS] = loc;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (sect == 10) {
|
|
||||||
/* now parsed from YAML */
|
/* now parsed from YAML */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -360,17 +351,17 @@ static void read_sound_text(FILE* database)
|
||||||
|
|
||||||
static int read_database(FILE* database)
|
static int read_database(FILE* database)
|
||||||
{
|
{
|
||||||
|
/* Clear out the various text-pointer arrays. All text is stored
|
||||||
/* Clear out the various text-pointer arrays. All text is stored in array
|
* in array lines; each line is preceded by a word pointing to
|
||||||
* lines; each line is preceded by a word pointing to the next pointer (i.e.
|
* the next pointer (i.e. the word following the end of the
|
||||||
* the word following the end of the line). The pointer is negative if this is
|
* line). The pointer is negative if this is first line of a
|
||||||
* first line of a message. The text-pointer arrays contain indices of
|
* message. The text-pointer arrays contain indices of
|
||||||
* pointer-words in lines. STEXT(N) is short description of location N.
|
* pointer-words in lines. STEXT(N) is short description of
|
||||||
* LTEXT(N) is long description. PTEXT(N) points to message for game.prop(N)=0.
|
* location N. LTEXT(N) is long description. PTEXT(N) points to
|
||||||
* Successive prop messages are found by chasing pointers. RTEXT contains
|
* message for game.prop(N)=0. Successive prop messages are
|
||||||
* section 6's stuff. CTEXT(N) points to a player-class message. TTEXT is for
|
* found by chasing pointers. RTEXT contains section 6's stuff.
|
||||||
* section 14. We also clear COND (see description of section 9 for details). */
|
* TTEXT is for section 14. We also clear COND (see description
|
||||||
|
* of section 9 for details). */
|
||||||
for (int I = 1; I <= NOBJECTS; I++) {
|
for (int I = 1; I <= NOBJECTS; I++) {
|
||||||
PTEXT[I] = 0;
|
PTEXT[I] = 0;
|
||||||
OBJSND[I] = 0;
|
OBJSND[I] = 0;
|
||||||
|
@ -379,9 +370,6 @@ static int read_database(FILE* database)
|
||||||
for (int I = 1; I <= RTXSIZ; I++) {
|
for (int I = 1; I <= RTXSIZ; I++) {
|
||||||
RTEXT[I] = 0;
|
RTEXT[I] = 0;
|
||||||
}
|
}
|
||||||
for (int I = 1; I <= CLSMAX; I++) {
|
|
||||||
CTEXT[I] = 0;
|
|
||||||
}
|
|
||||||
for (int I = 1; I <= LOCSIZ; I++) {
|
for (int I = 1; I <= LOCSIZ; I++) {
|
||||||
STEXT[I] = 0;
|
STEXT[I] = 0;
|
||||||
LTEXT[I] = 0;
|
LTEXT[I] = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue