summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2016-06-26 04:03:33 +0200
committerGitHub <noreply@github.com>2016-06-26 04:03:33 +0200
commitc1fa1e67497ed38623f63d1457e1992e56287833 (patch)
treeab08f49876092b20db0d05faabfa769c76fb2abc /Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
parente31a4d1f0731603d0396e592e23cf7acd0457397 (diff)
parent8678133e8746fdc20f7d012005ebf2db370ddccc (diff)
Merge pull request #3923 from leoetlino/ciface-small-cleanup
ControllerInterface: Small cleanup
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
index b36387162d..cbf2c4dfbb 100644
--- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
@@ -2,8 +2,10 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
-#include "InputCommon/ControllerInterface/ControllerInterface.h"
+#include <mutex>
+
#include "Common/Thread.h"
+#include "InputCommon/ControllerInterface/ControllerInterface.h"
#ifdef CIFACE_USE_XINPUT
#include "InputCommon/ControllerInterface/XInput/XInput.h"
@@ -106,14 +108,11 @@ void ControllerInterface::Shutdown()
std::lock_guard<std::mutex> lk(m_devices_mutex);
- for (ciface::Core::Device* d : m_devices)
+ for (const auto& d : m_devices)
{
// Set outputs to ZERO before destroying device
for (ciface::Core::Device::Output* o : d->Outputs())
o->SetState(0);
-
- // Delete device
- delete d;
}
m_devices.clear();
@@ -141,10 +140,10 @@ void ControllerInterface::Shutdown()
m_is_init = false;
}
-void ControllerInterface::AddDevice(ciface::Core::Device* device)
+void ControllerInterface::AddDevice(std::shared_ptr<ciface::Core::Device> device)
{
std::lock_guard<std::mutex> lk(m_devices_mutex);
- m_devices.push_back(device);
+ m_devices.emplace_back(std::move(device));
}
//
@@ -155,7 +154,7 @@ void ControllerInterface::AddDevice(ciface::Core::Device* device)
void ControllerInterface::UpdateInput()
{
std::lock_guard<std::mutex> lk(m_devices_mutex);
- for (ciface::Core::Device* d : m_devices)
+ for (const auto& d : m_devices)
d->UpdateInput();
}