diff --git a/src/engine/client.h b/src/engine/client.h index 8dcc9839e..54fc73d2d 100644 --- a/src/engine/client.h +++ b/src/engine/client.h @@ -208,7 +208,7 @@ public: virtual int *GetInput(int Tick, int IsDummy = 0) const = 0; // remote console - virtual void RconAuth(const char *pUsername, const char *pPassword) = 0; + virtual void RconAuth(const char *pUsername, const char *pPassword, bool Dummy) = 0; virtual bool RconAuthed() const = 0; virtual bool UseTempRconCommands() const = 0; virtual void Rcon(const char *pLine) = 0; diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 607d652ea..b9242e42b 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -262,9 +262,9 @@ void CClient::SendMapRequest() } } -void CClient::RconAuth(const char *pName, const char *pPassword) +void CClient::RconAuth(const char *pName, const char *pPassword, bool Dummy) { - if(RconAuthed()) + if(m_aRconAuthed[Dummy] != 0) return; if(pName != m_aRconUsername) @@ -276,7 +276,7 @@ void CClient::RconAuth(const char *pName, const char *pPassword) { CMsgPacker Msg7(protocol7::NETMSG_RCON_AUTH, true, true); Msg7.AddString(pPassword); - SendMsgActive(&Msg7, MSGFLAG_VITAL); + SendMsg(Dummy, &Msg7, MSGFLAG_VITAL); return; } @@ -284,7 +284,7 @@ void CClient::RconAuth(const char *pName, const char *pPassword) Msg.AddString(pName); Msg.AddString(pPassword); Msg.AddInt(1); - SendMsgActive(&Msg, MSGFLAG_VITAL); + SendMsg(Dummy, &Msg, MSGFLAG_VITAL); } void CClient::Rcon(const char *pCmd) @@ -760,12 +760,7 @@ void CClient::DummyDisconnect(const char *pReason) m_aNetClient[CONN_DUMMY].Disconnect(pReason); g_Config.m_ClDummy = 0; - if(!m_aRconAuthed[0] && m_aRconAuthed[1]) - { - RconAuth(m_aRconUsername, m_aRconPassword); - } m_aRconAuthed[1] = 0; - m_aapSnapshots[1][SNAP_CURRENT] = 0; m_aapSnapshots[1][SNAP_PREV] = 0; m_aReceivedSnapshots[1] = 0; @@ -1772,6 +1767,9 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy) if(!Unpacker.Error()) { m_aRconAuthed[Conn] = ResultInt; + + if(m_aRconAuthed[Conn]) + RconAuth(m_aRconUsername, m_aRconPassword, g_Config.m_ClDummy ^ 1); } if(Conn == CONN_MAIN) { diff --git a/src/engine/client/client.h b/src/engine/client/client.h index 9b3104727..9ca2699fd 100644 --- a/src/engine/client/client.h +++ b/src/engine/client/client.h @@ -293,7 +293,7 @@ public: bool RconAuthed() const override { return m_aRconAuthed[g_Config.m_ClDummy] != 0; } bool UseTempRconCommands() const override { return m_UseTempRconCommands != 0; } - void RconAuth(const char *pName, const char *pPassword) override; + void RconAuth(const char *pName, const char *pPassword, bool Dummy = g_Config.m_ClDummy) override; void Rcon(const char *pCmd) override; bool ReceivingRconCommands() const override { return m_ExpectedRconCommands > 0; } float GotRconCommandsPercentage() const override; diff --git a/src/game/client/components/console.cpp b/src/game/client/components/console.cpp index d892898f7..803ff5929 100644 --- a/src/game/client/components/console.cpp +++ b/src/game/client/components/console.cpp @@ -310,7 +310,7 @@ void CGameConsole::CInstance::ExecuteLine(const char *pLine) } else { - m_pGameConsole->Client()->RconAuth(m_aUser, pLine); + m_pGameConsole->Client()->RconAuth(m_aUser, pLine, g_Config.m_ClDummy); m_UserGot = false; } }