project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/Datastructures/RoomlistRoom.java
author Medo <smaxein@googlemail.com>
Mon, 06 Aug 2012 22:39:36 +0200
changeset 7476 2fb781bbdd51
child 7485 0481bd74267c
permissions -rw-r--r--
Hedgeroid: Start using the frontlib for more operations

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 + "]";
	}
}