-
-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes issue #23 whereby left clicks were ignored on goto mode #51
Conversation
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.
Looks good, thank you!!
* @return True if the user has toggled GoTo mode. | ||
*/ | ||
public boolean isGotoStarted() { | ||
return false; |
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.
I'm a bit confused by this code block. The comment says it will return true if the user has toggled GoTo mode, but this method returns false.
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.
Its the base class, since it required a method body I thought it would be reasonable to default it to false. Check SwingGUI.java for the override. Actually speaking of, let me patch it with an Override annotation
case MouseEvent.BUTTON1: // Drag and selection | ||
case MouseEvent.BUTTON1: | ||
// If we have GoTo mode enabled then GoTo takes precedence | ||
if (getGUI().isGotoStarted()) { |
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.
The method only returns false? So this would never evaluate to true, or am I missing something?
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.
The base class returns false, however the subclass SwingGUI checks the canvas if Goto is enabled and returns true if it is. SwingGUI is the object type that is evaluated at runtime when it performs that check in the mouse event
Fixes issue #23 whereby left clicks were ignored on goto mode.
The patch makes it so whenever a left click is actioned, if the goto mode is enabled (with the hotkey G) and a unit is selected and has available moves, it moves the unit to the selected tile. The patch does nothing to affect the normal left click behaviour when Goto mode is disabled