Fixing minor inline divert bug
This commit is contained in:
@@ -18,7 +18,7 @@ class RunStoryDemo {
|
||||
}
|
||||
}
|
||||
|
||||
var story: Story = new Story(false, "transcript.hanktest");
|
||||
var story: Story = new Story(false, StringTools.replace(path, '.hank', '.hog'));
|
||||
story.loadScript(path);
|
||||
var frame = StoryFrame.Finished;
|
||||
do {
|
||||
|
||||
13
src/Story.hx
13
src/Story.hx
@@ -570,14 +570,21 @@ class Story {
|
||||
queueEmbeddedBlock(dummyFile);
|
||||
}
|
||||
|
||||
private function peekUnlessNextLineText(): String {
|
||||
/**
|
||||
Scan ahead to get the next text that will be output during story execution,
|
||||
stopping if a choice is found
|
||||
**/
|
||||
private function nextOutputText(): String {
|
||||
var idx = currentLineIdx;
|
||||
var frame = processNextLine(); // TODO if it's a choice, just return the text before divert and rewind.
|
||||
var frame = processNextLine();
|
||||
var val = '';
|
||||
switch (frame) {
|
||||
case HasText(text):
|
||||
val = text;
|
||||
case Empty:
|
||||
return nextOutputText();
|
||||
default:
|
||||
// TODO if it's something that interrupts execution (such as a choice point), return no text and rewind.
|
||||
currentLineIdx = idx;
|
||||
}
|
||||
return val;
|
||||
@@ -609,7 +616,7 @@ class Story {
|
||||
}
|
||||
|
||||
divert(divertTarget);
|
||||
var peekValue = peekUnlessNextLineText();
|
||||
var peekValue = nextOutputText();
|
||||
// trace('peek value: ${peekValue}');
|
||||
textToOutput = beforeDivert + peekValue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user