(include "sci.sh")
(use "Main")
(use "Cycle")
(script 945)



(procedure public (proc945_0 param1 param2)
    return | StrAt(param1 (* 2 param2)) (<< StrAt(param1 (+ 1 (* 2 param2))) $0008)
)


(class PolyPath of Motion
    (properties
        client 0
        caller 0
        x 0
        y 0
        dx 0
        dy 0
        {b-moveCnt} 0
        {b-i1} 0
        {b-i2} 0
        {b-di} 0
        {b-xAxis} 0
        {b-incr} 0
        completed 0
        xLast 0
        yLast 0
        value 2
        points 0
    )

    (method (init theClient param2 param3 theCaller param5)
        (if (paramTotal)
            = client theClient
            (if (> paramTotal 1)
                = points AvoidPath((send theClient:x) (send theClient:y) param2 param3 
                        (if ((send global2:obstacles))
                            (send ((send global2:obstacles)):elements)
                        )(else
                            0
                        )
 
                        (if ((send global2:obstacles))
                            (send ((send global2:obstacles)):size)
                        )(else
                            0
                        )
 
                        (if (>= paramTotal 5)
                            param5
                        )(else
                            1
                        )
)
                (if (> paramTotal 3)
                    = caller theCaller
                )
            )
        )
        (self:setTarget())
        (super:init())
    )


    (method (dispose)
        (if (points)
            Memory(3 points)
        )
        (super:dispose())
    )


    (method (moveDone)
        (if (== proc945_0(points value) 30583)
            (super:moveDone())
        )(else
            (self:init())
        )
    )


    (method (setTarget)
        (if (<> proc945_0(points value) 30583)
            = x proc945_0(points value)
            = y proc945_0(points ++value)
            ++value
        )
    )

)
