@@ -41,7 +41,7 @@ public class LampPlayer
41
41
/// <summary>
42
42
/// Links the GLE's IDs to the mappings.
43
43
/// </summary>
44
- private readonly Dictionary < string , Dictionary < int , Dictionary < ILampDeviceComponent , LampMapping > > > _lampMappings = new ( ) ;
44
+ private readonly Dictionary < string , Dictionary < ILampDeviceComponent , Dictionary < int , LampMapping > > > _lampMappings = new ( ) ;
45
45
46
46
private Player ? _player ;
47
47
private TableComponent ? _tableComponent ;
@@ -132,10 +132,11 @@ private void Apply(string id, int internalId, LampSource lampSource, bool isCoil
132
132
{
133
133
if ( _lampAssignments . ContainsKey ( id ) ) {
134
134
foreach ( var component in _lampAssignments [ id ] ) {
135
- if ( ! _lampMappings [ id ] . ContainsKey ( internalId ) ) {
135
+
136
+ if ( ! _lampMappings [ id ] [ component ] . ContainsKey ( internalId ) ) {
136
137
continue ;
137
138
}
138
- var mapping = _lampMappings [ id ] [ internalId ] [ component ] ;
139
+ var mapping = _lampMappings [ id ] [ component ] [ internalId ] ;
139
140
if ( mapping . Source != lampSource || mapping . IsCoil != isCoil ) {
140
141
// so, if we have a coil here that happens to have the same name as a lamp,
141
142
// or a GI light with the same name as an other lamp, skip.
@@ -230,13 +231,13 @@ private void AssignLampMapping(LampMapping lampMapping)
230
231
_lampAssignments [ id ] = new List < ILampDeviceComponent > ( ) ;
231
232
}
232
233
if ( ! _lampMappings . ContainsKey ( id ) ) {
233
- _lampMappings [ id ] = new Dictionary < int , Dictionary < ILampDeviceComponent , LampMapping > > ( ) ;
234
+ _lampMappings [ id ] = new Dictionary < ILampDeviceComponent , Dictionary < int , LampMapping > > ( ) ;
234
235
}
235
236
_lampAssignments [ id ] . Add ( lampMapping . Device ) ;
236
- if ( ! _lampMappings [ id ] . ContainsKey ( lampMapping . InternalId ) ) {
237
- _lampMappings [ id ] [ lampMapping . InternalId ] = new Dictionary < ILampDeviceComponent , LampMapping > ( ) ;
237
+ if ( ! _lampMappings [ id ] . ContainsKey ( lampMapping . Device ) ) {
238
+ _lampMappings [ id ] [ lampMapping . Device ] = new Dictionary < int , LampMapping > ( ) ;
238
239
}
239
- _lampMappings [ id ] [ lampMapping . InternalId ] [ lampMapping . Device ] = lampMapping ;
240
+ _lampMappings [ id ] [ lampMapping . Device ] [ lampMapping . InternalId ] = lampMapping ;
240
241
241
242
if ( ! LampStates . ContainsKey ( id ) ) {
242
243
LampStates [ id ] = new LampState ( lampMapping . Device . LampStatus , lampMapping . Device . LampColor . ToEngineColor ( ) ) ;
0 commit comments