Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
y-lohse committed Jul 4, 2016
2 parents 439386b + 0501803 commit 5a804a8
Show file tree
Hide file tree
Showing 20 changed files with 11 additions and 35 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dist/
test/stories/

# Logs
logs
Expand Down
8 changes: 4 additions & 4 deletions engine/Story.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -662,6 +659,9 @@ 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.forEach(c => {
Expand Down Expand Up @@ -1180,7 +1180,7 @@ export class Story extends InkObject{
var numElements = numElementsIntVal.value;

// var seqCountVal = state.PopEvaluationStack () as IntValue;
var seqCountVal = tjis.state.PopEvaluationStack();
var seqCountVal = this.state.PopEvaluationStack();
var seqCount = seqCountVal.value;
var loopIndex = seqCount / numElements;
var iterationIndex = seqCount % numElements;
Expand Down
7 changes: 4 additions & 3 deletions engine/VariablesState.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class VariablesState{
this.variableChangedEventCallbacks = [];

//if es6 proxies are available, use them.
if (Proxy){
try{
//the proxy is used to allow direct manipulation of global variables. It first tries to access the objetcs own property, and if none is found it delegates the call to the $ method, defined below
var p = new Proxy(this, {
get: function(target, name){
Expand All @@ -34,8 +34,9 @@ export class VariablesState{

return p;
}
else{
console.log("ES6 Proxy not available - direct manipulation of global variables can't work, use $() instead.");
catch(e){
//thr proxy object is not available in this context. we should warn the dev but writting to the console feels a bit intrusive.
// console.log("ES6 Proxy not available - direct manipulation of global variables can't work, use $() instead.");
}
}
get batchObservingVariableChanges(){
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "inkjs",
"version": "1.0.1",
"version": "1.0.2",
"description": "A javascript port of inkle's ink scripting language (http://www.inklestudios.com/ink/)",
"main": "dist/ink.cjs.js",
"scripts": {
Expand Down
6 changes: 1 addition & 5 deletions test/simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@ var rl = readline.createInterface({
output: process.stdout
});

var inkFile = fs.readFileSync(__dirname + '/stories/intercept.ink.json', 'UTF-8').replace(/^\uFEFF/, '');
var inkFile = fs.readFileSync(__dirname + '/stories/test.ink.json', 'UTF-8').replace(/^\uFEFF/, '');
var s = new Story(inkFile);
var gameSave;

console.log(s.variablesState['mood']);
s.variablesState['mood'] = 1;
console.log(s.variablesState['mood']);

continueToNextChoice();

function continueToNextChoice(){
Expand Down
1 change: 0 additions & 1 deletion test/stories/choice.ink.json

This file was deleted.

1 change: 0 additions & 1 deletion test/stories/choices.ink.json

This file was deleted.

1 change: 0 additions & 1 deletion test/stories/external.ink.json

This file was deleted.

1 change: 0 additions & 1 deletion test/stories/fallback.ink.json

This file was deleted.

1 change: 0 additions & 1 deletion test/stories/function.ink.json

This file was deleted.

1 change: 0 additions & 1 deletion test/stories/glue.ink.json

This file was deleted.

1 change: 0 additions & 1 deletion test/stories/hello.ink.json

This file was deleted.

1 change: 0 additions & 1 deletion test/stories/hellofogg.ink.json

This file was deleted.

1 change: 0 additions & 1 deletion test/stories/hellomultline.ink.json

This file was deleted.

1 change: 0 additions & 1 deletion test/stories/intercept.ink.json

This file was deleted.

1 change: 0 additions & 1 deletion test/stories/knot.ink.json

This file was deleted.

1 change: 0 additions & 1 deletion test/stories/shuffle.ink.json

This file was deleted.

8 changes: 0 additions & 8 deletions test/stories/threads.ink

This file was deleted.

1 change: 0 additions & 1 deletion test/stories/threads.ink.json

This file was deleted.

1 change: 0 additions & 1 deletion test/stories/var.ink.json

This file was deleted.

0 comments on commit 5a804a8

Please sign in to comment.