Skip to content

Commit

Permalink
Merge branch 'Albeoris:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
SamsamTS authored Feb 18, 2024
2 parents d1faf4c + 63990b6 commit fc75034
Show file tree
Hide file tree
Showing 50 changed files with 2,338 additions and 1,303 deletions.
2 changes: 1 addition & 1 deletion Assembly-CSharp/Assembly-CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<AssemblyName>Assembly-CSharp</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Unity Full v3.5</TargetFrameworkProfile>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FrameworkPathOverride>$(SolutionDir)\References\</FrameworkPathOverride>
<LangVersion>latest</LangVersion>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,67 +1,79 @@
using System;
using System.Collections.Generic;
using Memoria.Prime;

namespace Assets.Sources.Scripts.EventEngine.Utils
{
public class CalcStack
{
public Boolean push(Int32 arg0)
public Boolean push(Int32 val)
{
if (this.topOfStackID >= this.stack.Length - 1)
return false;
this.stack[this.topOfStackID] = arg0;
this.topOfStackID++;
while (topOfStackID >= stack.Count)
stack.Add(0);
stack[topOfStackID++] = val;
return true;
}

public Boolean pop(out Int32 output)
{
if (this.topOfStackID == 0)
if (topOfStackID == 0)
{
Log.Error($"[{nameof(CalcStack)}.{nameof(pop)}] this.topOfStackID == 0");
Log.Error($"[{nameof(CalcStack)}.{nameof(pop)}] topOfStackID == 0");
output = default;
return false;
}
output = this.stack[this.topOfStackID - 1];
this.topOfStackID--;
output = stack[--topOfStackID];
return true;
}

public Boolean advanceTopOfStack()
{
if (this.topOfStackID >= this.stack.Length - 1)
return false;
this.topOfStackID++;
topOfStackID++;
while (topOfStackID > stack.Count)
stack.Add(0);
return true;
}

public Boolean retreatTopOfStack()
{
if (this.topOfStackID == 0)
if (topOfStackID == 0)
return false;
this.topOfStackID--;
topOfStackID--;
return true;
}

public void emptyCalcStack()
{
for (Int32 i = 0; i < this.stack.Length; i++)
this.stack[i] = 0;
this.topOfStackID = 0;
substack.Clear();
for (Int32 i = 0; i < stack.Count; i++)
stack[i] = 0;
topOfStackID = 0;
}

public Int32 getTopOfStackID()
{
return this.topOfStackID;
return topOfStackID;
}

public Int32 getValueAtOffset(Int32 offset)
{
return this.stack[this.topOfStackID + offset];
return stack[topOfStackID + offset];
}

public void pushSubs(params Int32[] val)
{
substack[topOfStackID] = new List<Int32>(val);
}

public List<Int32> getSubs()
{
if (substack.TryGetValue(topOfStackID, out List<Int32> result))
return result;
return new List<Int32>();
}

private const Int32 STACK_SIZE = 16;
private Int32[] stack = new Int32[STACK_SIZE];
private Dictionary<Int32, List<Int32>> substack = new Dictionary<Int32, List<Int32>>();
private List<Int32> stack = new List<Int32>(16);
private Int32 topOfStackID;
}
}
Loading

0 comments on commit fc75034

Please sign in to comment.