mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
- Sort puzzles alphabetically in the puzzle selection list box.
This commit is contained in:
@@ -16,7 +16,7 @@ import forge.model.FModel;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Puzzle extends GameState implements InventoryItem {
|
||||
public class Puzzle extends GameState implements InventoryItem, Comparable {
|
||||
String name;
|
||||
String goal;
|
||||
String url;
|
||||
@@ -104,4 +104,12 @@ public class Puzzle extends GameState implements InventoryItem {
|
||||
}
|
||||
|
||||
public String toString() { return name; }
|
||||
|
||||
public int compareTo(Object pzl) throws ClassCastException {
|
||||
if (!(pzl instanceof Puzzle)) {
|
||||
throw new ClassCastException("Tried to compare a Puzzle object to a non-Puzzle object.");
|
||||
}
|
||||
|
||||
return getName().compareTo(((Puzzle)pzl).getName());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user