Add in_area function. (Amend)
This commit is contained in:
@@ -20,6 +20,13 @@ namespace Cryville.Common.Pdt {
|
|||||||
Length = len;
|
Length = len;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Copies the memory in the span to another span.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dest">The destination span.</param>
|
||||||
|
public void CopyTo(PdtVariableMemory dest) {
|
||||||
|
CopyTo(dest._ptr, 0, Length);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
/// Copies the memory in the span to a buffer.
|
/// Copies the memory in the span to a buffer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dest">The destination buffer.</param>
|
/// <param name="dest">The destination buffer.</param>
|
||||||
|
@@ -388,14 +388,18 @@ namespace Cryville.Crtr {
|
|||||||
public func_in_area() : base(1) { }
|
public func_in_area() : base(1) { }
|
||||||
protected override unsafe void Execute() {
|
protected override unsafe void Execute() {
|
||||||
var arg = GetOperand(0);
|
var arg = GetOperand(0);
|
||||||
if (arg.Type == PdtInternalType.Number && arg.AsNumber() >= 0) {
|
if (arg.Type == PdtInternalType.Error) {
|
||||||
GetReturnFrame(PdtInternalType.Null, 0);
|
throw new InvalidOperationException("Error");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else if (arg.Type == PdtInternalType.Number && arg.AsNumber() >= 0) {
|
||||||
|
GetReturnFrame(PdtInternalType.Null, 0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
var ret = GetReturnFrame(arg.Type, arg.Length);
|
var ret = GetReturnFrame(arg.Type, arg.Length);
|
||||||
arg.CopyTo(ret);
|
arg.CopyTo(ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
unsafe static class oputil {
|
unsafe static class oputil {
|
||||||
public static float AsNumber(PropSrc src) {
|
public static float AsNumber(PropSrc src) {
|
||||||
if (src == null)
|
if (src == null)
|
||||||
|
Reference in New Issue
Block a user