project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/RoomlistRoom.java
changeset 7476 2fb781bbdd51
child 7485 0481bd74267c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/RoomlistRoom.java	Mon Aug 06 22:39:36 2012 +0200
@@ -0,0 +1,52 @@
+package org.hedgewars.hedgeroid.Datastructures;
+
+import org.hedgewars.hedgeroid.R;
+
+import android.content.res.Resources;
+
+public final class RoomlistRoom {
+	public static final String MAP_REGULAR = "+rnd+";
+	public static final String MAP_MAZE = "+maze+";
+	public static final String MAP_DRAWN = "+drawn+";
+	
+	public final String name, map, scheme, weapons, owner;
+	public final int playerCount, teamCount;
+	public final boolean inProgress;
+	
+	public RoomlistRoom(String name, String map, String scheme, String weapons,
+			String owner, int playerCount, int teamCount, boolean inProgress) {
+		this.name = name;
+		this.map = map;
+		this.scheme = scheme;
+		this.weapons = weapons;
+		this.owner = owner;
+		this.playerCount = playerCount;
+		this.teamCount = teamCount;
+		this.inProgress = inProgress;
+	}
+	
+	public static String formatMapName(Resources res, String map) {
+		if(map.charAt(0)=='+') {
+			if(map.equals(MAP_REGULAR)) {
+				return res.getString(R.string.map_regular);
+			} else if(map.equals(MAP_MAZE)) {
+				return res.getString(R.string.map_maze);
+			} else if(map.equals(MAP_DRAWN)) {
+				return res.getString(R.string.map_drawn);
+			}
+		}
+		return map;
+	}
+	
+	public String formatMapName(Resources res) {
+		return formatMapName(res, map);
+	}
+
+	@Override
+	public String toString() {
+		return "RoomlistRoom [name=" + name + ", map=" + map + ", scheme="
+				+ scheme + ", weapons=" + weapons + ", owner=" + owner
+				+ ", playerCount=" + playerCount + ", teamCount=" + teamCount
+				+ ", inProgress=" + inProgress + "]";
+	}
+}