diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2025-05-10 10:52:34 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2025-05-10 10:52:34 +1000 |
commit | 9d30cbd22a3f78efb6984a347630d8d601002bc1 (patch) | |
tree | 060888673996fe54cb34578e24f888f211882b8a /source/game/StarInput.cpp | |
parent | 93a8e3213287a1aab47a0a1e36925fc679f12f1d (diff) |
make clipboard available when handling user-invoked chat commands
Diffstat (limited to 'source/game/StarInput.cpp')
-rw-r--r-- | source/game/StarInput.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/source/game/StarInput.cpp b/source/game/StarInput.cpp index 7577936..d47045d 100644 --- a/source/game/StarInput.cpp +++ b/source/game/StarInput.cpp @@ -678,8 +678,24 @@ void Input::setBinds(String const& categoryId, String const& bindId, Json const& entry.updated(); } -unsigned Input::getTag(String const& tag) { - return m_activeTags.maybe(tag).value(0); +unsigned Input::getTag(String const& tagName) const { + if (auto tag = m_activeTags.ptr(tagName)) + return *tag; + else + return 0; +} + +Input::ClipboardUnlock::ClipboardUnlock(Input& input) + : m_input(&input) { ++m_input->m_clipboardAllowed; }; + +Input::ClipboardUnlock::~ClipboardUnlock() { --m_input->m_clipboardAllowed; }; + +Input::ClipboardUnlock Input::unlockClipboard() { + return Input::ClipboardUnlock(*this); +} + +bool Input::clipboardAllowed() const { + return m_clipboardAllowed > 0 ? true : getTag("clipboard") > 0; } }
\ No newline at end of file |