# HG changeset patch # User Teemu Piippo # Date 1469199830 -10800 # Node ID cf514fa0f1cca7f3261b7bf7127c0fe953e04a50 # Parent 970d58a01e8bd7b18e701dff42390c9f3234eedf Fixed compilation problems. diff -r 970d58a01e8b -r cf514fa0f1cc sources/interface.cpp --- a/sources/interface.cpp Fri Jul 22 17:59:55 2016 +0300 +++ b/sources/interface.cpp Fri Jul 22 18:03:50 2016 +0300 @@ -1097,7 +1097,7 @@ else if (command == "watch") { if (not args.is_empty()) - m_session.request_watch(args); + m_session.requestWatch(args); else printError("No CVars to watch.\n"); } diff -r 970d58a01e8b -r cf514fa0f1cc sources/network/rconsession.cpp --- a/sources/network/rconsession.cpp Fri Jul 22 17:59:55 2016 +0300 +++ b/sources/network/rconsession.cpp Fri Jul 22 18:03:50 2016 +0300 @@ -126,11 +126,11 @@ try { - int32_t header = datagram.message.read_long(); - int32_t sequenceNumber = (header != 0) ? datagram.message.read_long() : 0; + int32_t header = stream.readLong(); + int32_t sequenceNumber = (header != 0) ? stream.readLong() : 0; m_interface->print("Recieved packet with header 0x%x and sequence number #%d\n", header, sequenceNumber); - while (datagram.message.bytes_left() > 0) + while (stream.bytesLeft() > 0) { int header = stream.readByte(); @@ -187,7 +187,7 @@ m_interface->print("End of previous messages.\n"); // Watch sv_hostname so that we can update the titlebar when it changes. - request_watch("sv_hostname"); + requestWatch("sv_hostname"); m_interface->print ("Watch requested.\n"); break; @@ -230,22 +230,22 @@ break; case SVRC_WATCHINGCVAR: - m_interface->print ("You are now watching %s\n", datagram.message.read_string().chars()); - m_interface->print ("Its value is: %s\n", datagram.message.read_string().chars()); + m_interface->print ("You are now watching %s\n", stream.readString().chars()); + m_interface->print ("Its value is: %s\n", stream.readString().chars()); break; case SVRC_ALREADYWATCHINGCVAR: - m_interface->print ("You are already watching %s\n", datagram.message.read_string().chars()); + m_interface->print ("You are already watching %s\n", stream.readString().chars()); break; case SVRC_WATCHCVARNOTFOUND: - m_interface->print ("CVar %s not found\n", datagram.message.read_string().chars()); + m_interface->print ("CVar %s not found\n", stream.readString().chars()); break; case SVRC_CVARCHANGED: { - String name = datagram.message.read_string(); - String value = datagram.message.read_string(); + String name = stream.readString(); + String value = stream.readString(); m_interface->print ("The value of CVar %s", name.chars()); m_interface->print (" is now %s\n", value.chars()); @@ -259,7 +259,7 @@ break; case SVRC_YOUREDISCONNECTED: - m_interface->print ("You have been disconnected: %s\n", datagram.message.read_string().chars()); + m_interface->print ("You have been disconnected: %s\n", stream.readString().chars()); m_interface->disconnected(); break; } @@ -430,25 +430,26 @@ // ------------------------------------------------------------------------------------------------- // -void RCONSession::request_watch (const String& cvar) +void RCONSession::requestWatch(const String& cvar) { StringList cvars; cvars.append(cvar); - request_watch(cvars); + requestWatch(cvars); } // ------------------------------------------------------------------------------------------------- // -void RCONSession::request_watch (const StringList& cvars) +void RCONSession::requestWatch(const StringList& cvars) { - Bytestream packet; - packet.write_byte(CLRC_WATCHCVAR); + Vector message; + Bytestream stream(message); + stream.writeByte(CLRC_WATCHCVAR); - for (int i = 0; i < cvars.size(); ++i) - packet.write_string(cvars[i].normalized()); + for (const String& cvar : cvars) + stream.writeString(cvar.normalized()); - packet.write_string(""); - send(packet); + stream.writeString(""); + send(message); } END_ZFC_NAMESPACE diff -r 970d58a01e8b -r cf514fa0f1cc sources/network/rconsession.h --- a/sources/network/rconsession.h Fri Jul 22 17:59:55 2016 +0300 +++ b/sources/network/rconsession.h Fri Jul 22 18:03:50 2016 +0300 @@ -113,6 +113,8 @@ bool isActive() const; void processServerUpdates(Bytestream& packet); void requestTabCompletion(const String& part); + void requestWatch (const String& cvar); + void requestWatch (const StringList& cvars); void send(const ByteArray& packet); bool sendCommand(const String& commandString); void sendHello(); @@ -120,8 +122,6 @@ void setInterface(class Interface* interface); void setPassword(const String& password); void tick(); - void request_watch (const String& cvar); - void request_watch (const StringList& cvars); private: RCONSessionState m_state;