mirror of
https://github.com/haven1433/HexManiacAdvance.git
synced 2026-05-18 19:16:46 -05:00
allow scripts to see scripts before they start
This commit is contained in:
parent
c12d15bb04
commit
53b4ed35e0
|
|
@ -879,7 +879,7 @@ namespace HavenSoft.HexManiac.Core.Models.Code {
|
|||
// (1) the run has no name
|
||||
// (2) the run has only one source (the script)
|
||||
if (run is NoInfoRun || run.PointerSources == null) return -1;
|
||||
if (run is IScriptStartRun) return -1; // this script has a length, but don't track it (prevent recursion loop)
|
||||
if (run is IScriptStartRun) return 1; // this script has a length, but don't calculate it (prevent recursion loop)
|
||||
if (run.PointerSources.Count == 1 && string.IsNullOrEmpty(model.GetAnchorFromAddress(-1, destination))) {
|
||||
return run.Length;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -873,5 +873,15 @@ label2:;goto <000050>;end";
|
|||
Assert.Equal(8, run.Start);
|
||||
Assert.IsType<PointerRun>(run);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ScriptGotoBeforeScriptStarts_Reload_IncludesSubScript() {
|
||||
EventScript = "end";
|
||||
ViewPort.Goto.Execute(0x10);
|
||||
|
||||
EventScript = "if.yes.goto <section1>;end;section1:;if.yes.goto <000000>;end";
|
||||
|
||||
Assert.Equal(2, Tool.Contents.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user