Allow passworded rooms. (For now, just permits private rooms)

This commit is contained in:
Charles Lohr
2006-07-21 18:53:23 +00:00
parent 0014c5097e
commit 88425d71de
5 changed files with 21 additions and 6 deletions
+1
View File
@@ -378,6 +378,7 @@ Client SMOnline packets:
1: Game room (no sub rooms)
NT Room Title
NT Room Description
NT Room Password (blank if no password)
003: Requests Room Info
Size:
@@ -1153,6 +1153,7 @@ HelpText=
[ScreenNetRoom]
Enter a description for the room:=Enter a description for the room:
Enter a password for the room (blank, no password):=Enter a password for the room (blank, no password):
[ScreenNetworkOptions2]
Disconnected from server.=Disconnected from server.
+3 -2
View File
@@ -1084,7 +1084,7 @@ NumSt=er
NumTh=ème
[RoomWheel]
Enter room name=Entrez le nom de la salle
Enter room name=Entrez le nom de la salle de jeux
[SMPackageUtil]
Could not find '%s'.=Impossible de trouver '%s'.
@@ -1276,7 +1276,8 @@ HelpText=Utilisez les touches fléchées pour bouger, ENTER pour attribuer, ESPA
InvalidButton=Cette touche ne peut être utilisée.
[ScreenNetRoom]
Enter a description for the room:=Entrez une description pour cette pièce:
Enter a description for the room:=Entrez une description pour la salle de jeux:
Enter a password for the room (blank, no password):=Entrez un mot de passe pour la salle de jeux (n'entres rien pour publique):
[ScreenNetworkOptions]
Disconnected from server.=Déconnecté du serveur.
+14 -2
View File
@@ -27,6 +27,7 @@
AutoScreenMessage( SM_SMOnlinePack )
AutoScreenMessage( SM_BackFromRoomName )
AutoScreenMessage( SM_BackFromRoomDesc )
AutoScreenMessage( SM_BackFromRoomPass );
REGISTER_SCREEN_CLASS( ScreenNetRoom );
@@ -75,6 +76,7 @@ void ScreenNetRoom::Input( const InputEventPlus &input )
}
static LocalizedString ENTER_ROOM_DESCRIPTION ("ScreenNetRoom","Enter a description for the room:");
static LocalizedString ENTER_ROOM_PASSWORD ("ScreenNetRoom","Enter a password for the room (blank, no password):");
void ScreenNetRoom::HandleScreenMessage( const ScreenMessage SM )
{
if( SM == SM_GoToPrevScreen )
@@ -156,7 +158,15 @@ void ScreenNetRoom::HandleScreenMessage( const ScreenMessage SM )
if ( !ScreenTextEntry::s_bCancelledLast )
{
m_newRoomDesc = ScreenTextEntry::s_sLastAnswer;
CreateNewRoom( m_newRoomName, m_newRoomDesc);
ScreenTextEntry::TextEntry( SM_BackFromRoomPass, ENTER_ROOM_PASSWORD, "", 255 );
}
}
else if( SM == SM_BackFromRoomPass )
{
if ( !ScreenTextEntry::s_bCancelledLast )
{
m_newRoomPass = ScreenTextEntry::s_sLastAnswer;
CreateNewRoom( m_newRoomName, m_newRoomDesc, m_newRoomPass);
}
}
ScreenNetSelectBase::HandleScreenMessage( SM );
@@ -278,12 +288,14 @@ void ScreenNetRoom::UpdateRoomsList()
m_RoomWheel.RebuildWheelItems();
}
void ScreenNetRoom::CreateNewRoom( const RString& rName, const RString& rDesc ) {
void ScreenNetRoom::CreateNewRoom( const RString& rName, const RString& rDesc, const RString & rPass ) {
NSMAN->m_SMOnlinePacket.ClearPacket();
NSMAN->m_SMOnlinePacket.Write1((uint8_t)2); //Create room command
NSMAN->m_SMOnlinePacket.Write1(1); //Type game room
NSMAN->m_SMOnlinePacket.WriteNT(rName);
NSMAN->m_SMOnlinePacket.WriteNT(rDesc);
if ( !rPass.empty() )
NSMAN->m_SMOnlinePacket.WriteNT(rPass);
NSMAN->SendSMOnline( );
}
+2 -2
View File
@@ -42,7 +42,7 @@ private:
void UpdateRoomsList();
void MenuLeft( const InputEventPlus &input );
void MenuRight( const InputEventPlus &input );
void CreateNewRoom( const RString& rName, const RString& rDesc );
void CreateNewRoom( const RString& rName, const RString& rDesc, const RString& rPass );
RageSound m_soundChangeSel;
@@ -53,7 +53,7 @@ private:
vector < RoomData > m_Rooms;
int m_iRoomPlace;
RString m_newRoomName, m_newRoomDesc;
RString m_newRoomName, m_newRoomDesc, m_newRoomPass;
RoomWheel m_RoomWheel;
};