summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-25 17:13:57 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-10-18 08:21:32 +0000
commit77846cfb61a3e4793d3fae5c1cc23fb68851c9ac (patch)
treefd10ecf040ae75d4c29fa1fd784e373ab109508a /src/gui
parentf52629f339c3f50fd4e42842026cfe28e2c55e2e (diff)
downloadmana-77846cfb61a3e4793d3fae5c1cc23fb68851c9ac.tar.gz
mana-77846cfb61a3e4793d3fae5c1cc23fb68851c9ac.tar.bz2
mana-77846cfb61a3e4793d3fae5c1cc23fb68851c9ac.tar.xz
mana-77846cfb61a3e4793d3fae5c1cc23fb68851c9ac.zip
Avoid accessing static members through instances
Fixed with clang-tidy `readability-static-accessed-through-instance` check.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/inventorywindow.cpp2
-rw-r--r--src/gui/setup_keyboard.cpp10
-rw-r--r--src/gui/viewport.cpp4
3 files changed, 8 insertions, 8 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 450ddfe5..048f83f5 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -277,7 +277,7 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
if (event.getButton() == gcn::MouseEvent::LEFT)
{
- if (instances.size() > 1 && keyboard.isKeyActive(keyboard.KEY_EMOTE))
+ if (instances.size() > 1 && keyboard.isKeyActive(KeyboardConfig::KEY_EMOTE))
{
Item *item = mItems->getSelectedItem();
diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp
index ee6e340f..f40a8109 100644
--- a/src/gui/setup_keyboard.cpp
+++ b/src/gui/setup_keyboard.cpp
@@ -51,7 +51,7 @@ class KeyListModel : public gcn::ListModel
/**
* Returns the number of elements in container.
*/
- int getNumberOfElements() override { return keyboard.KEY_TOTAL; }
+ int getNumberOfElements() override { return KeyboardConfig::KEY_TOTAL; }
/**
* Returns element from container.
@@ -161,7 +161,7 @@ void Setup_Keyboard::action(const gcn::ActionEvent &event)
int i(mKeyList->getSelected());
keyboard.setNewKeyIndex(i);
refreshAssignedKey(mKeyList->getSelected());
- keyboard.setNewKey(keyboard.KEY_NO_VALUE);
+ keyboard.setNewKey(KeyboardConfig::KEY_NO_VALUE);
mAssignKeyButton->setEnabled(true);
}
else if (event.getId() == "makeDefault")
@@ -174,7 +174,7 @@ void Setup_Keyboard::action(const gcn::ActionEvent &event)
void Setup_Keyboard::refreshAssignedKey(int index)
{
std::string caption;
- if (keyboard.getKeyValue(index) == keyboard.KEY_NO_VALUE)
+ if (keyboard.getKeyValue(index) == KeyboardConfig::KEY_NO_VALUE)
caption = keyboard.getKeyCaption(index) + ": ";
else
{
@@ -198,7 +198,7 @@ void Setup_Keyboard::newKeyCallback(int index)
void Setup_Keyboard::refreshKeys()
{
- for (int i = 0; i < keyboard.KEY_TOTAL; i++)
+ for (int i = 0; i < KeyboardConfig::KEY_TOTAL; i++)
{
refreshAssignedKey(i);
}
@@ -209,6 +209,6 @@ void Setup_Keyboard::keyUnresolved()
if (mKeySetting)
{
newKeyCallback(keyboard.getNewKeyIndex());
- keyboard.setNewKeyIndex(keyboard.KEY_NO_VALUE);
+ keyboard.setNewKeyIndex(KeyboardConfig::KEY_NO_VALUE);
}
}
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 9c1d2c9f..8fcca014 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -480,10 +480,10 @@ void Viewport::mousePressed(gcn::MouseEvent &event)
{
if (local_player->withinRange(mHoverBeing,
local_player->getAttackRange())
- || keyboard.isKeyActive(keyboard.KEY_ATTACK))
+ || keyboard.isKeyActive(KeyboardConfig::KEY_ATTACK))
{
local_player->attack(mHoverBeing,
- !keyboard.isKeyActive(keyboard.KEY_TARGET));
+ !keyboard.isKeyActive(KeyboardConfig::KEY_TARGET));
}
else
{