Made chatting save between ScreenNetSelectMusic's
This commit is contained in:
@@ -562,9 +562,11 @@ void NetworkSyncManager::ProcessInput()
|
||||
SCREENMAN->SystemMessage( SysMSG );
|
||||
}
|
||||
break;
|
||||
case 7: //Chat message from server
|
||||
case 7: //Chat message from server
|
||||
{
|
||||
m_WaitingChat = m_packet.ReadNT();
|
||||
m_sChatText += m_packet.ReadNT() + " \n ";
|
||||
//10000 chars backlog should be more than enough
|
||||
m_sChatText = m_sChatText.Right(10000);
|
||||
SCREENMAN->SendMessageToTopScreen( SM_AddToChat );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -100,6 +100,8 @@ public:
|
||||
int m_iSelectMode;
|
||||
void SelectUserSong();
|
||||
|
||||
CString m_sChatText;
|
||||
|
||||
bool isLanServer; //Must be public for ScreenNetworkOptions
|
||||
StepManiaLanServer *LANserver;
|
||||
private:
|
||||
|
||||
@@ -86,8 +86,7 @@ ScreenNetSelectMusic::ScreenNetSelectMusic( const CString& sName ) : ScreenWithM
|
||||
SET_XY_AND_ON_COMMAND( m_textChatInput );
|
||||
this->AddChild( &m_textChatInput );
|
||||
|
||||
|
||||
m_textOutHidden.LoadFromFont( THEME->GetPathF(m_sName,"chat") );
|
||||
m_textOutHidden.LoadFromFont( THEME->GetPathF("ScreenNetSelectMusic","chat") );
|
||||
m_textOutHidden.SetWrapWidthPixels( (int)(CHATOUTPUT_WIDTH * 2) );
|
||||
|
||||
m_textChatOutput.LoadFromFont( THEME->GetPathF(m_sName,"chat") );
|
||||
@@ -98,6 +97,15 @@ ScreenNetSelectMusic::ScreenNetSelectMusic( const CString& sName ) : ScreenWithM
|
||||
SET_XY_AND_ON_COMMAND( m_textChatOutput );
|
||||
this->AddChild( &m_textChatOutput );
|
||||
|
||||
//Display updated chat (maybe this should be a function)?
|
||||
m_textOutHidden.SetText( NSMAN->m_sChatText );
|
||||
vector <wstring> wLines;
|
||||
m_textOutHidden.GetLines( wLines );
|
||||
m_actualText = "";
|
||||
for (unsigned i = max(int(wLines.size()) - SHOW_CHAT_LINES, 0 ) ; i < wLines.size() ; ++i)
|
||||
m_actualText += WStringToCString( wLines[i] )+'\n';
|
||||
m_textChatOutput.SetText( m_actualText );
|
||||
|
||||
//Groups
|
||||
|
||||
m_rectGroupsBackground.SetDiffuse( GROUPSBG_COLOR );
|
||||
@@ -329,17 +337,13 @@ void ScreenNetSelectMusic::HandleScreenMessage( const ScreenMessage SM )
|
||||
break;
|
||||
case SM_AddToChat:
|
||||
{
|
||||
//This SHOULD be done with cropping, but I cant seem to get
|
||||
//text to crop properly.
|
||||
m_sChatText += NSMAN->m_WaitingChat + " \n "; //Forced newline
|
||||
NSMAN->m_WaitingChat = "";
|
||||
m_textOutHidden.SetText( m_sChatText );
|
||||
m_textOutHidden.SetText( NSMAN->m_sChatText );
|
||||
vector <wstring> wLines;
|
||||
m_textOutHidden.GetLines( wLines );
|
||||
CString actualText = "";
|
||||
m_actualText = "";
|
||||
for (unsigned i = max(int(wLines.size()) - SHOW_CHAT_LINES, 0 ) ; i < wLines.size() ; ++i)
|
||||
actualText += WStringToCString(wLines[i])+'\n';
|
||||
m_textChatOutput.SetText( actualText );
|
||||
m_actualText += WStringToCString( wLines[i] )+'\n';
|
||||
m_textChatOutput.SetText( m_actualText );
|
||||
break;
|
||||
}
|
||||
case SM_ChangeSong:
|
||||
|
||||
@@ -67,7 +67,8 @@ private:
|
||||
Quad m_rectChatInputBox;
|
||||
Quad m_rectChatOutputBox;
|
||||
CString m_sTextInput;
|
||||
CString m_sChatText;
|
||||
CString m_actualText;
|
||||
|
||||
|
||||
//Selection
|
||||
Quad m_rectSelection;
|
||||
|
||||
Reference in New Issue
Block a user