project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/Room.java
changeset 7352 641f11cdd319
parent 7342 0e29eec2df5c
child 7358 57a508884052
--- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/Room.java	Sat Jul 21 14:56:52 2012 +0200
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/Room.java	Mon Jul 23 00:17:06 2012 +0200
@@ -1,5 +1,7 @@
 package org.hedgewars.hedgeroid.netplay;
 
+import java.util.Comparator;
+
 import org.hedgewars.hedgeroid.R;
 
 import android.content.res.Resources;
@@ -8,6 +10,7 @@
 	public static final String MAP_REGULAR = "+rnd+";
 	public static final String MAP_MAZE = "+maze+";
 	public static final String MAP_DRAWN = "+drawn+";
+	public static final Comparator<Room> ID_COMPARATOR = new ByIdComparator();
 	
 	public final String name, map, scheme, weapons, owner;
 	public final int playerCount, teamCount;
@@ -39,4 +42,10 @@
 		}
 		return map;
 	}
+	
+	private static final class ByIdComparator implements Comparator<Room> {
+		public int compare(Room lhs, Room rhs) {
+			return lhs.id<rhs.id ? -1 : lhs.id>rhs.id ? 1 : 0;
+		}
+	}
 }