From cb1faf11678f676a964d99d6c97550e4220192cb Mon Sep 17 00:00:00 2001 From: Anna Date: Wed, 10 Mar 2021 14:13:19 -0500 Subject: [PATCH] refactor: put 81 into a const --- HUD Manager/Configuration/SavedLayout.cs | 2 +- HUD Manager/Hud.cs | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/HUD Manager/Configuration/SavedLayout.cs b/HUD Manager/Configuration/SavedLayout.cs index b8b1b65..bda22c1 100644 --- a/HUD Manager/Configuration/SavedLayout.cs +++ b/HUD Manager/Configuration/SavedLayout.cs @@ -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())); } diff --git a/HUD Manager/Hud.cs b/HUD Manager/Hud.cs index 1e6a341..bba55b0 100644 --- a/HUD Manager/Hud.cs +++ b/HUD Manager/Hud.cs @@ -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())); }