Skip to content

Commit fe9907a

Browse files
author
Arun Prasaad
committed
Fix hard coded grid values
1 parent 5a0cb29 commit fe9907a

File tree

1 file changed

+4
-28
lines changed

1 file changed

+4
-28
lines changed

src/main/java/ihm/Editor.java

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -120,33 +120,8 @@ public void actionPerformed(ActionEvent e) {
120120

121121
int c = i / columnCount;
122122
int l = i % columnCount;
123-
TileType end_content = controller.warehouse.getCase(c, l).getContent();
124-
switch (end_content) {
125-
case WORKER_ON_FLOOR:
126-
line += "G";
127-
break;
128-
case WORKER_IN_STORAGE_AREA:
129-
line += "B";
130-
break;
131-
case UNSTORED_BOX:
132-
line += "C";
133-
break;
134-
case STORED_BOX:
135-
line += "V";
136-
break;
137-
case FLOOR:
138-
line += "#";
139-
break;
140-
case STORAGE_AREA:
141-
line += "T";
142-
break;
143-
case OUTSIDE:
144-
line += "_";
145-
break;
146-
case WALL:
147-
line += "M";
148-
break;
149-
}
123+
TileType endContent = controller.warehouse.getCase(c, l).getContent();
124+
line += endContent.getCode();
150125

151126
if (line.length() == columnCount && i+1 == columnCount) {
152127
levelFile.write(line);
@@ -178,9 +153,10 @@ else if (line.length() == columnCount) {
178153
}
179154

180155
private void initializeEmptyLevel(int rowCount, int columnCount) {
156+
String tileCode = "" + TileType.OUTSIDE.getCode();
181157
String content = IntStreamEx
182158
.range(rowCount)
183-
.mapToObj(i -> "_".repeat(columnCount))
159+
.mapToObj(_ -> tileCode.repeat(columnCount))
184160
.joining(System.lineSeparator());
185161
levelFile.write(content);
186162
}

0 commit comments

Comments
 (0)