Skip to content

Commit

Permalink
Merge pull request #4899 from lioncash/array
Browse files Browse the repository at this point in the history
ControlGroup: Use std::array for Force and Tilt groups
  • Loading branch information
Helios747 committed Feb 12, 2017
2 parents 0e96177 + 1a99e70 commit 7d36f1a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
3 changes: 0 additions & 3 deletions Source/Core/InputCommon/ControllerEmu/ControlGroup/Force.cpp
Expand Up @@ -5,7 +5,6 @@
#include "InputCommon/ControllerEmu/ControlGroup/Force.h"

#include <cmath>
#include <cstring>
#include <memory>
#include <string>

Expand All @@ -19,8 +18,6 @@ namespace ControllerEmu
{
Force::Force(const std::string& name_) : ControlGroup(name_, GROUP_TYPE_FORCE)
{
memset(m_swing, 0, sizeof(m_swing));

controls.emplace_back(std::make_unique<Input>(_trans("Up")));
controls.emplace_back(std::make_unique<Input>(_trans("Down")));
controls.emplace_back(std::make_unique<Input>(_trans("Left")));
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/InputCommon/ControllerEmu/ControlGroup/Force.h
Expand Up @@ -4,6 +4,7 @@

#pragma once

#include <array>
#include <string>
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"

Expand All @@ -17,6 +18,6 @@ class Force : public ControlGroup
void GetState(ControlState* axis);

private:
ControlState m_swing[3];
std::array<ControlState, 3> m_swing{};
};
} // namespace ControllerEmu
3 changes: 0 additions & 3 deletions Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.cpp
Expand Up @@ -6,7 +6,6 @@

#include <algorithm>
#include <cmath>
#include <cstring>
#include <memory>
#include <string>

Expand All @@ -19,8 +18,6 @@ namespace ControllerEmu
{
Tilt::Tilt(const std::string& name_) : ControlGroup(name_, GROUP_TYPE_TILT)
{
memset(m_tilt, 0, sizeof(m_tilt));

controls.emplace_back(std::make_unique<Input>("Forward"));
controls.emplace_back(std::make_unique<Input>("Backward"));
controls.emplace_back(std::make_unique<Input>("Left"));
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/InputCommon/ControllerEmu/ControlGroup/Tilt.h
Expand Up @@ -4,6 +4,7 @@

#pragma once

#include <array>
#include <string>
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"

Expand All @@ -17,6 +18,6 @@ class Tilt : public ControlGroup
void GetState(ControlState* x, ControlState* y, bool step = true);

private:
ControlState m_tilt[2];
std::array<ControlState, 2> m_tilt{};
};
} // namespace ControllerEmu

0 comments on commit 7d36f1a

Please sign in to comment.