From: Eric S. Raymond Date: Thu, 15 Jun 2017 12:49:47 +0000 (-0400) Subject: Use LOC_* constants for locations. Clean up some ARB_* constants. X-Git-Tag: 1.1~298 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=e5f9c4fbea18216c40f1501cdee2ec21914e477c;p=open-adventure.git Use LOC_* constants for locations. Clean up some ARB_* constants. --- diff --git a/actions.c b/actions.c index 5000f1e..a69dbc5 100644 --- a/actions.c +++ b/actions.c @@ -74,7 +74,7 @@ static int attack(FILE *input, long verb, token_t obj) for (i=1; i < PIRATE; i++) { if (game.dloc[i] == game.loc) { ++k; - game.dloc[i]=61; + game.dloc[i] = LOC_61; game.dseen[i]=false; } } @@ -150,14 +150,15 @@ static int bivalve(token_t verb, token_t obj) { int spk, k=0; if (obj == OYSTER)k=1; - spk=PEARL_FALLS+k; + /* FIXME: Arithmetic on message numbers in next lines */ + spk=PEARL_FALLS+k; if (TOTING(obj))spk=DROP_CLAM+k; if (!TOTING(TRIDNT))spk=CLAM_OPENER+k; if (verb == LOCK)spk=HUH_MAN; - if (spk == 124) { + if (spk == PEARL_FALLS) { DSTROY(CLAM); DROP(OYSTER,game.loc); - DROP(PEARL,105); + DROP(PEARL,LOC_105); } RSPEAK(spk); return GO_CLEAROBJ; @@ -172,7 +173,7 @@ static int blast(void) return GO_CLEAROBJ; } game.bonus=133; - if (game.loc == 115) + if (game.loc == LOC_115) game.bonus=134; if (HERE(ROD2)) game.bonus=135; @@ -340,7 +341,7 @@ static int discard(token_t verb, token_t obj, bool just_do_it) if (TOTING(RUG))spk=RUG_WIGGLES; if (obj == RUBY)spk=RUG_SETTLES; RSPEAK(spk); - if (spk != 220) { + if (spk != RUG_WIGGLES) { int k = 2-game.prop[RUG]; game.prop[RUG] = k; if (k == 2) k = PLAC[SAPPH]; @@ -582,7 +583,7 @@ static int fly(token_t verb, token_t obj) if (obj == INTRANSITIVE) { if (game.prop[RUG] != 2)spk=RUG_NOTHING2; if (!HERE(RUG))spk=FLAP_ARMS; - if (spk/2 == 112) { + if (spk/2 == 112) { /* FIXME: Arithmetic on message numbers */ RSPEAK(spk); return GO_CLEAROBJ; } @@ -612,7 +613,7 @@ static int inven(token_t obj) for (i=1; i<=NOBJECTS; i++) { if (i == BEAR || !TOTING(i)) continue; - if (spk == 98) + if (spk == NO_CARRY) RSPEAK(NOW_HOLDING); game.blklin=false; PSPEAK(i,-1); @@ -1003,9 +1004,10 @@ int action(FILE *input, enum speechpart part, long verb, token_t obj) if (HERE(obj)) /* FALL THROUGH */; else if (obj == GRATE) { - if (game.loc == 1 || game.loc == 4 || game.loc == 7) + if (game.loc == LOC_1 || game.loc == LOC_4 || game.loc == LOC_7) obj=DPRSSN; - if (game.loc > 9 && game.loc < 15) + /* FIXME: Arithmetic on location numbers */ + if (game.loc > LOC_9 && game.loc < LOC_15) obj=ENTRNC; if (obj != GRATE) return GO_MOVE; diff --git a/init.c b/init.c index e5f43c7..3782710 100644 --- a/init.c +++ b/init.c @@ -324,17 +324,17 @@ void initialise(void) * chest's eventual location inside the maze. This loc is saved * in game.chloc for ref. the dead end in the other maze has its * loc stored in game.chloc2. */ - game.chloc=114; - game.chloc2=140; + game.chloc = LOC_114; + game.chloc2 = LOC_140; for (i=1; i<=NDWARVES; i++) { game.dseen[i]=false; } game.dflag=0; - game.dloc[1]=19; - game.dloc[2]=27; - game.dloc[3]=33; - game.dloc[4]=44; - game.dloc[5]=64; + game.dloc[1] = LOC_19; + game.dloc[2] = LOC_27; + game.dloc[3] = LOC_33; + game.dloc[4] = LOC_44; + game.dloc[5] = LOC_64; game.dloc[6]=game.chloc; /* Other random flags and counters, as follows: diff --git a/main.c b/main.c index 26f1f70..5e8045f 100644 --- a/main.c +++ b/main.c @@ -127,8 +127,8 @@ int main(int argc, char *argv[]) /* Start-up, dwarf stuff */ game.zzword=RNDVOC(3,0); game.novice=YES(stdin, WELCOME_YOU,CAVE_NEARBY,ARB_0); - game.newloc=1; - game.loc=1; + game.newloc = LOC_1; + game.loc = LOC_1; game.limit=330; if (game.novice)game.limit=1000; @@ -493,7 +493,7 @@ static void croak(FILE *cmdin) DROP(i, (i == LAMP) ? 1 : game.oldlc2); } } - game.loc=3; + game.loc = LOC_3; game.oldloc=game.loc; } } @@ -778,29 +778,29 @@ static bool closecheck(void) * objects he might be carrying (lest he have some which * could cause trouble, such as the keys). We describe the * flash of light and trundle back. */ - game.prop[BOTTLE]=PUT(BOTTLE,115,1); - game.prop[PLANT]=PUT(PLANT,115,0); - game.prop[OYSTER]=PUT(OYSTER,115,0); + game.prop[BOTTLE]=PUT(BOTTLE,LOC_115,1); + game.prop[PLANT]=PUT(PLANT,LOC_115,0); + game.prop[OYSTER]=PUT(OYSTER,LOC_115,0); OBJTXT[OYSTER]=3; - game.prop[LAMP]=PUT(LAMP,115,0); - game.prop[ROD]=PUT(ROD,115,0); - game.prop[DWARF]=PUT(DWARF,115,0); - game.loc=115; - game.oldloc=115; - game.newloc=115; + game.prop[LAMP]=PUT(LAMP,LOC_115,0); + game.prop[ROD]=PUT(ROD,LOC_115,0); + game.prop[DWARF]=PUT(DWARF,LOC_115,0); + game.loc = LOC_115; + game.oldloc = LOC_115; + game.newloc = LOC_115; /* Leave the grate with normal (non-negative) property. * Reuse sign. */ - PUT(GRATE,116,0); - PUT(SIGN,116,0); + PUT(GRATE,LOC_116,0); + PUT(SIGN,LOC_116,0); ++OBJTXT[SIGN]; - game.prop[SNAKE]=PUT(SNAKE,116,1); - game.prop[BIRD]=PUT(BIRD,116,1); - game.prop[CAGE]=PUT(CAGE,116,0); - game.prop[ROD2]=PUT(ROD2,116,0); - game.prop[PILLOW]=PUT(PILLOW,116,0); + game.prop[SNAKE]=PUT(SNAKE,LOC_116,1); + game.prop[BIRD]=PUT(BIRD,LOC_116,1); + game.prop[CAGE]=PUT(CAGE,LOC_116,0); + game.prop[ROD2]=PUT(ROD2,LOC_116,0); + game.prop[PILLOW]=PUT(PILLOW,LOC_116,0); - game.prop[MIRROR]=PUT(MIRROR,115,0); - game.fixed[MIRROR]=116; + game.prop[MIRROR]=PUT(MIRROR,LOC_115,0); + game.fixed[MIRROR]=LOC_116; for (int i=1; i<=NOBJECTS; i++) { if (TOTING(i)) @@ -1019,8 +1019,8 @@ static bool do_command(FILE *cmdin) } else lampcheck(); - k=43; - if (LIQLOC(game.loc) == WATER)k=70; + k=WHERE_QUERY; + if (LIQLOC(game.loc) == WATER)k=FEET_WET; V1=VOCAB(WD1,-1); V2=VOCAB(WD2,-1); if (V1 == ENTER && (V2 == STREAM || V2 == 1000+WATER)) {