Skip to content

Commit

Permalink
Remove useless queen() calls
Browse files Browse the repository at this point in the history
We were using queen()->mapview even from *inside* the map_view class.
Nonsense...
  • Loading branch information
lmoureaux authored and psampathkumar committed Aug 1, 2022
1 parent 99178b0 commit 82c3123
Showing 1 changed file with 4 additions and 10 deletions.
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,
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

0 comments on commit 82c3123

Please sign in to comment.