From 010cf85ad014e17587214e4b2627e2a87b5376f2 Mon Sep 17 00:00:00 2001 From: Yannick Lohse Date: Mon, 4 Jul 2016 18:45:06 +0200 Subject: [PATCH] More obvious fix for #17 --- engine/Story.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/Story.js b/engine/Story.js index 02489b5f..b0e73c10 100644 --- a/engine/Story.js +++ b/engine/Story.js @@ -638,9 +638,6 @@ export class Story extends InkObject{ case ControlCommand.CommandType.EndString: - // Since we're iterating backward through the content, - // build a stack so that when we build the string, - // it's in the right order var contentStackForString = []; var outputCountConsumed = 0; @@ -662,9 +659,12 @@ export class Story extends InkObject{ // Consume the content that was produced for this string this.state.outputStream.splice(this.state.outputStream.length - outputCountConsumed, outputCountConsumed); + //the C# version uses a Stack for contentStackForString, but we're using a simple array, so we need to reverse it before using it + contentStackForString = contentStackForString.reverse(); + // Build string out of the content we collected var sb = ''; - contentStackForString.reverse().forEach(c => { + contentStackForString.forEach(c => { sb += c.toString(); });