mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-15 13:14:17 +01:00
Some fixes with collection inheritance.
This commit is contained in:
parent
9508b8d9b3
commit
3e9f9289e5
4 changed files with 35 additions and 13 deletions
|
|
@ -88,13 +88,18 @@ public partial class ModCollection
|
|||
public void RemoveInheritance( int idx )
|
||||
{
|
||||
var inheritance = _inheritance[ idx ];
|
||||
inheritance.ModSettingChanged -= OnInheritedModSettingChange;
|
||||
inheritance.InheritanceChanged -= OnInheritedInheritanceChange;
|
||||
ClearSubscriptions( inheritance );
|
||||
_inheritance.RemoveAt( idx );
|
||||
InheritanceChanged.Invoke( false );
|
||||
PluginLog.Debug( "Removed {InheritedName:l} from {Name:l} inheritances.", inheritance.AnonymizedName, AnonymizedName );
|
||||
}
|
||||
|
||||
private void ClearSubscriptions( ModCollection other )
|
||||
{
|
||||
other.ModSettingChanged -= OnInheritedModSettingChange;
|
||||
other.InheritanceChanged -= OnInheritedInheritanceChange;
|
||||
}
|
||||
|
||||
// Order in the inheritance list is relevant.
|
||||
public void MoveInheritance( int from, int to )
|
||||
{
|
||||
|
|
@ -115,6 +120,13 @@ public partial class ModCollection
|
|||
ModSettingChanged.Invoke( type, modIdx, oldValue, groupIdx, true );
|
||||
return;
|
||||
default:
|
||||
if( modIdx < 0 || modIdx >= _settings.Count )
|
||||
{
|
||||
PluginLog.Warning(
|
||||
$"Collection state broken, Mod {modIdx} in inheritance does not exist. ({_settings.Count} mods exist)." );
|
||||
return;
|
||||
}
|
||||
|
||||
if( _settings[ modIdx ] == null )
|
||||
{
|
||||
ModSettingChanged.Invoke( type, modIdx, oldValue, groupIdx, true );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue