Looky1173 / launchpad-bugs-migration

0 stars 0 forks source link

[BUG n°1141767] OR exp version 1467 freezes when wipers turned on. #177

Closed Looky1173 closed 1 year ago

Looky1173 commented 1 year ago

Imported from https://bugs.launchpad.net/bugs/1141767

Property Value
Reported by David Martin Lewis (j72tankengine)
Date reported Sun, 03 Mar 2013 09:28:53 GMT
Tags graphics

Route: BrisCard Activity: S- penarth_treherbert Train: ValleysClass117 5 car.con

Freeze / Crash occurs immediately when wipers are turned on with either "v" on keyboard or using wiper switch on RailDriver console.

This also happens on Midland Blue Pullman when running Thames-Trent activity "Nottingham Pullman".

Some other DMU's appear to work ok with wipers activated.

Dave (J72fan)

Looky1173 commented 1 year ago

Imported from https://bugs.launchpad.net/or/+bug/1141767/comments/1

Property Value
Posted by David Martin Lewis (j72tankengine)
Date posted Sun, 03 Mar 2013 09:28:53 GMT
Looky1173 commented 1 year ago

Imported from https://bugs.launchpad.net/or/+bug/1141767/comments/2

Property Value
Posted by cjakeman (cjakeman)
Date posted Sun, 03 Mar 2013 20:19:36 GMT

Hi David,

I've downloaded the ValleysClass117.zip from UKTrainSim.com and confirm that pressing V causes the sim to freeze regardless of the route and activity.

Any ORDevs want to take this one on?

Chris

Looky1173 commented 1 year ago

Imported from https://bugs.launchpad.net/or/+bug/1141767/comments/3

Property Value
Posted by David Martin Lewis (j72tankengine)
Date posted Mon, 04 Mar 2013 20:15:31 GMT

Just a further comment, I was driving a steam locomotive tonight (with no obvious wipers!) and thought I'd see what effect the RailDriver wiper switch had, it crashed OR leaving a strange 50Hz type audio hum which required a computer reboot to clear. Hope this helps.

Dave (J72fan)

Looky1173 commented 1 year ago

Imported from https://bugs.launchpad.net/or/+bug/1141767/comments/4

Property Value
Posted by Peter Gulyas (pzgulyas)
Date posted Tue, 05 Mar 2013 19:13:30 GMT

The error is in MSTSWagon.cs AnimatedPart.UpdateLoop() function. When FrameCount is zero, it results an infinite loop. (at about line 756)

So the correction could be to protect the while loop with en if() expression as follows:

if (FrameCount > 0) while (AnimationKey > FrameCount) AnimationKey -= FrameCount;

But I think James will make a more appropriate fix for this. :-)

P.S.: Just I'm curious, why is that while loop there? Does it result in a faster compiled code than the simpler expression of AnimationKey %= FrameCount; ?

Looky1173 commented 1 year ago

Imported from https://bugs.launchpad.net/or/+bug/1141767/comments/5

Property Value
Posted by cjakeman (cjakeman)
Date posted Tue, 05 Mar 2013 19:44:30 GMT

Hi Peter,

Not looked at the code myself, but an infinite loop sounds highly plausible.

Thanks for looking into it so quickly.

P.S. Are you familiar with the wonderfully named "Blame" function in SVN which reports who last changed each line?

Best wishes,

Chris

Looky1173 commented 1 year ago

Imported from https://bugs.launchpad.net/or/+bug/1141767/comments/6

Property Value
Posted by James Ross (twpol)
Date posted Tue, 05 Mar 2013 21:24:50 GMT

Fixed in V1470.

The code style is simply what's been used elsewhere in the code; also, the %= operation doesn't work when the value is negative without some extra work, for example. For now I just bail early if there are no frames - if we change the general style there's a whole load of places to fiddle with.