Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
IntSwitchInstruction.cs
Go to the documentation of this file.
2
4
5internal sealed class IntSwitchInstruction<T> : Instruction
6{
7 private readonly Dictionary<T, int> _cases;
8
9 public override string InstructionName => "IntSwitch";
10
11 public override int ConsumedStack => 1;
12
17
18 public override int Run(InterpretedFrame frame)
19 {
20 if (!_cases.TryGetValue((T)frame.Pop(), out var value))
21 {
22 return 1;
23 }
24 return value;
25 }
26}
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)