This repository has been archived by the owner on Oct 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 101
Only select wounded in selection #746
Merged
andreas-eberle
merged 9 commits into
jsettlers:master
from
PayDay1:selection-modification
Jan 19, 2019
Merged
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7aaf5cd
Only wounded get selected (from current selection) when pressing w.
PayDay1 59d6b81
Changed wounded selection key from w to v (temporarily);
PayDay1 ef04f51
Set focus traversal keys enabled (TAB and Shift+TAB) in GOSwingEventC…
PayDay1 1794244
Added isWounded method to ISelectable interface (and all classes impl…
PayDay1 0ce9b80
Merge branch 'master' into selection-modification
PayDay1 fae194a
Merge remote-tracking branch 'origin/selection-modification' into sel…
PayDay1 93e333a
Use wounded selection only for movables
andreas-eberle ffba6da
Fix AutoReplayIT
andreas-eberle a399f21
Merge branch 'master' into selection-modification
andreas-eberle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,9 +21,6 @@ | |
import java.util.Timer; | ||
import java.util.TimerTask; | ||
|
||
import java8.util.Optional; | ||
import java8.util.function.BiFunction; | ||
import java8.util.function.Predicate; | ||
import jsettlers.algorithms.construction.ConstructionMarksThread; | ||
import jsettlers.common.action.BuildAction; | ||
import jsettlers.common.action.ChangeTradingRequestAction; | ||
|
@@ -85,11 +82,16 @@ | |
import jsettlers.logic.buildings.military.occupying.OccupyingBuilding; | ||
import jsettlers.logic.buildings.workers.DockyardBuilding; | ||
import jsettlers.logic.constants.MatchConstants; | ||
import jsettlers.logic.movable.Movable; | ||
import jsettlers.logic.movable.interfaces.IDebugable; | ||
import jsettlers.logic.player.Player; | ||
import jsettlers.network.client.interfaces.IGameClock; | ||
import jsettlers.network.client.interfaces.ITaskScheduler; | ||
|
||
import java8.util.Optional; | ||
import java8.util.function.BiFunction; | ||
import java8.util.function.Predicate; | ||
|
||
/** | ||
* Class to handle the events provided by the user through jsettlers.graphics. | ||
* | ||
|
@@ -212,6 +214,10 @@ public void action(IAction action) { | |
handleSelectPointAction((PointAction) action); | ||
break; | ||
|
||
case FILTER_WOUNDED: | ||
filterWounded(); | ||
break; | ||
|
||
case SELECT_AREA: | ||
selectArea((SelectAreaAction) action); | ||
break; | ||
|
@@ -608,6 +614,21 @@ private boolean canSelectPlayer(byte playerIdOfSelected) { | |
return MatchConstants.ENABLE_ALL_PLAYER_SELECTION || playerIdOfSelected == playerId; | ||
} | ||
|
||
private void filterWounded() { | ||
if(currentSelection.getSelectionType() != ESelectionType.SOLDIERS && currentSelection.getSelectionType() != ESelectionType.PEOPLE && currentSelection.getSelectionType() != ESelectionType.SPECIALISTS) | ||
return; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use |
||
Movable movable = (Movable)selectable; | ||
if(movable.getHealth() < movable.getMovableType().health) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a new Method to ISelectable. Then use:
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. |
||
selected.add(movable); | ||
} | ||
|
||
setSelection(new SelectionSet(selected)); | ||
} | ||
|
||
private void deselect() { | ||
setSelection(new SelectionSet()); | ||
} | ||
|
@@ -625,7 +646,6 @@ private void handleSelectPointAction(PointAction action) { | |
} else { | ||
setSelection(new SelectionSet()); | ||
} | ||
|
||
} | ||
|
||
private void scheduleTask(SimpleGuiTask guiTask) { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a new Property to ESelectionType. Then use