From 82c31236c8f53fc6a77aff459486596e87781b70 Mon Sep 17 00:00:00 2001 From: Louis Moureaux Date: Fri, 22 Jul 2022 15:27:32 +0200 Subject: [PATCH] Remove useless queen() calls We were using queen()->mapview even from *inside* the map_view class. Nonsense... --- client/mapctrl.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/client/mapctrl.cpp b/client/mapctrl.cpp index b54cb89f01..c39afbe418 100644 --- a/client/mapctrl.cpp +++ b/client/mapctrl.cpp @@ -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()) { @@ -116,8 +114,7 @@ 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); } @@ -125,8 +122,7 @@ void map_view::keyPressEvent(QKeyEvent *event) 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); } @@ -134,8 +130,7 @@ void map_view::keyPressEvent(QKeyEvent *event) 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); } @@ -143,8 +138,7 @@ void map_view::keyPressEvent(QKeyEvent *event) 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); }