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 28, 2016
2 parents 2a4df33 + c8f77e1 commit c12a0b7
Show file tree
Hide file tree
Showing 19 changed files with 24 additions and 27 deletions.
1 change: 1 addition & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module.exports = function(grunt) {
babel({
exclude: 'node_modules/**',
presets: ['es2015-rollup'],
plugins: ['transform-object-assign'],
}),
uglify(),
],
Expand Down
Binary file modified bin/ink-engine.dll
Binary file not shown.
Binary file modified bin/inklecate
Binary file not shown.
Binary file modified bin/inklecate.exe
Binary file not shown.
1 change: 0 additions & 1 deletion engine/CallStack.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//complete
import {PushPopType} from './PushPop';
import {Container} from './Container';
import {Path} from './Path';
Expand Down
1 change: 0 additions & 1 deletion engine/Choice.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//complete
export class Choice{
constructor(choice){
this.text;
Expand Down
1 change: 0 additions & 1 deletion engine/ChoicePoint.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//complete
import {Object as InkObject} from './Object';
import {Path} from './Path';

Expand Down
1 change: 0 additions & 1 deletion engine/Container.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//complete
import {StringValue} from './Value';
import {StoryException} from './StoryException';
import {Object as InkObject} from './Object';
Expand Down
1 change: 0 additions & 1 deletion engine/ControlCommand.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//complete
import {Object as InkObject} from './Object';

export class ControlCommand extends InkObject{
Expand Down
1 change: 0 additions & 1 deletion engine/Divert.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//complete
import {Path} from './Path';
import {PushPopType} from './PushPop';
import {Object as InkObject} from './Object';
Expand Down
1 change: 0 additions & 1 deletion engine/Glue.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//complete
export class Glue{
constructor(type){
this.glueType = type;
Expand Down
7 changes: 1 addition & 6 deletions engine/Object.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
//still missing:
// - DebugMetaData
// - bool operators

import {Path} from './Path';
import {Container} from './Container';

Expand Down Expand Up @@ -104,8 +100,7 @@ export class Object{
for (var down = lastSharedPathCompIndex + 1; down < globalPath.components.length; ++down)
newPathComps.push(globalPath.components[down]);

var relativePath = new Path(newPathComps);
relativePath.isRelative = true;
var relativePath = new Path(newPathComps, true);
return relativePath;
}
CompactPathString(otherPath){
Expand Down
23 changes: 14 additions & 9 deletions engine/Path.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
//complete
export class Path{
constructor(/*polymorphic constructor*/){
this.isRelative;
this._isRelative;
this._components = [];

if (arguments.length == 2){
if (typeof arguments[0] == 'string'){
this.componentsString = arguments[0];
}
else if (arguments[0] instanceof Component && arguments[1] instanceof Path){
this._components.push(arguments[0]);
this._components = this._components.concat(arguments[1]);
}
else if (arguments.length == 1 && typeof arguments[0] == 'string'){
this.componentsString = arguments[0];
}
else if (arguments.length == 1 && arguments[0] instanceof Array){
else if (arguments[0] instanceof Array){
this._components = this._components.concat(arguments[0]);
this._isRelative = !!arguments[1];
}
}
get isRelative(){
return this._isRelative;
}
get components(){
return this._components;
}
Expand Down Expand Up @@ -54,7 +57,7 @@ export class Path{
}
static get self(){
var path = new Path();
path.isRelative = true;
path._isRelative = true;
return path;
}

Expand Down Expand Up @@ -91,13 +94,15 @@ export class Path{
this.components.length = 0;

var componentsStr = value;

if (componentsStr == null || componentsStr == '') return;

// When components start with ".", it indicates a relative path, e.g.
// .^.^.hello.5
// is equivalent to file system style path:
// ../../hello/5
if (componentsStr[0] == '.') {
this.isRelative = true;
this._isRelative = true;
componentsStr = componentsStr.substring(1);
}

Expand Down
5 changes: 5 additions & 0 deletions engine/Polyfill.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if (!Number.isInteger) {
Number.isInteger = function isInteger (nVal) {
return typeof nVal === "number" && isFinite(nVal) && nVal > -9007199254740992 && nVal < 9007199254740992 && Math.floor(nVal) === nVal;
};
}
1 change: 0 additions & 1 deletion engine/PushPop.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//complete
export let PushPopType = {
Tunnel: 0,
Function: 1,
Expand Down
3 changes: 2 additions & 1 deletion engine/Story.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {VariableReference} from './VariableReference';
import {NativeFunctionCall} from './NativeFunctionCall';
import {StoryException} from './StoryException';
import {PRNG} from './PRNG';
import {Polyfill} from './Polyfill';

export class Story extends InkObject{
constructor(jsonString){
Expand Down Expand Up @@ -244,7 +245,7 @@ export class Story extends InkObject{
this.Error("Thread available to pop, threads should always be flat by the end of evaluation?");
}

if( this.currentChoices.length == 0 && !this.state.didSafeExit ) {
if( this.currentChoices.length == 0 && !this.state.didSafeExit && this._temporaryEvaluationContainer == null) {
if( this.state.callStack.CanPop(PushPopType.Tunnel) ) {
this.Error("unexpectedly reached end of content. Do you need a '->->' to return from a tunnel?");
} else if( this.state.callStack.CanPop(PushPopType.Function) ) {
Expand Down
1 change: 0 additions & 1 deletion engine/StoryState.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//complete
import {CallStack} from './CallStack';
import {VariablesState} from './VariablesState';
import {StringValue} from './Value';
Expand Down
1 change: 0 additions & 1 deletion engine/Value.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//complete
import {Object as InkObject} from './Object';
import {Path} from './Path';

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.1.0",
"version": "1.1.1",
"description": "A javascript port of inkle's ink scripting language (http://www.inklestudios.com/ink/)",
"main": "dist/ink.cjs.js",
"scripts": {
Expand Down

0 comments on commit c12a0b7

Please sign in to comment.