Skip to content

Commit

Permalink
Merge pull request #222 from UQcsse3200/team-2-ui
Browse files Browse the repository at this point in the history
Bug fix for TurretSelectScreen
  • Loading branch information
Hasakev authored Oct 3, 2023
2 parents 0b3a01b + dd19dbd commit be827ea
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,22 @@ private void addActors() {

// Fetch the selected tower types if set
Array<TowerType> towers = new Array<>();

for (TowerType tower : ServiceLocator.getTowerTypes()) {
towers.add(tower);
}

// If no towers set, populate with default towers
if (towers.isEmpty()) {
towers.addAll(defaultTowers);
if (towers.isEmpty() || towers.size < 5) {
if (towers.isEmpty()) {
towers.addAll(defaultTowers);
} else {
for (TowerType tower : defaultTowers) {
if (towers.size < 5 && !towers.contains(tower, false)) {
towers.add(tower);
}
}
}
}

TextButton tower1 = new TextButton(towers.get(0).getTowerName(), skin);
Expand Down

0 comments on commit be827ea

Please sign in to comment.