@Override
	public void buildGrid()
	{
		clearGrid(null);
		try
		{
			subMap=new Room[xsize][ysize];
			final Exit ox=CMClass.getExit("Open");
			for(int x=0;x<subMap.length;x++)
			{
				for(int y=0;y<subMap[x].length;y++)
				{
					final Room newRoom=getGridRoom(x,y);
					if(newRoom!=null)
					{
						subMap[x][y]=newRoom;
						if((x>0)||(y>0))
						{
							int nextX = x-1;
							int nextY = y;
							if(nextX <0)
							{
								nextX = subMap.length-1;
								nextY--;
							}
							if(subMap[nextX][nextY]!=null)
								linkRoom(newRoom,subMap[nextX][nextY],Directions.UP,ox,ox);
						}
					}
				}
			}
			buildFinalLinks();
		}
		catch(final Exception e)
		{
			clearGrid(null);
		}
	}