the-infocom-files / bureaucracy

Bureaucracy
8 stars 2 forks source link

[game breaking] Can't call the cab company #11

Open ChristopherDrum opened 2 years ago

ChristopherDrum commented 2 years ago

I've tried this in two different interpreters now (Yazmin and my own), building the .z4 from source using ZILF/ZAPF. The game seems to play well (minus the currently logged problems) until it comes time to call the cab company. (this can be tested quickly at the beginning, just ignore the delivery agent at the front door, go west into the back room and try making a call)

Back Room

You see a table and a combination telephone/answering machine here.

>read address book
On opening the address book, you find that in common with many loose-leaf address books, most of the pages are loose and have fallen out. There are only two or three left. Most of these are stuck together with jam, chewing gum or an unpleasant combination of both.

Which page do you want to read, the last page, the first page, or the middle page?

>last
Only two entries are legible on this page.

Mr Ollie Fassbaum, Manager
The Happitec Corporation
17 Okapi Plaza
Charlotte, NC 90210
535-9643

and

Getlost Airport Cab
536-0784

>call 536-0784
[This story isn't allowed to recognise the word "536-0784."]

[Your blood pressure just went up.]

>call getlost
You can't see any getlost here.

>call cab company
[You must have special permission to use the word "company" in this story.]

[Your blood pressure just went up.]

>call cab
You can't see any cab here.
ChristopherDrum commented 2 years ago

I've verified that r116 (Masterpieces edition) does not have this issue. r160 and the source here do.

heasm66 commented 2 years ago

How is it supposed to work?

Is it the call xxx-xxxx that should work?

ChristopherDrum commented 2 years ago

That's correct. I believe that any number listed in the address book should give you some kind of response (though I've only tried a few), not a complaint that it "doesn't know the word" (phone number)

heasm66 commented 2 years ago

The problem seems to be in the DO-NUMBER? routine. So far I can see, when you type, for example , call 123-456, it should return:

123 in the global P-EXCHANGE
456 in the global P-NUMBER
and the routine should return W?INTNUM

DO-NUMBER? with the following changes does just that, but I'm not completely sure that it don't break anything else. Should need some testing.

<DEFINE DO-NUMBER? NN (PTR:FIX "OPT" (CNT:FIX 0) "AUX"
             BPTR:FIX CHR:FIX (SUM:FIX 0)
            (TIM:<OR FIX FALSE> <>) (EXC <>) (DOLLAR <>) CCTR
            (TMP <>) NW (SAVED-PTR .PTR) (MINUS? <>))
     <COND (<0? .CNT>
        <SET CNT <GETB <ZREST ,P-LEXV <* .PTR 2>> 2>>
        <SET TMP T>)>
     <SET BPTR <GETB <ZREST ,P-LEXV <* .PTR 2>> 3>>
     <SET CHR <GETB ,P-INBUF <+ .BPTR .CNT -1>>>
     <COND (<AND .TMP
             <G=? .CNT 2>
             <B-THRU-E? .CHR>
             <OR <N==? <GETB ,P-INBUF <+ .BPTR .CNT -2>>
                   %<ASCII !\->>
             <G=? .CNT 3>>>
        ; "Handle case of seat number (13b, whatever). Pseudo handler
           for seat will do the right thing with this. First make sure
           it ends with a letter, and is long enough"
        <SET CNT <- .CNT 1>>
        <COND (<==? <GETB ,P-INBUF <+ .BPTR .CNT -1>>
                %<ASCII !\->>
               ; "kludge so 13-b works as well as 13b"
               <SET CNT <- .CNT 1>>)>
        <COND (<==? <SET TMP <DO-NUMBER? .PTR .CNT>>
                ,W?INTNUM>
               ; "Got a real number before the seat letter, so
              win."
               <COND (<G=? .CHR %<ASCII !\a>>
                  <SET CHR <- .CHR %<ASCII !\b>>>)
                 (T
                  <SET CHR <- .CHR %<ASCII !\B>>>)>
               ; "Get a code number for the seat..."
               <SETG P-SEAT-NUMBER <+ <* <- ,P-NUMBER:FIX 1> 4> .CHR>>
               <SETG P-NUMBER -1>
               <RETURN ,W?INTNUM .NN>)
              (T
               ; "Lost, so just give up"
               <RETURN <> .NN>)>)>
     <REPEAT ()
         <COND (<L? <SET CNT <- .CNT 1>> 0>
            <RETURN>)>
         <SET CHR <GETB ,P-INBUF .BPTR>>
         <COND (<==? .CHR %<ASCII !\#>> T)
               (<EQUAL? .CHR %<ASCII !\:>>
            <COND (<T? .EXC>
                   <RETURN <> .NN>)>
            <SET TIM .SUM>
            <SET SUM 0>)
               (<EQUAL? .CHR %<ASCII !\->>
            <COND (<T? .TIM>
                   <RETURN <> .NN>)>
            <SET MINUS? T>
            <SET EXC .SUM>
            <SET SUM 0>)
               (<G? .SUM 9999>
            <RETURN <> .NN>)
               (<EQUAL? .CHR %<ASCII !\$>>
            <SET DOLLAR T>)
               (<AND <G? .CHR %<- <ASCII !\0> 1>>
                 <L? .CHR %<+ <ASCII !\9> 1>>>
            <SET SUM <+ <* .SUM 10> <- .CHR %<ASCII !\0>>>>)
               (T
            <RETURN <> .NN>)>
         <SET BPTR <+ .BPTR 1>>>
     <CHANGE-LEXV .PTR ,W?INTNUM>
     <COND (<G? ,P-LEN:FIX 1>
        <SET NW <ZGET ,P-LEXV <+ .PTR ,P-LEXELEN>>>)
           (T
        <SET NW <>>)>
     <COND (<AND <T? .DOLLAR>
             <EQUAL? .NW ,W?PERIOD>
             <G=? ,P-LEN:FIX 2>>
        <SET TMP <CENTS-CHECK <+ .PTR <* ,P-LEXELEN 2>>>>
        <COND (<T? .TMP>
               <COND (<EQUAL? .TMP 100>
                  <SET TMP 0>)>
               <SET SUM <+ <* 100 .SUM> .TMP>>
               <SET CCTR <- ,P-LEN:FIX 2>>
               <REPEAT ()
             <COND (<L? <SET CCTR <- .CCTR 1>> 0>
                <SETG P-LEN <- ,P-LEN:FIX 2>>
                <PUTB ,P-LEXV ,P-LEXWORDS
                      <- <GETB ,P-LEXV ,P-LEXWORDS>:FIX
                     2>>
                <RETURN>)>
             <SET PTR <+ .PTR ,P-LEXELEN>>
             <CHANGE-LEXV .PTR
                      <ZGET ,P-LEXV <+ .PTR <* 2 ,P-LEXELEN>>>>
             <PUTB ,P-LEXV <+ <* .PTR 2> 2>
                   <GETB ,P-LEXV
                     <+ <* <+ .PTR <* 2 ,P-LEXELEN>> 2> 2>>>
             <PUTB ,P-LEXV <+ <* .PTR 2> 3>
                   <GETB ,P-LEXV
                     <+ <* <+ .PTR <* 2 ,P-LEXELEN>> 2> 3>>>>)
              (ELSE <SET SUM <* .SUM 100>>)>)
           (<T? .DOLLAR> <SET SUM <* .SUM 100>>)>
     <COND (<EQUAL? .NW ,W?CENT ,W?CENTS>
        <SET DOLLAR T>)
           (<INTBL? .NW <GETPT ,MONEY ,P?SYNONYM>
            </ <PTSIZE <GETPT ,MONEY ,P?SYNONYM>> 2>>
        ; "Check synonyms from money object"
        <SET DOLLAR T>
        <SET SUM <* .SUM 100>>)>
     <COND (<G? .SUM 9999>
        <RETURN <> .NN>)
           (<T? .EXC>
        <SETG P-EXCHANGE .EXC>)
           (<T? .TIM>
        <SETG P-EXCHANGE 0>
        <COND (<G? .TIM 23>
               <RETURN <> .NN>)
              (<G? .TIM 19>
               T)
              (<G? .TIM 12>
               <RETURN <> .NN>)
              (<G? .TIM  7>
               T)
              (T
               <SET TIM <+ 12 .TIM>>)>
        <SET SUM <+ .SUM <* .TIM 60>>>)
           (T
        <SETG P-EXCHANGE 0>)>
     <COND (.MINUS?
            <SETG P-EXCHANGE .EXC>
        <SETG P-NUMBER .SUM>
        <RETURN ,W?INTNUM>)>
     <SETG P-DOLLAR-FLAG .DOLLAR>
     <SETG P-NUMBER .SUM>
     <COND (<AND <T? .DOLLAR>
             <G? .SUM 0>>
        <CHANGE-LEXV .SAVED-PTR ,W?MONEY>
        ,W?MONEY)
           (T
        <SETG P-DOLLAR-FLAG <>>
        <SETG P-SEAT-NUMBER -1>
        ,W?INTNUM)>>

The block (at the end)

     <COND (.MINUS?
        <RETURN <>>)>

is replaced with:

     <COND (.MINUS?
            <SETG P-EXCHANGE .EXC>
        <SETG P-NUMBER .SUM>
        <RETURN ,W?INTNUM>)>
ChristopherDrum commented 2 years ago

I can confirm this repairs the phone problem. Nice work! 👍 Still need to do a full playthrough to see if there are any side effects. Negative and hyphenated numbers are used in other spots, IIRC.

ChristopherDrum commented 2 years ago

I've gone through the game a couple of times now, and I've not seen any side-effects of this patch yet. I was able to sit in seat 8-c properly. Not sure what else should be tested, TBH.

eriktorbjorn commented 1 year ago

I could be wrong, but running the official release 116 through txd I get the impression that this version didn't even have a MINUS? variable. It is, of course, possible that it was added to address some sort of problem, but I'd be tempted to remove it completely.