Begin to split undifferentiated longs into semantic types.
[open-adventure.git] / misc.c
diff --git a/misc.c b/misc.c
index 33e16e6874641a671d03d4045ec18ec309b83971..e6ee7d1dbeee6e726fad14c4046d4194950309d4 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -12,7 +12,7 @@
 
 /*  I/O routines (SPEAK, PSPEAK, RSPEAK, SETPRM, GETIN, YES) */
 
-void SPEAK(long N) {
+void SPEAK(vocab_t N) {
 long BLANK, CASE, I, K, L, NEG, NPARMS, PARM, PRMTYP, STATE;
 
 /*  Print the message which starts at LINES(N).  Precede it with a blank line
@@ -111,7 +111,7 @@ L40:        if(BLANK)TYPE0();
        return;
 }
 
-void PSPEAK(long MSG,long SKIP) {
+void PSPEAK(vocab_t MSG,int SKIP) {
 long I, M;
 
 /*  Find the skip+1st message from msg and print it.  MSG should be the index of
@@ -129,7 +129,7 @@ L9: SPEAK(M);
        return;
 }
 
-void RSPEAK(long I) {
+void RSPEAK(vocab_t I) {
 
 /*  Print the I-TH "random" message (section 6 of database). */
 
@@ -194,8 +194,8 @@ L22:        JUNK=GETTXT(false,true,true);
 #undef WORD2X
 #define GETIN(SRC,WORD1,WORD1X,WORD2,WORD2X) fGETIN(SRC,&WORD1,&WORD1X,&WORD2,&WORD2X)
 
-long YES(FILE *input, long X, long Y, long Z) {
-long YEAH, REPLY, JUNK1, JUNK2, JUNK3;
+long YES(FILE *input, vocab_t X, vocab_t Y, vocab_t Z) {
+token_t YEAH, REPLY, JUNK1, JUNK2, JUNK3;
 
 /*  Print message X, wait for yes/no answer.  If yes, print Y and return true;
  *  if no, print Z and return false. */
@@ -223,7 +223,7 @@ L20:        YEAH=false;
  *  machine dependent i/o stuff is on the following page.  See that page
  *  for a description of MAPCOM's inline array. */
 
-long GETTXT(long SKIP,long ONEWRD, long UPPER) {
+long GETTXT(bool SKIP,bool ONEWRD, bool UPPER) {
 /*  Take characters from an input line and pack them into 30-bit words.
  *  Skip says to skip leading blanks.  ONEWRD says stop if we come to a
  *  blank.  UPPER says to map all letters to uppercase.  If we reach the
@@ -511,7 +511,7 @@ long I, J;
        I=PLACE[OBJECT];
        J=FIXED[OBJECT];
        MOVE(OBJECT,I);
-       MOVE(OBJECT+100,J);
+       MOVE(OBJECT+NOBJECTS,J);
        return;
 }
 
@@ -523,10 +523,10 @@ long FROM;
  *  are not at any loc, since carry wants to remove objects from ATLOC chains. */
 
 
-       if(OBJECT > 100) goto L1;
+       if(OBJECT > NOBJECTS) goto L1;
        FROM=PLACE[OBJECT];
         goto L2;
-L1:    {long x = OBJECT-100; FROM=FIXED[x];}
+L1:    {long x = OBJECT-NOBJECTS; FROM=FIXED[x];}
 L2:    if(FROM > 0 && FROM <= 300)CARRY(OBJECT,FROM);
        DROP(OBJECT,WHERE);
        return;
@@ -547,10 +547,10 @@ void CARRY(long OBJECT, long WHERE) {
 long TEMP;
 
 /*  Start toting an object, removing it from the list of things at its former
- *  location.  Incr holdng unless it was already being toted.  If OBJECT>100
+ *  location.  Incr holdng unless it was already being toted.  If OBJECT>NOBJECTS
  *  (moving "fixed" second loc), don't change PLACE or HOLDNG. */
 
-       if(OBJECT > 100) goto L5;
+       if(OBJECT > NOBJECTS) goto L5;
        if(PLACE[OBJECT] == -1)return;
        PLACE[OBJECT]= -1;
        HOLDNG=HOLDNG+1;
@@ -569,11 +569,11 @@ void DROP(long OBJECT, long WHERE) {
 /*  Place an object at a given loc, prefixing it onto the ATLOC list.  Decr
  *  HOLDNG if the object was being toted. */
 
-       if(OBJECT > 100) goto L1;
+       if(OBJECT > NOBJECTS) goto L1;
        if(PLACE[OBJECT] == -1)HOLDNG=HOLDNG-1;
        PLACE[OBJECT]=WHERE;
         goto L2;
-L1:    {long x = OBJECT-100; FIXED[x]=WHERE;}
+L1:    {long x = OBJECT-NOBJECTS; FIXED[x]=WHERE;}
 L2:    if(WHERE <= 0)return;
        LINK[OBJECT]=ATLOC[WHERE];
        ATLOC[WHERE]=OBJECT;
@@ -593,7 +593,7 @@ long AT, I;
        AT=0;
        if(DFLAG < 2)return(AT);
        AT= -1;
-       for (I=1; I<=5; I++) {
+       for (I=1; I<=NDWARVES-1; I++) {
        if(DLOC[I] == WHERE) goto L2;
        if(DLOC[I] != 0)AT=0;
        } /* end loop */