refactor: put 81 into a const

This commit is contained in:
Anna 2021-03-10 14:13:19 -05:00
parent 6b71493f6b
commit cb1faf1167
2 changed files with 6 additions and 5 deletions

View File

@ -30,7 +30,7 @@ namespace HUD_Manager.Configuration {
public Layout ToLayout() {
var elements = this.Elements.Values.ToList();
while (elements.Count < 81) {
while (elements.Count < Hud.InMemoryLayoutElements) {
elements.Add(new Element(new RawElement()));
}

View File

@ -10,9 +10,10 @@ using HUD_Manager.Tree;
namespace HUD_Manager {
public class Hud {
// Updated 5.45
// This is 81 elements * 36 bytes each. Each element is 32 bytes in ADDON.DAT,
// but they're 36 bytes when loaded into memory.
private const int LayoutSize = 0xb64;
public const int InMemoryLayoutElements = 81;
// Updated 5.45
// Each element is 32 bytes in ADDON.DAT, but they're 36 bytes when loaded into memory.
private const int LayoutSize = InMemoryLayoutElements * 36;
// Updated 5.4
private const int SlotOffset = 0x59e8;
@ -153,7 +154,7 @@ namespace HUD_Manager {
var elemList = elements.Values.ToList();
while (elemList.Count < 81) {
while (elemList.Count < InMemoryLayoutElements) {
elemList.Add(new Element(new RawElement()));
}