diff --git a/Assets/Cryville/Common/Pdt/PdtVariableMemory.cs b/Assets/Cryville/Common/Pdt/PdtVariableMemory.cs index 936d0da..8f3db02 100644 --- a/Assets/Cryville/Common/Pdt/PdtVariableMemory.cs +++ b/Assets/Cryville/Common/Pdt/PdtVariableMemory.cs @@ -20,6 +20,13 @@ namespace Cryville.Common.Pdt { Length = len; } /// + /// Copies the memory in the span to another span. + /// + /// The destination span. + public void CopyTo(PdtVariableMemory dest) { + CopyTo(dest._ptr, 0, Length); + } + /// /// Copies the memory in the span to a buffer. /// /// The destination buffer. diff --git a/Assets/Cryville/Crtr/PdtEvaluator.cs b/Assets/Cryville/Crtr/PdtEvaluator.cs index 5516830..d0695ec 100644 --- a/Assets/Cryville/Crtr/PdtEvaluator.cs +++ b/Assets/Cryville/Crtr/PdtEvaluator.cs @@ -388,12 +388,16 @@ namespace Cryville.Crtr { public func_in_area() : base(1) { } protected override unsafe void Execute() { var arg = GetOperand(0); - if (arg.Type == PdtInternalType.Number && arg.AsNumber() >= 0) { - GetReturnFrame(PdtInternalType.Null, 0); - return; + if (arg.Type == PdtInternalType.Error) { + throw new InvalidOperationException("Error"); + } + else if (arg.Type == PdtInternalType.Number && arg.AsNumber() >= 0) { + GetReturnFrame(PdtInternalType.Null, 0); + } + else { + var ret = GetReturnFrame(arg.Type, arg.Length); + arg.CopyTo(ret); } - var ret = GetReturnFrame(arg.Type, arg.Length); - arg.CopyTo(ret); } } unsafe static class oputil {