razormc

showMap()

Nov 27th, 2011
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.72 KB | None | 0 0
  1.  private void generateMap(){
  2.         for(int i=0; i<rooms.size(); i++){
  3.             if(i==0) addToMap(rooms.get(i), 0, 1);
  4.             else addToMap(rooms.get(i));
  5.         }
  6.     }
  7.    
  8.     public void showMap(){
  9.         for(int i=0; i<MAX_HEIGHT; i++){
  10.             boolean firstRoomInRow = true;
  11.             for(int j=0; j<MAX_WIDTH; j++){
  12.                 if(world[i][j]!=0 && rooms.get(world[i][j]-1).getNorth()==null
  13.                         & i>=1 && world[i-1][j]!=0) {System.out.print(((firstRoomInRow)?"+":"=")+"===+");firstRoomInRow = false;}
  14.                 else if(world[i][j]!=0) {System.out.print(((firstRoomInRow)?"+":"-") + "---+"); firstRoomInRow = false;}        
  15.                 else System.out.print("     ");
  16.             }
  17.             System.out.println();
  18.             firstRoomInRow = true;
  19.             for(int j=0; j<MAX_WIDTH; j++){
  20.                 if(world[i][j]==0) System.out.print("     ");
  21.                 else { System.out.print(((firstRoomInRow)?"| ":"  ") + rooms.get(world[i][j]-1).getName().charAt(rooms.get(world[i][j]-1).getName().length()-1) + " |");firstRoomInRow = false;}
  22.              }
  23.             System.out.println();
  24.             firstRoomInRow = true;
  25.             if(i+1==MAX_HEIGHT)
  26.             for(int j=0; j<MAX_WIDTH; j++){
  27.                 if(world[i][j]!=0 && rooms.get(world[i][j]-1).getSouth()==null
  28.                         & i+1<MAX_HEIGHT && world[i+1][j]!=0) {System.out.print(((firstRoomInRow)?"+":"=")+ "===+"); firstRoomInRow = false;}
  29.                 else if(world[i][j]!=0) {System.out.print(((firstRoomInRow)?"+":"-") + "---+"); firstRoomInRow = false;}        
  30.                 else System.out.print("     ");
  31.             }
  32.         }
  33.         System.out.println();
  34.     }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment