/**
 *  Just a test for a grid generation system.
 */
package com.senerade.game;
/**
 * @author Thor Johansson
 *
 */
public class Map {
	private String mapName = "";
	private int[][] map = null;
	
	//Constructor
	public Map(int width, int height, String mapName){
		map = new int [width][height];
		for (int i = 0; i < width; i++)
			for (int j = 0; j < height; j++)
				map[i][j] = 0;
		this.setMapName(mapName);
	}
	
	public String getMapName() {
		return mapName;
	}
	
	public void setMapName(String mapName) {
		this.mapName = mapName;
	}
	
	//Returns the memory position of the array
	public int[][] getMap(){
		return map;
	}
	
	public void setMapSpace(int x, int y, int value){
		map[x][y] = value;
	}
	
	public int getMapSpace(int x, int y){
		int value = map[x][y];
		return value;
	}
	
	/**
	 * 0 = empty
	 * 1 = cover
	 * 2 = half cover
	 * 3 = occupied
	 * 4 = cover occupied
	 * 5 = half cover occupied
	 */
	public boolean canMove(int x, int y){
		if (2 < getMapSpace(x,y))
			return false;
		return true;
	}
	
	public boolean cover(int x, int y){
		if (1 == getMapSpace(x,y)%3)
			return true;
		return false;
	}
	
	public boolean halfCover(int x, int y){
		if (2 == getMapSpace(x,y)%3)
			return true;
		return false;
	}
	
	//TestFile
	
	public static void main(String[] args){
		Map a = new Map(10, 20, "phi");
		for (int i = 0; i < 10; i++){
			for (int j = 0; j < 20; j++){
				a.setMapSpace(i, j, (i+j)%6);
				System.out.print(a.getMapSpace(i, j) + " ");
			}
			System.out.println();
		}
		System.out.println(a.getMap());
		System.out.println(a.getMapName());
		BattleActor d = new BattleActor("Mother", "Hi7");
		System.out.println(d.getX() + " " + d.getId() + " " + d.getAtk());
		BattleActor e = new BattleActor("x", "Hi7");
		BattleMove f = new BattleMove(35);
		Move.move(e, a);
		//while(BattleActions.hit(d, e, f))
			System.out.println("truex");
	}
}

@@ -179,19 +179,20 @@
 private 
-int
+byte
 %5B%5D%5B%5D map
@@ -285,20 +285,20 @@
 p = new 
-int 
+byte
 %5Bwidth%5D%5B
@@ -336,19 +336,19 @@
  width; 
-i
 ++
+i
 )%0D%0A%09%09%09fo
@@ -373,19 +373,19 @@
 height; 
-j
 ++
+j
 )%0D%0A%09%09%09%09m
@@ -410,27 +410,23 @@
 his.
-setM
+m
 apName
-(
+=
 mapName
-)
 ;%0D%0A%09
@@ -618,19 +618,20 @@
 %09public 
-int
+byte
 %5B%5D%5B%5D get
@@ -652,32 +652,271 @@
 rn map;%0D%0A%09%7D%0D%0A%09%0D%0A
+%09/**%0D%0A%09* @author Gabriel Tofvesson%0D%0A%09* %0D%0A%09* For debugging purposes.%0D%0A%09*/%0D%0A%09public String getMapAsText()%7B%0D%0A%09%09String s = %22%22;%0D%0A%09%09for(int%5B%5D i : map)%7B%0D%0A%09%09%09for(int j : i)%0D%0A%09%09%09%09s+=j+%22 %22;%0D%0A%09%09%09s+=%22%5Cr%5Cn%22; //Proper linefeed%0D%0A%09%09%7D%0D%0A%09%09return s;%0D%0A%09%7D%0D%0A%09%0D%0A
 %09public void set
@@ -938,19 +938,20 @@
  int y, 
-int
+byte
  value)%7B
@@ -989,19 +989,20 @@
 %09public 
-int
+byte
  getMapS
@@ -1664,11 +1664,11 @@
 10; 
-i
 ++
+i
 )%7B%0D%0A
@@ -1698,11 +1698,11 @@
 20; 
-j
 ++
+j
 )%7B%0D%0A
@@ -1893,24 +1893,65 @@
 apName());%0D%0A
+%09%09System.out.println(a.getMapAsText());%0D%0A
 %09%09BattleActo
@@ -2153,30 +2153,8 @@
 %0D%0A%09%09
-Move.move(e, a);%0D%0A%09%09//
 whil
@@ -2224,8 +2224,10 @@
 %0A%09%7D%0D%0A%7D%0D%0A
+%0D%0A

Update Map.java with Gabe's code