process MAKE.BURGER
''
'' AUTHOR: Steve Bailey
'' CREATED: 7-25-90
'' DESCRIPTION:
''     This process takes a burger out of the steamer and builds it.
''

define WORK.BURGER as a pointer variable
define CHOICE as an integer variable
define STATION as an integer variable
define BURGER.READY as an integer variable
define BOFF as a real variable

'' broil a meat pattie
activate a BROIL.BURGER now

'' keep checking steamer until it has a burger in it
until BURGER.READY is not zero do

    '' move the closest free knave to that station
    let STATION = CHOICE.WORKSTATION(.RBOARD1, .LBOARD1, 0)
    request 1 WORKSTATION(STATION)
    let CHOICE = CHOICE.KNAVE(STATION)
    request 1 KNAVE(CHOICE)
    let OCCUPIER(STATION) = CHOICE

    '' if steamer is empty, then start over
    if STEAMER is empty
        relinquish 1 KNAVE(CHOICE)
        relinquish 1 WORKSTATION(STATION)
        wait 20 .SECONDS
        cycle
    otherwise

    let BURGER.READY = 1
loop

let BOFF = 3.0 * (SIDE.OF.BROILER(STATION) - 1.5)

remove first WORK.BURGER from STEAMER
erase WORK.BURGER
display WORK.BURGER with "burger2.icn" at (XLOC(STATION)+BOFF,YLOC(STATION))

'' put pickles and onions on burger
work .MAKE1.TIME .SECONDS
relinquish 1 WORKSTATION(STATION)

'' put ketsup and mustard on burger
request 1 WORKSTATION(STATION+1)
let OCCUPIER(STATION+1) = CHOICE
erase WORK.BURGER
display WORK.BURGER with "burger3.icn" at (XLOC(STATION+1)+BOFF,YLOC(STATION+1))
work .MAKE2.TIME .SECONDS
relinquish 1 WORKSTATION(STATION+1)

'' put on mayo, lettuce and tomatoe
request 1 WORKSTATION(STATION+2)
let OCCUPIER(STATION+2) = CHOICE
erase WORK.BURGER
display WORK.BURGER with "burger4.icn" at (XLOC(STATION+2)+BOFF,YLOC(STATION+2))
work .MAKE3.TIME .SECONDS
relinquish 1 WORKSTATION(STATION+2)

'' wrap burger and microwave
request 1 WORKSTATION(STATION+3)
let OCCUPIER(STATION+3) = CHOICE
erase WORK.BURGER
display WORK.BURGER with "burger5.icn" at (XLOC(STATION+3)+BOFF,YLOC(STATION+3))
work .MAKE4.TIME .SECONDS
relinquish 1 WORKSTATION(STATION+3)

file WORK.BURGER in HEAT.RACK
erase WORK.BURGER
display WORK.BURGER with "burger6.icn" at 
  (.HEAT.RACKX + N.HEAT.RACK*0.35, .HEAT.RACKY)

relinquish 1 KNAVE(CHOICE)
activate a CALL.ORDERS now

return
end
            
