How does runLocalStepMethodsIn: aWorld work?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How does runLocalStepMethodsIn: aWorld work?

Stephan Eggermont-3
Looking at how to do autoscrolling when drag-holding, we ran into:

WorldState>>runLocalStepmethodsIn: aWorld does interesting things
with the lastStepMessage. Can anyone explain how this works?

Why does it not do anything with
        lastStepMessage value: now.
and then test for
        lastStepMessage ifNotNil:

There's a comment about buggy morphs. Were they so buggy that they
did a become on a message send? Or do I totally misunderstand this stuff?

Stephan


Reply | Threaded
Open this post in threaded view
|

Re: How does runLocalStepMethodsIn: aWorld work?

marcel.taeumel
Hi Stephan,

I suspect WorldState >> #stopStepping:  or WorldState >> #stopStepping:selector:. If the step message calls something like "self stopStepping", then you do not want another step call but an immediate stop of the stepping.

WorldState >> stopStepping: aMorph
        "Remove the given morph from the step list."
        lastStepMessage ifNotNil:[
                (lastStepMessage receiver == aMorph) ifTrue:[lastStepMessage := nil]].
        stepList removeAll: (stepList select:[:stepMsg| stepMsg receiver == aMorph]).

Hence, there is no suspicious "become" but only a nasty side-effect. :)

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: How does runLocalStepMethodsIn: aWorld work?

marcel.taeumel
I think that WorldState >> #stopStepping: (resp. Morph >> #stopStepping) is also part of the machinery for controlling buggy morphs to not go wild. Try browsing senders of #stopStepping. Therefore, you remove the morph from the stepping list before you let it step. If everything worked out fine, that is lastStepMessage is not nil, you put it into the list again.

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: How does runLocalStepMethodsIn: aWorld work?

Stephan Eggermont-3
In reply to this post by marcel.taeumel
On 27-11-15 12:25, marcel.taeumel wrote:

> Hi Stephan,
>
> I suspect WorldState >> #stopStepping:  or WorldState >>
> #stopStepping:selector:. If the step message calls something like "self
> stopStepping", then you do not want another step call but an immediate stop
> of the stepping.
>
> WorldState >> stopStepping: aMorph
>
> Hence, there is no suspicious "become" but only a nasty side-effect. :)

Ah yes, I see. Interesting approach.

Stephan