Only select wounded in selection - #746
Conversation
…onverter; Changed wounded selection key from v to TAB;
|
|
||
| private void filterWounded() { | ||
| if(currentSelection.getSelectionType() != ESelectionType.SOLDIERS && currentSelection.getSelectionType() != ESelectionType.PEOPLE && currentSelection.getSelectionType() != ESelectionType.SPECIALISTS) | ||
| return; |
There was a problem hiding this comment.
Always use the curly brackets for ifs, even if they have only one line.
|
|
||
| final List<ISelectable> selected = new LinkedList<>(); | ||
|
|
||
| for(ISelectable selectable : currentSelection) { |
There was a problem hiding this comment.
use currentSelection.stream().filter(<condition>).collect(Collectors.toList()) instead of the loop.
| } | ||
|
|
||
| private void filterWounded() { | ||
| if(currentSelection.getSelectionType() != ESelectionType.SOLDIERS && currentSelection.getSelectionType() != ESelectionType.PEOPLE && currentSelection.getSelectionType() != ESelectionType.SPECIALISTS) |
There was a problem hiding this comment.
Add a new Property to ESelectionType. Then use
if (currentSelection.getSelectionType().allowsFilterForWounded()) { ... }
|
|
||
| for(ISelectable selectable : currentSelection) { | ||
| Movable movable = (Movable)selectable; | ||
| if(movable.getHealth() < movable.getMovableType().health) |
There was a problem hiding this comment.
Add a new Method to ISelectable. Then use:
if (selectable.isWounded()) { ... }
Buildings always return false.
Then you can skip the test at the beginning of the method as well, since all selectables support the same interface.
…ementing it); Simplified filterWounded method in GuiInterface by using Java 8 stream filtering.
…ection-modification
|
I implemented the changes that you guys have mentioned. |
|
I'm for clearing the selection. |
|
I would also say clear the selection. |
These changes allow you to filter your selection by wounded (key is TAB).
I also wanted to implement things like SHIFT while selecting to add to the selection, but I thought it is better to wait for #709 to be merged into master (because it already includes key modifiers for input events).
There is no UI for this in Android yet.
Should improve #661.