Fixed game saving when an AI is in play
This commit is contained in:
parent
ee8bf3b4a3
commit
9045f7e5c3
|
@ -1,13 +1,17 @@
|
|||
/// <reference path="Serializable.ts"/>
|
||||
|
||||
module SpaceTac.Game {
|
||||
"use strict";
|
||||
|
||||
// Random generator, used in all throws
|
||||
export class RandomGenerator {
|
||||
export class RandomGenerator extends Serializable {
|
||||
// Array of next values, empty for a correct generator
|
||||
private fake_values: number[];
|
||||
|
||||
// Basic constructor (can specify fake values as arguments)
|
||||
constructor(...values: number[]) {
|
||||
super();
|
||||
|
||||
this.fake_values = [];
|
||||
|
||||
values.forEach((value: number) => {
|
||||
|
|
|
@ -6,14 +6,14 @@ module SpaceTac.Game.Specs {
|
|||
function applyGameSteps(session: GameSession): void {
|
||||
var battle = session.getBattle();
|
||||
battle.advanceToNextShip();
|
||||
// TODO Make some moves (IA?)
|
||||
// TODO Make some moves (AI?)
|
||||
battle.endBattle(battle.fleets[0]);
|
||||
}
|
||||
|
||||
describe("GameSession", () => {
|
||||
it("serializes to a string", () => {
|
||||
var session = new GameSession();
|
||||
session.startQuickBattle(false);
|
||||
session.startQuickBattle(true);
|
||||
|
||||
// Dump and reload
|
||||
var dumped = session.saveToString();
|
||||
|
|
Loading…
Reference in a new issue