mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-25 16:22:47 +01:00
tas_input: Avoid minor copies in Read/WriteCommandButtons()
We don't need to copy the whole pair
This commit is contained in:
parent
734fb180bb
commit
54ca48e8b7
1 changed files with 2 additions and 2 deletions
|
@ -244,7 +244,7 @@ u64 Tas::ReadCommandButtons(const std::string& line) const {
|
|||
std::string button_line;
|
||||
u64 buttons = 0;
|
||||
while (std::getline(button_text, button_line, ';')) {
|
||||
for (auto [text, tas_button] : text_to_tas_button) {
|
||||
for (const auto& [text, tas_button] : text_to_tas_button) {
|
||||
if (text == button_line) {
|
||||
buttons |= static_cast<u64>(tas_button);
|
||||
break;
|
||||
|
@ -256,7 +256,7 @@ u64 Tas::ReadCommandButtons(const std::string& line) const {
|
|||
|
||||
std::string Tas::WriteCommandButtons(u64 buttons) const {
|
||||
std::string returns;
|
||||
for (auto [text_button, tas_button] : text_to_tas_button) {
|
||||
for (const auto& [text_button, tas_button] : text_to_tas_button) {
|
||||
if ((buttons & static_cast<u64>(tas_button)) != 0) {
|
||||
returns += fmt::format("{};", text_button);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue