Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
BranchInstruction.cs
Go to the documentation of this file.
2
3internal sealed class BranchInstruction : OffsetInstruction
4{
5 private static Instruction[][][] s_caches;
6
7 internal readonly bool _hasResult;
8
9 internal readonly bool _hasValue;
10
11 public override Instruction[] Cache
12 {
13 get
14 {
15 if (s_caches == null)
16 {
17 s_caches = new Instruction[2][][]
18 {
19 new Instruction[2][],
20 new Instruction[2][]
21 };
22 }
24 }
25 }
26
27 public override string InstructionName => "Branch";
28
29 public override int ConsumedStack
30 {
31 get
32 {
33 if (!_hasValue)
34 {
35 return 0;
36 }
37 return 1;
38 }
39 }
40
41 public override int ProducedStack
42 {
43 get
44 {
45 if (!_hasResult)
46 {
47 return 0;
48 }
49 return 1;
50 }
51 }
52
54 : this(hasResult: false, hasValue: false)
55 {
56 }
57
58 public BranchInstruction(bool hasResult, bool hasValue)
59 {
60 _hasResult = hasResult;
61 _hasValue = hasValue;
62 }
63
64 public override int Run(InterpretedFrame frame)
65 {
66 return _offset;
67 }
68}