@@ -794,14 +794,16 @@ void CServerImpl::HandleInput()
794
794
}
795
795
else
796
796
{
797
- SString szCommand = UTF16ToMbUTF8 (m_szInputBuffer).c_str ();
798
797
// Otherwise, pass the command to the mod's input handler
799
- m_pModManager->HandleInput (szCommand );
798
+ m_pModManager->HandleInput (UTF16ToMbUTF8 (m_szInputBuffer). c_str () );
800
799
801
800
// If the command is not empty and it isn't identical to the previous entry in history, add it to the history
802
801
// The first string is the original command, the second string is for storing the edited command
803
- if (!szCommand.empty () && (m_vecCommandHistory.empty () || m_vecCommandHistory.back ()[0 ] != szCommand))
804
- m_vecCommandHistory.push_back ({szCommand, szCommand});
802
+ if (const std::wstring wzCommand = m_szInputBuffer;
803
+ !wzCommand.empty () && (m_vecCommandHistory.empty () || m_vecCommandHistory.back ()[0 ] != wzCommand))
804
+ {
805
+ m_vecCommandHistory.push_back ({wzCommand, wzCommand});
806
+ }
805
807
}
806
808
}
807
809
@@ -962,20 +964,20 @@ void CServerImpl::SelectCommandHistoryEntry(uint uiEntry)
962
964
m_uiSelectedCommandHistoryEntry = 0 ;
963
965
964
966
// Save current input buffer to the command history entry as the second element
965
- m_vecCommandHistory[uiPreviouslySelectedCommandHistoryEntry][1 ] = UTF16ToMbUTF8 (m_szInputBuffer). c_str ( );
967
+ m_vecCommandHistory[uiPreviouslySelectedCommandHistoryEntry][1 ] = std::wstring (m_szInputBuffer);
966
968
967
969
// Clear input
968
970
ClearInput ();
969
971
970
972
// If the selected command is empty, let's just stop here
971
- SString szInput = m_vecCommandHistory[m_uiSelectedCommandHistoryEntry][1 ];
972
- if (szInput .empty ())
973
+ const auto wzInput = m_vecCommandHistory[m_uiSelectedCommandHistoryEntry][1 ];
974
+ if (wzInput .empty ())
973
975
return ;
974
976
975
977
// Fill the input buffer
976
- m_uiInputCount = szInput .length ();
977
- for (uint i = 0 ; i < szInput .length (); i++)
978
- m_szInputBuffer[i] = szInput [i];
978
+ m_uiInputCount = wzInput .length ();
979
+ for (uint i = 0 ; i < wzInput .length (); i++)
980
+ m_szInputBuffer[i] = wzInput [i];
979
981
980
982
// Let's print it out
981
983
wchar_t szBuffer[255 ] = {};
0 commit comments