--- a/sources/network/rconsession.cpp Wed Jul 20 13:29:03 2016 +0300 +++ b/sources/network/rconsession.cpp Wed Jul 20 15:03:37 2016 +0300 @@ -59,7 +59,7 @@ { m_address = address; m_state = RCON_CONNECTING; - m_interface->update_statusbar(); + m_interface->updateStatusBar(); send_hello(); } @@ -140,12 +140,12 @@ switch (ServerResponse (header)) { case SVRC_OLDPROTOCOL: - m_interface->print_error ("Your RCON client is using outdated protocol.\n"); + m_interface->printError ("Your RCON client is using outdated protocol.\n"); m_state = RCON_DISCONNECTED; break; case SVRC_BANNED: - m_interface->print_error ("You have been banned from the server.\n"); + m_interface->printError ("You have been banned from the server.\n"); m_state = RCON_DISCONNECTED; break; @@ -156,7 +156,7 @@ break; case SVRC_INVALIDPASSWORD: - m_interface->print_error ("Login failed.\n"); + m_interface->printError ("Login failed.\n"); m_state = RCON_DISCONNECTED; break; @@ -164,7 +164,7 @@ { String message = packet.read_string(); message.normalize(); - m_interface->print_text ("%s\n", message.chars()); + m_interface->printText ("%s\n", message.chars()); } break; @@ -172,7 +172,7 @@ m_interface->print ("Login successful!\n"); m_serverProtocol = packet.read_byte(); m_hostname = packet.read_string(); - m_interface->set_title (m_hostname); + m_interface->setTitle (m_hostname); m_state = RCON_CONNECTED; for (int i = packet.read_byte(); i > 0; --i) @@ -184,7 +184,7 @@ { String message = packet.read_string(); message.normalize(); - m_interface->print_text ("--- %s\n", message.chars()); + m_interface->printText ("--- %s\n", message.chars()); } m_interface->print ("End of previous messages.\n"); @@ -209,21 +209,22 @@ case SVRC_TABCOMPLETE: { StringList completes; + completes.resize(packet.read_byte()); - for (signed int i = packet.read_byte(); i > 0; --i) - completes << packet.read_string(); + for (String& completion : completes) + completion = packet.read_string(); if (completes.size() == 1) { - m_interface->tab_complete (m_lastTabComplete, completes[0]); + m_interface->tabComplete (m_lastTabComplete, completes[0]); } else if (not completes.is_empty()) { m_interface->print ("Completions for '%s':\n", m_lastTabComplete.chars()); - for (int i = 0; i < completes.size(); i += 8) + for (int i : range(0, completes.size(), 8)) { - Range<int> spliceRange (i, min (i + 8, completes.size() - 1)); + Range<int> spliceRange (i, min (i + 8, completes.size())); StringList splice (completes.splice (spliceRange)); m_interface->print ("- %s\n", splice.join (", ").chars()); } @@ -269,7 +270,7 @@ } catch (std::exception& e) { - m_interface->print_warning ("Couldn't process packet: %s\n", e.what()); + m_interface->printWarning ("Couldn't process packet: %s\n", e.what()); } } @@ -286,22 +287,22 @@ for (int i = packet.read_byte(); i > 0; --i) players.append (packet.read_string()); - m_interface->set_player_names (players); + m_interface->setPlayerNames (players); } break; case SVRCU_ADMINCOUNT: m_numAdmins = packet.read_byte(); - m_interface->update_statusbar(); + m_interface->updateStatusBar(); break; case SVRCU_MAP: m_level = packet.read_string(); - m_interface->update_statusbar(); + m_interface->updateStatusBar(); break; default: - m_interface->print_warning ("Unknown server update type: %d\n", header); + m_interface->printWarning ("Unknown server update type: %d\n", header); break; } }