Skip to content
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

Misc small refactorings #1170

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions client/mapctrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ void map_view::keyPressEvent(QKeyEvent *event)
Qt::KeyboardModifiers key_mod = QApplication::keyboardModifiers();
bool is_shift = key_mod.testFlag(Qt::ShiftModifier);

auto scale = queen()->mapview_wdg->scale();

if (C_S_RUNNING == client_state()) {
if (is_shift) {
switch (event->key()) {
Expand All @@ -116,35 +114,31 @@ void map_view::keyPressEvent(QKeyEvent *event)
case Qt::Key_Up:
case Qt::Key_8:
if (is_shift) {
recenter_button_pressed(queen()->mapview_wdg->width() / 2 / scale,
lmoureaux marked this conversation as resolved.
Show resolved Hide resolved
0);
recenter_button_pressed(width() / 2 / scale(), 0);
} else {
key_unit_move(DIR8_NORTH);
}
return;
case Qt::Key_Left:
case Qt::Key_4:
if (is_shift) {
recenter_button_pressed(0,
queen()->mapview_wdg->height() / 2 / scale);
recenter_button_pressed(0, height() / 2 / scale());
} else {
key_unit_move(DIR8_WEST);
}
return;
case Qt::Key_Right:
case Qt::Key_6:
if (is_shift) {
recenter_button_pressed(queen()->mapview_wdg->width() / scale,
queen()->mapview_wdg->height() / 2 / scale);
recenter_button_pressed(width() / scale(), height() / 2 / scale());
} else {
key_unit_move(DIR8_EAST);
}
return;
case Qt::Key_Down:
case Qt::Key_2:
if (is_shift) {
recenter_button_pressed(queen()->mapview_wdg->width() / 2 / scale,
queen()->mapview_wdg->height() / scale);
recenter_button_pressed(width() / 2 / scale(), height() / scale());
} else {
key_unit_move(DIR8_SOUTH);
}
Expand Down