mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-01-02 05:43:42 +01:00
Make the limit of 32 options for a multi-select group explicit and handle it better.
This commit is contained in:
parent
976f7840cd
commit
a86a73bbf5
5 changed files with 73 additions and 37 deletions
|
|
@ -15,6 +15,8 @@ public enum SelectType
|
|||
|
||||
public interface IModGroup : IEnumerable< ISubMod >
|
||||
{
|
||||
public const int MaxMultiOptions = 32;
|
||||
|
||||
public string Name { get; }
|
||||
public string Description { get; }
|
||||
public SelectType Type { get; }
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Dalamud.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OtterGui.Filesystem;
|
||||
|
|
@ -57,6 +58,11 @@ public partial class Mod
|
|||
{
|
||||
foreach( var child in options.Children() )
|
||||
{
|
||||
if( ret.PrioritizedOptions.Count == IModGroup.MaxMultiOptions )
|
||||
{
|
||||
PluginLog.Warning($"Multi Group {ret.Name} has more than {IModGroup.MaxMultiOptions} options, ignoring excessive options." );
|
||||
break;
|
||||
}
|
||||
var subMod = new SubMod();
|
||||
subMod.Load( basePath, child, out var priority );
|
||||
ret.PrioritizedOptions.Add( ( subMod, priority ) );
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public class ModSettings
|
|||
=> group.Type switch
|
||||
{
|
||||
SelectType.Single => ( uint )Math.Min( value, group.Count - 1 ),
|
||||
SelectType.Multi => ( uint )( value & ( ( 1 << group.Count ) - 1 ) ),
|
||||
SelectType.Multi => ( uint )( value & ( ( 1ul << group.Count ) - 1 ) ),
|
||||
_ => value,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue