Added hashcode function for Team to make it consistent with equals.
--- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/Team.java Fri Mar 30 19:40:49 2012 +0200
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/Team.java Sat Mar 31 20:36:03 2012 +0200
@@ -88,6 +88,7 @@
readFromParcel(in);
}
+ @Override
public boolean equals(Object o){
if(super.equals(o)) return true;
else if(o instanceof Team){
@@ -103,6 +104,19 @@
return false;
}
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((grave == null) ? 0 : grave.hashCode());
+ result = prime * result + ((flag == null) ? 0 : flag.hashCode());
+ result = prime * result + ((voice == null) ? 0 : voice.hashCode());
+ result = prime * result + ((fort == null) ? 0 : fort.hashCode());
+ result = prime * result + ((hash == null) ? 0 : hash.hashCode());
+ return result;
+ }
public void setRandomColor(int[] illegalcolors){
Integer[] colorsToPickFrom = TEAM_COLORS;