mirror of
https://github.com/haven1433/HexManiacAdvance.git
synced 2026-03-21 17:34:13 -05:00
bugfixes from discord
This commit is contained in:
parent
b96761cf17
commit
7cd9da7fc0
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using HavenSoft.HexManiac.Core.ViewModels.DataFormats;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace HavenSoft.HexManiac.Core.Models.Runs.Factory {
|
||||
public class OverworldSpriteListContentStrategy : RunStrategy {
|
||||
|
|
@ -40,6 +41,7 @@ namespace HavenSoft.HexManiac.Core.Models.Runs.Factory {
|
|||
|
||||
public override int LengthForNewRun(IDataModel model, int pointerAddress) {
|
||||
var destination = model.ReadPointer(pointerAddress);
|
||||
if (destination == Pointer.NULL) return 8;
|
||||
if (destination < 0 || destination >= model.Count) return -1;
|
||||
return new OverworldSpriteListRun(model, parentTemplate, Hint, 0, destination, new SortedSpan<int>(pointerAddress)).Length;
|
||||
}
|
||||
|
|
@ -75,7 +77,10 @@ namespace HavenSoft.HexManiac.Core.Models.Runs.Factory {
|
|||
}
|
||||
|
||||
public override IFormattedRun WriteNewRun(IDataModel owner, ModelDelta token, int source, int destination, string name, IReadOnlyList<ArrayRunElementSegment> sourceSegments) {
|
||||
return new OverworldSpriteListRun(owner, sourceSegments, Hint, 0, destination, new SortedSpan<int>(source));
|
||||
var run = new OverworldSpriteListRun(owner, sourceSegments, Hint, 0, destination, new SortedSpan<int>(source));
|
||||
owner.WritePointer(token, destination, Pointer.NULL);
|
||||
owner.WriteMultiByteValue(destination + 4, 4, token, 0x100);
|
||||
return run;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ namespace HavenSoft.HexManiac.Core.ViewModels.Tools {
|
|||
using (ModelCacheScope.CreateScope(model)) {
|
||||
if (SelectedTool == TableTool) TableTool.DataForCurrentRunChanged();
|
||||
if (SelectedTool == SpriteTool) SpriteTool.DataForCurrentRunChanged();
|
||||
if (SelectedTool == StringTool) StringTool.DataForCurrentRunChanged();
|
||||
CodeTool.IsSelected = SelectedTool == CodeTool;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,10 @@
|
|||
<PostBuildEvent>
|
||||
mkdir "$(TargetDir)resources"
|
||||
mkdir "$(TargetDir)resources\Scripts"
|
||||
mkdir "$(TargetDir)resources\Scripts\Add Mechanics From Later Generations"
|
||||
mkdir "$(TargetDir)resources\Scripts\internal"
|
||||
mkdir "$(TargetDir)resources\Scripts\Patches"
|
||||
mkdir "$(TargetDir)resources\Scripts\Update Existing Mechanics"
|
||||
copy "$(TargetDir)Models\Code\*.txt" "$(TargetDir)resources"
|
||||
del "$(TargetDir)Models\Code\*.txt"
|
||||
copy "$(TargetDir)Models\Code\*.toml" "$(TargetDir)resources"
|
||||
|
|
@ -64,6 +68,10 @@
|
|||
copy "$(TargetDir)Models\Code\*.py" "$(TargetDir)resources"
|
||||
del "$(TargetDir)Models\Code\*.py"
|
||||
copy "$(SolutionDir)src\HexManiac.WPF\Scripts\*.hma" "$(TargetDir)resources\Scripts"
|
||||
copy "$(SolutionDir)src\HexManiac.WPF\Scripts\Add Mechanics From Later Generations\*.hma" "$(TargetDir)resources\Scripts\Add Mechanics From Later Generations"
|
||||
copy "$(SolutionDir)src\HexManiac.WPF\Scripts\internal\*.hma" "$(TargetDir)resources\Scripts\internal"
|
||||
copy "$(SolutionDir)src\HexManiac.WPF\Scripts\Patches\*.hma" "$(TargetDir)resources\Scripts\Patches"
|
||||
copy "$(SolutionDir)src\HexManiac.WPF\Scripts\Update Existing Mechanics\*.hma" "$(TargetDir)resources\Scripts\Update Existing Mechanics"
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ namespace HavenSoft.HexManiac.Tests {
|
|||
if (tileset == null) continue;
|
||||
var hasPalette = tileset.Format.Contains("|");
|
||||
if (!hasPalette) continue;
|
||||
|
||||
|
||||
yield return new object[] { gameName, anchor.Name };
|
||||
}
|
||||
gameIndex++;
|
||||
|
|
@ -647,7 +647,7 @@ namespace HavenSoft.HexManiac.Tests {
|
|||
public void ExpandableTutorsWorks(string game) {
|
||||
var fileSystem = new StubFileSystem();
|
||||
var model = fixture.LoadModelNoCache(game);
|
||||
var editor = new New(fileSystem,fixture.Singletons).EditorViewModel();
|
||||
var editor = new New(fileSystem, fixture.Singletons).EditorViewModel();
|
||||
var viewPort = NewViewPort(game, model);
|
||||
editor.Add(viewPort);
|
||||
var expandTutors = editor.QuickEditsExpansion.Single(edit => edit.Name == new MakeTutorsExpandable().Name);
|
||||
|
|
@ -838,7 +838,7 @@ namespace HavenSoft.HexManiac.Tests {
|
|||
var errors = new List<string>();
|
||||
viewport.OnError += (sender, e) => errors.Add(e);
|
||||
|
||||
var fairyTypeScript = File.ReadAllBytes("resources/Scripts/AddFairyType.hma");
|
||||
var fairyTypeScript = File.ReadAllBytes("resources/Scripts/Add Mechanics From Later Generations/AnyGame_FairyType.hma");
|
||||
viewport.TryImport(new("fairy.hma", fairyTypeScript), default);
|
||||
|
||||
Assert.Empty(errors);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user