diff --git a/buildout.cfg b/buildout.cfg index 4c7734f..e182f32 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -71,6 +71,7 @@ downloads = . packages = phaser-official#2.2.2 jasmine#2.1.3 + deep-diff#0.3.0 [mkdir-var] recipe = z3c.recipe.mkdir diff --git a/karma.conf.js b/karma.conf.js index eb524eb..40b46bd 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -5,6 +5,7 @@ module.exports = function (config) { frameworks: ['jasmine'], files: [ 'src/vendor/phaser-official/build/phaser.js', + 'src/vendor/deep-diff/releases/deep-diff-0.3.0.min.js', 'build/main.js' ], client: { diff --git a/src/index.html b/src/index.html index 8109edc..3b4fb3d 100644 --- a/src/index.html +++ b/src/index.html @@ -15,6 +15,7 @@ + diff --git a/src/scripts/game/ai/AbstractAI.ts b/src/scripts/game/ai/AbstractAI.ts index 2ed1540..0eb6d15 100644 --- a/src/scripts/game/ai/AbstractAI.ts +++ b/src/scripts/game/ai/AbstractAI.ts @@ -18,7 +18,7 @@ module SpaceTac.Game.AI { async: boolean; // Time at which work as started - private started: number; + started: number; // Queue of work items to process // Work items will be called successively, leaving time for other processing between them. diff --git a/src/scripts/game/specs/Universe.spec.ts b/src/scripts/game/specs/Universe.spec.ts index 4737ae7..ad1290b 100644 --- a/src/scripts/game/specs/Universe.spec.ts +++ b/src/scripts/game/specs/Universe.spec.ts @@ -25,6 +25,17 @@ module SpaceTac.Game.Specs { applyGameSteps(universe); applyGameSteps(loaded_universe); + // Clean stored times as they might differ + var clean = (u: Universe) => { + u.battle.fleets.forEach((fleet: Fleet) => { + if (fleet.player.ai) { + fleet.player.ai.started = 0; + } + }); + }; + clean(universe); + clean(loaded_universe); + // Check equality after game steps expect(loaded_universe).toEqual(universe); });