--- a/sources/interface.cpp Wed Jan 27 14:04:53 2021 +0200 +++ b/sources/interface.cpp Wed Jan 27 14:05:39 2021 +0200 @@ -51,7 +51,7 @@ // ------------------------------------------------------------------------------------------------- // -const String& Interface::getCurrentInput() +const std::string& Interface::getCurrentInput() { return m_inputHistory[m_inputCursor]; } @@ -72,7 +72,7 @@ // ------------------------------------------------------------------------------------------------- // A version of current_input() that allows changing the contents of it. // -String& Interface::getEditableInput() +std::string& Interface::getEditableInput() { detachInput(); return m_inputHistory[m_inputCursor]; @@ -101,9 +101,9 @@ // ------------------------------------------------------------------------------------------------- // -String Interface::getPromptString() +std::string Interface::getPromptString() { - String prompt; + std::string prompt; switch (m_inputState) { @@ -220,7 +220,7 @@ // ------------------------------------------------------------------------------------------------- // -void Interface::setTitle(const String& title) +void Interface::setTitle(const std::string& title) { m_title = title; renderTitlebar(); @@ -417,9 +417,9 @@ return; } - String prompt = getPromptString(); + std::string prompt = getPromptString(); int displayLength = COLS - prompt.length() - 2; - String displayString = getCurrentInput(); + std::string displayString = getCurrentInput(); int y = LINES - 2; // If we're inputting a password, replace it with asterisks @@ -478,7 +478,7 @@ // void Interface::updateStatusBar() { - String text; + std::string text; switch (m_session.getState()) { @@ -493,7 +493,7 @@ case RCON_CONNECTED: { - String adminText; + std::string adminText; if (m_session.getAdminCount() == 0) { @@ -558,7 +558,7 @@ // int Interface::findPreviousWord() { - const String& input = getCurrentInput(); + const std::string& input = getCurrentInput(); int pos = m_cursorPosition; // Move past whitespace @@ -576,7 +576,7 @@ // int Interface::findNextWord() { - const String& input = getCurrentInput(); + const std::string& input = getCurrentInput(); int pos = m_cursorPosition; // Move past current whitespace @@ -600,7 +600,7 @@ if (m_cursorPosition > a and m_cursorPosition <= b) m_cursorPosition = a; - String& input = getEditableInput(); + std::string& input = getEditableInput(); m_pasteBuffer = mid(input, a, b); input = remove_range(input, a, b - a); m_needInputRender = true; @@ -719,7 +719,7 @@ case '\b': if (m_cursorPosition > 0) { - String& input = getEditableInput(); + std::string& input = getEditableInput(); input.erase(input.begin() + m_cursorPosition); m_cursorPosition -= 1; m_needInputRender = true; @@ -730,7 +730,7 @@ case 'D' - 'A' + 1: // readline ^D if (m_cursorPosition < static_cast<signed>(getCurrentInput().length())) { - String& input = getEditableInput(); + std::string& input = getEditableInput(); input.erase(input.begin() + m_cursorPosition); m_needInputRender = true; } @@ -779,7 +779,7 @@ and m_cursorPosition > 0 and(space == -1 or space >= m_cursorPosition)) { - String start = mid(getCurrentInput(), 0, m_cursorPosition); + std::string start = mid(getCurrentInput(), 0, m_cursorPosition); m_session.requestTabCompletion(start); } } @@ -908,7 +908,7 @@ // void Interface::vprint(const char* fmtstr, va_list args) { - String message; + std::string message; message = vsprintf(fmtstr, args); printToConsole(message); } @@ -958,7 +958,7 @@ // ------------------------------------------------------------------------------------------------- // -void Interface::printToConsole(String message) +void Interface::printToConsole(std::string message) { // Zandronum sometimes sends color codes as "\\c" and sometimes as "\x1C". // Let's correct that on our end and hope this won't cause conflicts. @@ -980,7 +980,7 @@ char timestamp[32]; strftime(timestamp, sizeof timestamp, "[%H:%M:%S] ", localtime(&now)); - for (char ch : String(timestamp)) + for (char ch : std::string(timestamp)) zfc::last(m_outputLines).addChar(ch); } @@ -996,7 +996,7 @@ // ------------------------------------------------------------------------------------------------- // -void Interface::connect(String address, String password) +void Interface::connect(std::string address, std::string password) { try { @@ -1018,11 +1018,11 @@ // ------------------------------------------------------------------------------------------------- // -void Interface::setPlayerNames(const StringList& names) +void Interface::setPlayerNames(const std::vector<std::string>& names) { m_playerNames.clear(); - for (const String& name : names) + for (const std::string& name : names) { ColoredLine coloredname; coloredname.addString(name); @@ -1035,9 +1035,9 @@ // ------------------------------------------------------------------------------------------------- // -void Interface::tabComplete(const String& part, String complete) +void Interface::tabComplete(const std::string& part, std::string complete) { - String& input = getEditableInput(); + std::string& input = getEditableInput(); if (starts_with(input, part)) { @@ -1052,13 +1052,13 @@ // ------------------------------------------------------------------------------------------------- // -void Interface::handleCommand(const String& input) +void Interface::handleCommand(const std::string& input) { if (input[0] != '/') return; - StringList args = split(right(input, input.length() - 1), " "); - String command = to_lowercase(args[0]); + std::vector<std::string> args = split(right(input, input.length() - 1), " "); + std::string command = to_lowercase(args[0]); args.erase(args.begin()); if (command == "connect")