freezy / VisualPinball.Engine

:video_game: Visual Pinball Engine for Unity
https://docs.visualpinball.org
GNU General Public License v3.0
404 stars 62 forks source link

Switch manager not showing correct status for multi-matched switch devices #345

Closed jsm174 closed 2 years ago

jsm174 commented 2 years ago

This was discovered while working on https://github.com/freezy/VisualPinball.Engine/pull/344.

We are seeing that the switch manager is not showing the correct status for multi-matched switch devices.

Using Rock as our example, switch 41 is currently used in 8 places:

If the user hits A, all 41 entries in the Switch Manager close. Totally fine.

Screen Shot 2021-11-23 at 6 51 53 PM

However, if the user hits B, C , D, E, F, G, H, the entries in the switch manager will not close.

The Game Logic Engine will work fine and PinMame registers the switch for A - H.

The SwitchPlayer statuses are a dictionary by ID 41 https://github.com/freezy/VisualPinball.Engine/blob/67aca1d72b51a92e66389a46fe1ae09282d4bde3/VisualPinball.Unity/VisualPinball.Unity/Game/SwitchPlayer.cs#L87-L90

So when the player is populating the dictionary, each ID 41 switch device overwrites the last one.

So that's why the manager looks like its only monitoring one device.

jsm174 commented 2 years ago

This was fixed in https://github.com/freezy/VisualPinball.Engine/pull/347.