From 712d3f8ab5724458625b92eb458d994da2ae1a7d Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Thu, 20 Mar 2003 19:50:35 +0000 Subject: [PATCH] Two GameConfigs are not equal unless they are of the exact same class. This was originally in yohoho's PuzzleConfig, but apparently got deleted a while back, and this is where it should be anyway. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2313 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/java/com/threerings/parlor/game/GameConfig.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/java/com/threerings/parlor/game/GameConfig.java b/src/java/com/threerings/parlor/game/GameConfig.java index 1e503a068..ca77e115f 100644 --- a/src/java/com/threerings/parlor/game/GameConfig.java +++ b/src/java/com/threerings/parlor/game/GameConfig.java @@ -1,5 +1,5 @@ // -// $Id: GameConfig.java,v 1.14 2003/02/12 05:34:53 mdb Exp $ +// $Id: GameConfig.java,v 1.15 2003/03/20 19:50:35 ray Exp $ package com.threerings.parlor.game; @@ -47,9 +47,10 @@ public abstract class GameConfig extends PlaceConfig */ public boolean equals (Object other) { - if (other instanceof GameConfig) { - GameConfig go = (GameConfig)other; - return go.rated == rated; + // make sure they're of the same class + if (other.getClass() == this.getClass()) { + GameConfig that = (GameConfig) other; + return this.rated == that.rated; } else { return false; @@ -64,6 +65,6 @@ public abstract class GameConfig extends PlaceConfig public int hashCode () { // look ma, it's so sophisticated! - return (rated ? 1 : 0); + return getClass().hashCode() + (rated ? 1 : 0); } }