fixed items display bug

This commit is contained in:
Luca Carnegie
2019-05-31 20:33:29 -04:00
parent 39ab9f2332
commit 8cac7a4315
2 changed files with 8 additions and 5 deletions

View File

@@ -2,7 +2,7 @@ Room name: Circle Room
Room Description: You are in a circular room. The windows to the east are covered with boards that<br>let in just enough light to see. You spot a man in a tailored suit moving some crates around.
Locked: false
Boarded: false
Items: Shavingcream
Items: Lightbulb, Candlestick
Riddler: "Hello there. My name is Kevin and I am Sir Pellatt's butler. I understand that my master<comma><br>Sir Pellatt has wrongfully imprisoned you. If you answer my riddle<comma> I can give you something to<br>help you with your escape - nothing comes for free you know!", "What goes moo?", "Cows", Lockpick
Exit Rooms: W-Apple Hallway

View File

@@ -197,12 +197,15 @@ class Room {
boolean hasItems = false;
String items = "";
String itemString = "Items in room: ";
for(int i = 0; i < this.getItems().size() - 1; i++) {
if(this.getItems().size() > 0) {
hasItems = true;
items += this.getItems().get(i).getName() + ", ";
for(int i = 0; i < this.getItems().size() - 1; i++) {
hasItems = true;
items += this.getItems().get(i).getName() + ", ";
}
items += this.getItems().get(this.getItems().size() - 1).getName();
}
if(hasItems) {
items += this.getItems().get(this.getItems().size() - 1).getName();
return itemString + items;
}else {
return itemString + "none";