mirror of
https://github.com/haven1433/HexManiacAdvance.git
synced 2026-10-02 05:06:35 -05:00
changes to enums and element names are now reflected immediately.
This commit is contained in:
@@ -155,6 +155,8 @@ namespace HavenSoft.HexManiac.Core.Models.Runs {
|
||||
cachedOptions = results;
|
||||
return results;
|
||||
}
|
||||
|
||||
public void ClearCache() { cachedOptions = null; }
|
||||
}
|
||||
|
||||
public class ArrayOffset {
|
||||
@@ -580,6 +582,21 @@ namespace HavenSoft.HexManiac.Core.Models.Runs {
|
||||
return new ArrayRun(owner, FormatString, LengthFromAnchor, newStart, ElementCount, ElementContent, PointerSources, PointerSourcesForInnerElements);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// For performance reasons, arrays store copies of strings from arrays that they're based on.
|
||||
/// For example, if the array contains an enum of types, that enum segment will store the list of types.
|
||||
/// For example, if the array is the same length as the pokemon array, the array will store the list of pokemon names.
|
||||
/// Calling this method will clear those caches and force re-evaluation.
|
||||
/// </summary>
|
||||
public void ClearCache() {
|
||||
cachedElementNames = null;
|
||||
foreach (var child in ElementContent) {
|
||||
if (child is ArrayRunEnumSegment enumSegment) {
|
||||
enumSegment.ClearCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override IFormattedRun RemoveSource(int source) {
|
||||
if (!SupportsPointersToElements) return base.RemoveSource(source);
|
||||
var newPointerSources = PointerSources.Where(item => item != source).ToList();
|
||||
|
||||
@@ -1281,7 +1281,10 @@ namespace HavenSoft.HexManiac.Core.ViewModels {
|
||||
for (int y = 0; y < Height; y++) {
|
||||
for (int x = 0; x < Width; x++) {
|
||||
var index = scroll.ViewPointToDataIndex(new Point(x, y));
|
||||
if (run == null || index >= run.Start + run.Length) run = Model.GetNextRun(index) ?? new NoInfoRun(Model.Count);
|
||||
if (run == null || index >= run.Start + run.Length) {
|
||||
run = Model.GetNextRun(index) ?? new NoInfoRun(Model.Count);
|
||||
if (run is ArrayRun array) array.ClearCache();
|
||||
}
|
||||
if (index < 0 || index >= Model.Count) {
|
||||
currentView[x, y] = HexElement.Undefined;
|
||||
} else if (index >= run.Start) {
|
||||
|
||||
Reference in New Issue
Block a user