routine MOVE.TO given ICON, X, Y
''
'' AUTHOR: Steve Bailey
'' CREATED: 8-7-90
'' DESCRIPTION:
''     This routine moves an icon from one location to another
''

define ICON as a pointer variable
define X,Y as real variables
define DX,DY as integer variables
define NUM.MOVING as an integer saved variable

let DX = X - LOCATION.X(ICON)
let DY = Y - LOCATION.Y(ICON)

'' move icon to station
if DX ne 0 or DY ne 0
    let DISTANCE = SQRT.F(DX*DX + DY*DY)
    add 1 to NUM.MOVING
    let TIMESCALE.V = TIMESCALE
    let VELOCITY.A(ICON) = VELOCITY.F(.EMPLOYEE.SPEED,ARCTAN.F(DY,DX))
    work DISTANCE / .EMPLOYEE.SPEED .SECONDS
    let VELOCITY.A(ICON) = 0
    subtract 1 from NUM.MOVING
    if NUM.MOVING eq 0 and COMPRESS.TIME ne 0
        let TIMESCALE.V = 0
    always
always

display ICON at (X, Y)

return
end
