left routine OCCUPIER given STATION
''
'' AUTHOR: Steve Bailey
'' CREATED: 7-25-90
'' DESCRIPTION:
''     This routine moves the given knave to the given station.  The knave
''     is actually moved to the station (elapsing simulated time).
''

define STATION as an integer variable
define EMPLOYEE as an integer variable

enter with EMPLOYEE

if EMPLOYEE ne 0
    '' see if we are talking about an order station or a kitchen station
    select case STATION
      case .ORDER1, .ORDER2, .ORDER3, .PICKUP1, .PICKUP2, .PICKUP3, .GIVE.ORDER
        if ORDER.STATION(EMPLOYEE) ne 0
            call MOVE.TO given 
              ORDER.TAKER.ICON(EMPLOYEE), XLOC(STATION), YLOC(STATION)
        always
        let ORDER.STATION(EMPLOYEE) = STATION
        display ORDER.TAKER.ICON(EMPLOYEE) at (XLOC(STATION), YLOC(STATION))
      default
        if KITCHEN.STATION(EMPLOYEE) ne 0
            '' move employee around broiler
            if SIDE.OF.BROILER(KITCHEN.STATION(EMPLOYEE)) ne 
              SIDE.OF.BROILER(STATION) 
                if SIDE.OF.BROILER(STATION) eq .RIGHT.SIDE and (STATION ne 
                  .RBROILER or KITCHEN.STATION(EMPLOYEE) ne .LBROILER)
                    let OCCUPIER(.LBROILER) = EMPLOYEE
                    let OCCUPIER(.RBROILER) = EMPLOYEE
                always
                if SIDE.OF.BROILER(STATION) eq .LEFT.SIDE and (STATION ne 
                  .LBROILER or KITCHEN.STATION(EMPLOYEE) ne .RBROILER)
                    let OCCUPIER(.RBROILER) = EMPLOYEE
                    let OCCUPIER(.LBROILER) = EMPLOYEE
                always
            always
            call MOVE.TO given KNAVE.ICON(EMPLOYEE),XLOC(STATION),YLOC(STATION)
        always
        let KITCHEN.STATION(EMPLOYEE) = STATION
        display KNAVE.ICON(EMPLOYEE) at (XLOC(STATION), YLOC(STATION))
    endselect
always

return
end
