From 575c276c9a73b0c372ae774c03dd3bbb22cc76d0 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Fri, 19 Apr 2002 21:33:21 +0000 Subject: [PATCH] hold gamemanagers in a set instead of a list since their order doesn't matter and we want to prevent them from being added twice. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1284 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../com/threerings/parlor/game/AIGameTicker.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/java/com/threerings/parlor/game/AIGameTicker.java b/src/java/com/threerings/parlor/game/AIGameTicker.java index dd1b040ae..ce8204d77 100644 --- a/src/java/com/threerings/parlor/game/AIGameTicker.java +++ b/src/java/com/threerings/parlor/game/AIGameTicker.java @@ -1,10 +1,10 @@ // -// $Id: AIGameTicker.java,v 1.1 2002/04/19 18:33:32 ray Exp $ +// $Id: AIGameTicker.java,v 1.2 2002/04/19 21:33:21 ray Exp $ package com.threerings.parlor.game; import java.util.Iterator; -import java.util.ArrayList; +import java.util.HashSet; import com.samskivert.util.Interval; import com.samskivert.util.IntervalManager; @@ -42,7 +42,7 @@ public class AIGameTicker implements Interval, Runnable */ private AIGameTicker () { - _games = new ArrayList(); + _games = new HashSet(); _id = IntervalManager.register(this, TICK_FREQUENCY, null, true); } @@ -64,8 +64,8 @@ public class AIGameTicker implements Interval, Runnable { _games.remove(mgr); - // if there aren't any AIs, let's - if (_games.size() == 0) { + // if there aren't any AIs, let's stop running + if (_games.isEmpty()) { _ticker = null; IntervalManager.remove(_id); } @@ -88,8 +88,8 @@ public class AIGameTicker implements Interval, Runnable } } - /** Our list of ai games. */ - protected ArrayList _games; + /** Our set of ai games. */ + protected HashSet _games; /** Our interval id. */ protected int _id;