From c4c8e2297bb28af6cc39c281febe6cd53513d2f1 Mon Sep 17 00:00:00 2001 From: Walter Korman Date: Mon, 3 Jun 2002 21:08:57 +0000 Subject: [PATCH] Added the notion of a round with an associated round identifier that is incremented whenever the game is reset. Games that don't make use of the resetting functionality essentially consist of a single round. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1420 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/parlor/game/GameController.java | 16 +++++++++++++++- .../threerings/parlor/game/GameManager.java | 18 ++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/java/com/threerings/parlor/game/GameController.java b/src/java/com/threerings/parlor/game/GameController.java index 1e5ba5542..378ffe9bd 100644 --- a/src/java/com/threerings/parlor/game/GameController.java +++ b/src/java/com/threerings/parlor/game/GameController.java @@ -1,5 +1,5 @@ // -// $Id: GameController.java,v 1.14 2002/05/07 00:57:49 mdb Exp $ +// $Id: GameController.java,v 1.15 2002/06/03 21:08:57 shaper Exp $ package com.threerings.parlor.game; @@ -123,6 +123,17 @@ public abstract class GameController extends PlaceController // end the game until we receive a new board setGameOver(true); + + // increment the round identifier + _roundId++; + } + + /** + * Returns the unique round identifier for the current round. + */ + public int getRoundId () + { + return _roundId; } /** @@ -230,6 +241,9 @@ public abstract class GameController extends PlaceController * controlling. */ protected GameObject _gobj; + /** The unique round identifier for the current round. */ + protected int _roundId; + /** A local flag overriding the game over state for situations where * the client knows the game is over before the server has * transitioned the game object accordingly. */ diff --git a/src/java/com/threerings/parlor/game/GameManager.java b/src/java/com/threerings/parlor/game/GameManager.java index a2443537f..c5e970b4f 100644 --- a/src/java/com/threerings/parlor/game/GameManager.java +++ b/src/java/com/threerings/parlor/game/GameManager.java @@ -1,5 +1,5 @@ // -// $Id: GameManager.java,v 1.31 2002/06/01 23:14:53 ray Exp $ +// $Id: GameManager.java,v 1.32 2002/06/03 21:08:57 shaper Exp $ package com.threerings.parlor.game; @@ -106,6 +106,14 @@ public class GameManager extends PlaceManager return (_gameobj.state == GameObject.GAME_OVER); } + /** + * Returns the unique round identifier for the current round. + */ + public int getRoundId () + { + return _roundId; + } + // documentation inherited protected void didStartup () { @@ -320,6 +328,9 @@ public class GameManager extends PlaceManager // let the derived class do its pre-reset stuff gameWillReset(); + // increment the round identifier + _roundId++; + // do the standard game start processing gameWillStart(); _gameobj.setState(GameObject.IN_PLAY); @@ -439,8 +450,11 @@ public class GameManager extends PlaceManager /** The oids of our player and AI body objects. */ protected int[] _playerOids; + /** The unique round identifier for the current round. */ + protected int _roundId; + /** If AIs are present, contains their skill levels, or -1 at human - * player indexes.. */ + * player indexes. */ protected byte[] _AIs; /** Our delegate operator to tick AIs. */