From 7f76bce4ea56acc7b1b1c309e6e27893d958c52b Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Tue, 30 Apr 2019 18:52:26 -0600 Subject: [PATCH] Shuffle example --- {old-examples => examples}/shuffle/main.hank | 0 {old-examples => examples}/shuffle/test1.hlog | 0 hank/Output.hx | 6 +++++- 3 files changed, 5 insertions(+), 1 deletion(-) rename {old-examples => examples}/shuffle/main.hank (100%) rename {old-examples => examples}/shuffle/test1.hlog (100%) diff --git a/old-examples/shuffle/main.hank b/examples/shuffle/main.hank similarity index 100% rename from old-examples/shuffle/main.hank rename to examples/shuffle/main.hank diff --git a/old-examples/shuffle/test1.hlog b/examples/shuffle/test1.hlog similarity index 100% rename from old-examples/shuffle/test1.hlog rename to examples/shuffle/test1.hlog diff --git a/hank/Output.hx b/hank/Output.hx index a7c3c76..2025549 100644 --- a/hank/Output.hx +++ b/hank/Output.hx @@ -169,7 +169,11 @@ class Output { if (!altInstances.exists(a)) { altInstances[a] = new AltInstance(a.behavior, a.outputs, random); } - fullOutput += altInstances[a].next().format(story, hInterface, random, altInstances, scope, displayToggles); + var nextBranchOutput = altInstances[a].next(); + fullOutput += nextBranchOutput.format(story, hInterface, random, altInstances, scope, displayToggles); + if (nextBranchOutput.diverted) { + break; + } case HExpression(h): trace(h); var value = hInterface.evaluateExpr(h, scope);