Made chatting save between ScreenNetSelectMusic's

This commit is contained in:
Charles Lohr
2004-09-01 05:02:28 +00:00
parent 82e4a01612
commit a3cad63f0f
4 changed files with 22 additions and 13 deletions
+3 -1
View File
@@ -564,7 +564,9 @@ void NetworkSyncManager::ProcessInput()
break; 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 ); SCREENMAN->SendMessageToTopScreen( SM_AddToChat );
} }
break; break;
+2
View File
@@ -100,6 +100,8 @@ public:
int m_iSelectMode; int m_iSelectMode;
void SelectUserSong(); void SelectUserSong();
CString m_sChatText;
bool isLanServer; //Must be public for ScreenNetworkOptions bool isLanServer; //Must be public for ScreenNetworkOptions
StepManiaLanServer *LANserver; StepManiaLanServer *LANserver;
private: private:
+14 -10
View File
@@ -86,8 +86,7 @@ ScreenNetSelectMusic::ScreenNetSelectMusic( const CString& sName ) : ScreenWithM
SET_XY_AND_ON_COMMAND( m_textChatInput ); SET_XY_AND_ON_COMMAND( m_textChatInput );
this->AddChild( &m_textChatInput ); this->AddChild( &m_textChatInput );
m_textOutHidden.LoadFromFont( THEME->GetPathF("ScreenNetSelectMusic","chat") );
m_textOutHidden.LoadFromFont( THEME->GetPathF(m_sName,"chat") );
m_textOutHidden.SetWrapWidthPixels( (int)(CHATOUTPUT_WIDTH * 2) ); m_textOutHidden.SetWrapWidthPixels( (int)(CHATOUTPUT_WIDTH * 2) );
m_textChatOutput.LoadFromFont( THEME->GetPathF(m_sName,"chat") ); 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 ); SET_XY_AND_ON_COMMAND( m_textChatOutput );
this->AddChild( &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 //Groups
m_rectGroupsBackground.SetDiffuse( GROUPSBG_COLOR ); m_rectGroupsBackground.SetDiffuse( GROUPSBG_COLOR );
@@ -329,17 +337,13 @@ void ScreenNetSelectMusic::HandleScreenMessage( const ScreenMessage SM )
break; break;
case SM_AddToChat: case SM_AddToChat:
{ {
//This SHOULD be done with cropping, but I cant seem to get m_textOutHidden.SetText( NSMAN->m_sChatText );
//text to crop properly.
m_sChatText += NSMAN->m_WaitingChat + " \n "; //Forced newline
NSMAN->m_WaitingChat = "";
m_textOutHidden.SetText( m_sChatText );
vector <wstring> wLines; vector <wstring> wLines;
m_textOutHidden.GetLines( wLines ); m_textOutHidden.GetLines( wLines );
CString actualText = ""; m_actualText = "";
for (unsigned i = max(int(wLines.size()) - SHOW_CHAT_LINES, 0 ) ; i < wLines.size() ; ++i) for (unsigned i = max(int(wLines.size()) - SHOW_CHAT_LINES, 0 ) ; i < wLines.size() ; ++i)
actualText += WStringToCString(wLines[i])+'\n'; m_actualText += WStringToCString( wLines[i] )+'\n';
m_textChatOutput.SetText( actualText ); m_textChatOutput.SetText( m_actualText );
break; break;
} }
case SM_ChangeSong: case SM_ChangeSong:
+2 -1
View File
@@ -67,7 +67,8 @@ private:
Quad m_rectChatInputBox; Quad m_rectChatInputBox;
Quad m_rectChatOutputBox; Quad m_rectChatOutputBox;
CString m_sTextInput; CString m_sTextInput;
CString m_sChatText; CString m_actualText;
//Selection //Selection
Quad m_rectSelection; Quad m_rectSelection;