mirror of
https://github.com/haven1433/HexManiacAdvance.git
synced 2026-06-01 04:53:29 -05:00
Expand tables using safe data
only expand the table using data that was already within the table for the new elements. This means that if you're doubling-or-more, you'll get the first element potentially multiple times (before you would get a _negative_ element, which doesn't exist)
This commit is contained in:
parent
8545fa95cb
commit
fc821ddd9d
|
|
@ -596,7 +596,8 @@ namespace HavenSoft.HexManiac.Core.Models.Runs {
|
|||
var newRun = model.RelocateForExpansion(token, run, naturalLength + length * run.ElementLength);
|
||||
for (int i = 0; i < run.ElementLength * length; i++) {
|
||||
var prevIndex = newRun.Start + naturalLength + i - newRun.ElementLength * length;
|
||||
byte prevData = prevIndex > newRun.Start ? model[prevIndex] : default;
|
||||
while (prevIndex < newRun.Start) prevIndex += newRun.ElementLength;
|
||||
byte prevData = prevIndex >= newRun.Start ? model[prevIndex] : default;
|
||||
token.ChangeData(model, newRun.Start + naturalLength + i, prevData);
|
||||
}
|
||||
for (int i = naturalLength + length * run.ElementLength; i < naturalLength; i++) if (model[newRun.Start + i] != 0xFF) token.ChangeData(model, newRun.Start + i, 0xFF);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user