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
This commit is contained in:
@@ -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;
|
package com.threerings.parlor.game;
|
||||||
|
|
||||||
@@ -47,9 +47,10 @@ public abstract class GameConfig extends PlaceConfig
|
|||||||
*/
|
*/
|
||||||
public boolean equals (Object other)
|
public boolean equals (Object other)
|
||||||
{
|
{
|
||||||
if (other instanceof GameConfig) {
|
// make sure they're of the same class
|
||||||
GameConfig go = (GameConfig)other;
|
if (other.getClass() == this.getClass()) {
|
||||||
return go.rated == rated;
|
GameConfig that = (GameConfig) other;
|
||||||
|
return this.rated == that.rated;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@@ -64,6 +65,6 @@ public abstract class GameConfig extends PlaceConfig
|
|||||||
public int hashCode ()
|
public int hashCode ()
|
||||||
{
|
{
|
||||||
// look ma, it's so sophisticated!
|
// look ma, it's so sophisticated!
|
||||||
return (rated ? 1 : 0);
|
return getClass().hashCode() + (rated ? 1 : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user