package rpgEngine.Data.Abstract.World;

import java.util.List;
import java.util.ArrayList;

import rpgEngine.Data.Abstract.Enemy.EnemyParty;
import rpgEngine.Data.Raw.Sound.GenericSound;



public class Map {
	private Integer ID;
	private List<List<MapCell>> rows;
	private GenericSound backgroundMusic;
	private List<EnemyParty> enemyParties;


	public Map () {
		ID = -1;
		rows = new ArrayList<List<MapCell>>();
		enemyParties = new ArrayList<EnemyParty>();
	}
	
	
	public List<List<MapCell>> getRows() {
		return rows;
	}
	
	
	public Integer getWidth() {
		if(rows.size() == 0) {
			return -1;
		}
		
		return rows.get(0).size();
	}
	
	
	public Integer getHeight() {
		return rows.size();
	}
	
	
	public MapCell findCharacter(CharacterAvatar c) {
		MapCell mc = null;
		List<MapCell> row = null;
		
		for(Integer i = 0; i < rows.size(); i++) {
			row = rows.get(i);
			
			for(Integer j = 0; j < row.size(); j++) {
				mc = row.get(j);
				
				if(mc.getCharacter() == c) {
					return mc;
				}
			}
		}
		
		return null;
	}

	
	public GenericSound getBackgroundMusic() {
		return backgroundMusic;
	}

	
	public void setBackgroundMusic(GenericSound backgroundMusic) {
		this.backgroundMusic = backgroundMusic;
	}
	
	
	public Integer getID() {
		return ID;
	}

	
	public void setID(Integer iD) {
		ID = iD;
	}


	public List<EnemyParty> getEnemyParties() {
		return enemyParties;
	}

	
}
