Prevents infinite propagation on input proxy and judge.
This commit is contained in:
@@ -4,6 +4,7 @@ using Cryville.Common.Unity.Input;
|
||||
using Cryville.Crtr.Config;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cryville.Crtr {
|
||||
@@ -209,14 +210,15 @@ namespace Cryville.Crtr {
|
||||
}
|
||||
static readonly int _var_fv = IdentifierManager.SharedInstance.Request("fv");
|
||||
static readonly int _var_tv = IdentifierManager.SharedInstance.Request("tv");
|
||||
unsafe void OnInput(InputIdentifier id, Identifier target, float ft, float tt, bool nullflag) {
|
||||
unsafe void OnInput(InputIdentifier id, Identifier target, float ft, float tt, bool nullflag, int depth = 0) {
|
||||
if (depth >= 16) throw new InputProxyException("Input propagation limit reached\nThe ruleset has invalid input definitions");
|
||||
var def = _ruleset.inputs[target];
|
||||
if (def.pass != null) {
|
||||
foreach (var p in def.pass) {
|
||||
_etor.ContextCascadeInsert();
|
||||
_arbop.Name = _var_value;
|
||||
if (!nullflag) _etor.Evaluate(_arbop, p.Value);
|
||||
OnInput(id, p.Key, ft, tt, nullflag);
|
||||
OnInput(id, p.Key, ft, tt, nullflag, depth + 1);
|
||||
_etor.ContextCascadeDiscard();
|
||||
}
|
||||
}
|
||||
@@ -306,4 +308,12 @@ namespace Cryville.Crtr {
|
||||
return !lhs.Equals(rhs);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class InputProxyException : Exception {
|
||||
public InputProxyException() { }
|
||||
public InputProxyException(string message) : base(message) { }
|
||||
public InputProxyException(string message, Exception inner) : base(message, inner) { }
|
||||
protected InputProxyException(SerializationInfo info, StreamingContext context) : base(info, context) { }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user