Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/teeworlds/teeworlds into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
AssassinTee committed Apr 27, 2019
2 parents 93aa884 + 07fa835 commit 05c6a7a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 30 deletions.
4 changes: 2 additions & 2 deletions src/engine/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
net_addr_str(m_NetServer.ClientAddr(ClientID), aAddrStr, sizeof(aAddrStr), true);

char aBuf[256];
str_format(aBuf, sizeof(aBuf), "player is ready. ClientID=%x addr=%s", ClientID, aAddrStr);
str_format(aBuf, sizeof(aBuf), "player is ready. ClientID=%d addr=%s", ClientID, aAddrStr);
Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "server", aBuf);

bool ConnectAsSpec = m_aClients[ClientID].m_State == CClient::STATE_CONNECTING_AS_SPEC;
Expand All @@ -921,7 +921,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
net_addr_str(m_NetServer.ClientAddr(ClientID), aAddrStr, sizeof(aAddrStr), true);

char aBuf[256];
str_format(aBuf, sizeof(aBuf), "player has entered the game. ClientID=%x addr=%s", ClientID, aAddrStr);
str_format(aBuf, sizeof(aBuf), "player has entered the game. ClientID=%d addr=%s", ClientID, aAddrStr);
Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
m_aClients[ClientID].m_State = CClient::STATE_INGAME;
SendServerInfo(ClientID);
Expand Down
57 changes: 29 additions & 28 deletions src/game/client/components/chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ CChat::CChat()
};
const int CommandsCount = sizeof(s_aapCommands) / sizeof(CChatCommand);
m_pCommands = new CChatCommands(s_aapCommands, CommandsCount);

OnReset();
}

CChat::~CChat()
Expand All @@ -46,33 +44,36 @@ CChat::~CChat()

void CChat::OnReset()
{
for(int i = 0; i < MAX_LINES; i++)
if(Client()->State() == IClient::STATE_OFFLINE || Client()->State() == IClient::STATE_DEMOPLAYBACK)
{
m_aLines[i].m_Time = 0;
m_aLines[i].m_aText[0] = 0;
m_aLines[i].m_aName[0] = 0;
}

m_Mode = CHAT_NONE;
// m_WhisperTarget = -1;
m_LastWhisperFrom = -1;
m_ReverseCompletion = false;
m_Show = false;
m_InputUpdate = false;
m_ChatStringOffset = 0;
m_CompletionChosen = -1;
m_CompletionFav = -1;
m_aCompletionBuffer[0] = 0;
m_PlaceholderOffset = 0;
m_PlaceholderLength = 0;
m_pHistoryEntry = 0x0;
m_PendingChatCounter = 0;
m_LastChatSend = 0;
m_IgnoreCommand = false;
m_pCommands->Reset();
for(int i = 0; i < MAX_LINES; i++)
{
m_aLines[i].m_Time = 0;
m_aLines[i].m_aText[0] = 0;
m_aLines[i].m_aName[0] = 0;
}

for(int i = 0; i < CHAT_NUM; ++i)
m_aLastSoundPlayed[i] = 0;
m_Mode = CHAT_NONE;
// m_WhisperTarget = -1;
m_LastWhisperFrom = -1;
m_ReverseCompletion = false;
m_Show = false;
m_InputUpdate = false;
m_ChatStringOffset = 0;
m_CompletionChosen = -1;
m_CompletionFav = -1;
m_aCompletionBuffer[0] = 0;
m_PlaceholderOffset = 0;
m_PlaceholderLength = 0;
m_pHistoryEntry = 0x0;
m_PendingChatCounter = 0;
m_LastChatSend = 0;
m_IgnoreCommand = false;
m_pCommands->Reset();

for(int i = 0; i < CHAT_NUM; ++i)
m_aLastSoundPlayed[i] = 0;
}
}

void CChat::OnRelease()
Expand Down Expand Up @@ -178,7 +179,7 @@ void CChat::OnConsoleInit()

bool CChat::OnInput(IInput::CEvent Event)
{
if(m_Mode == CHAT_NONE)
if(m_Mode == CHAT_NONE || Client()->State() != Client()->STATE_ONLINE)
return false;

if(Event.m_Flags&IInput::FLAG_PRESS && Event.m_Key == KEY_ESCAPE)
Expand Down

0 comments on commit 05c6a7a

Please sign in to comment.