summaryrefslogtreecommitdiffhomepage
path: root/logic
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-06-26 22:25:22 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-06-26 23:05:21 +0200
commitd65936200a2756e6619a109fa6fa673b91df802e (patch)
tree80b6b6fc7ba9023cbe47290b8ae1bc5468a19bb1 /logic
parent4046773c41ee3c0f65840828ab983cfd13451c85 (diff)
modernize C++ syntax
No visible changes (hopefully).
Diffstat (limited to 'logic')
-rw-r--r--logic/pipeline.cpp6
-rw-r--r--logic/pipeline.hpp2
-rw-r--r--logic/shortcuts.cpp4
-rw-r--r--logic/win32-shortcuts.cpp2
4 files changed, 7 insertions, 7 deletions
diff --git a/logic/pipeline.cpp b/logic/pipeline.cpp
index 7b4444c3..bf264315 100644
--- a/logic/pipeline.cpp
+++ b/logic/pipeline.cpp
@@ -130,7 +130,7 @@ Pose reltrans::apply_pipeline(reltrans_state state, const Pose& value,
interp_timer.start();
- if (RC_phase + 1 != std::size(RC_phases) &&
+ if (RC_phase + 1 < std::size(RC_phases) &&
interp_phase_timer.elapsed_seconds() > RC_time_deltas[RC_phase])
{
RC_phase++;
@@ -252,7 +252,7 @@ void emit_nan_check_msg(const char* text, const char* fun, int line)
qDebug() << "nan check failed"
<< "for:" << text
<< "function:" << fun
- << "line:" << line;
+ << "line:" << line
);
}
@@ -577,7 +577,7 @@ void pipeline::run()
{
qDebug() << "tracker: backlog interval overflow"
<< time_cast<ms>(backlog_time).count() << "ms";
- backlog_time = backlog_time.zero();
+ backlog_time = ns::zero();
}
backlog_time += ns(elapsed_nsecs - const_sleep_ms);
diff --git a/logic/pipeline.hpp b/logic/pipeline.hpp
index 4a676862..0b48d741 100644
--- a/logic/pipeline.hpp
+++ b/logic/pipeline.hpp
@@ -39,7 +39,7 @@ class reltrans
// this implements smooth transition into reltrans mode
// once not aiming anymore. see `apply_pipeline()'.
Timer interp_phase_timer;
- unsigned RC_phase;
+ unsigned RC_phase = 0;
bool cur = false;
bool in_zone = false;
diff --git a/logic/shortcuts.cpp b/logic/shortcuts.cpp
index 5ddefc1f..478036a2 100644
--- a/logic/shortcuts.cpp
+++ b/logic/shortcuts.cpp
@@ -130,14 +130,14 @@ void Shortcuts::reload(const t_keys& keys_)
const auto& kk = keys_[i];
const key_opts& opts = std::get<0>(kk);
const bool held = std::get<2>(kk);
- auto fun = std::get<1>(kk);
+ auto const& fun = std::get<1>(kk);
#ifdef _WIN32
K k;
#else
K k(nullptr);
#endif
bind_shortcut(k, opts, held);
- keys.push_back(tt(k, [=](bool flag) { fun(flag); }, held));
+ keys.emplace_back(k, [=](bool flag) { fun(flag); }, held);
#ifndef _WIN32
const int idx = keys.size() - 1;
diff --git a/logic/win32-shortcuts.cpp b/logic/win32-shortcuts.cpp
index 2099ce09..170d16fe 100644
--- a/logic/win32-shortcuts.cpp
+++ b/logic/win32-shortcuts.cpp
@@ -119,7 +119,7 @@ static const win_key windows_key_sequences[] {
{ DIK_PAUSE, Qt::Key_Pause},
{ DIK_NUMLOCK, Qt::Key_NumLock},
{ DIK_CAPSLOCK, Qt::Key_CapsLock},
-#define mod(x, y) static_cast<Qt::Key>(x | y)
+#define mod(x, y) static_cast<Qt::Key>((x) | (y))
{ DIK_NUMPAD0, mod(Qt::Key_0, Qt::KeypadModifier)},
{ DIK_NUMPAD0, mod(Qt::Key_0, Qt::KeypadModifier)},
{ DIK_NUMPAD1, mod(Qt::Key_1, Qt::KeypadModifier)},