2004-11-16 23:12:58 +00:00
|
|
|
#include "global.h"
|
|
|
|
|
|
|
|
|
|
#if !defined(WITHOUT_NETWORKING)
|
|
|
|
|
#include "ScreenNetRoom.h"
|
|
|
|
|
#include "ScreenManager.h"
|
|
|
|
|
#include "NetworkSyncManager.h"
|
|
|
|
|
#include "GameState.h"
|
|
|
|
|
#include "ThemeManager.h"
|
2004-12-03 01:10:09 +00:00
|
|
|
#include "ScreenTextEntry.h"
|
2005-05-03 01:31:22 +00:00
|
|
|
#include "WheelItemBase.h"
|
2005-09-05 02:26:50 +00:00
|
|
|
#include "InputEventPlus.h"
|
2005-12-22 03:10:04 +00:00
|
|
|
#include "LocalizedString.h"
|
2004-11-16 23:12:58 +00:00
|
|
|
|
2004-11-21 07:05:18 +00:00
|
|
|
#define TITLEBG_WIDTH THEME->GetMetricF(m_sName,"TitleBGWidth")
|
2005-01-27 03:08:04 +00:00
|
|
|
#define TITLEBG_HEIGHT THEME->GetMetricF(m_sName,"TitleBGHeight")
|
2004-11-21 07:05:18 +00:00
|
|
|
#define ROOMSBG_WIDTH THEME->GetMetricF(m_sName,"RoomsBGWidth")
|
2004-12-03 01:10:09 +00:00
|
|
|
#define ROOMSBG_HEIGHT THEME->GetMetricF(m_sName,"RoomsBGHeight")
|
|
|
|
|
#define SELECTION_WIDTH THEME->GetMetricF(m_sName,"SelectionWidth")
|
|
|
|
|
#define SELECTION_HEIGHT THEME->GetMetricF(m_sName,"SelectionHeight")
|
2005-01-28 23:59:34 +00:00
|
|
|
#define ROOMSPACEX THEME->GetMetricF(m_sName,"RoomsSpacingX")
|
|
|
|
|
#define ROOMSPACEY THEME->GetMetricF(m_sName,"RoomsSpacingY")
|
|
|
|
|
#define ROOMLOWERBOUND THEME->GetMetricF(m_sName,"RoomsLowerBound")
|
|
|
|
|
#define ROOMUPPERBOUND THEME->GetMetricF(m_sName,"RoomsUpperBound")
|
2004-11-21 07:05:18 +00:00
|
|
|
|
2005-03-28 08:01:36 +00:00
|
|
|
AutoScreenMessage( SM_SMOnlinePack )
|
|
|
|
|
AutoScreenMessage( SM_BackFromRoomName )
|
|
|
|
|
AutoScreenMessage( SM_BackFromRoomDesc )
|
2006-07-21 22:31:55 +00:00
|
|
|
AutoScreenMessage( SM_BackFromRoomPass )
|
|
|
|
|
AutoScreenMessage( SM_BackFromReqPass )
|
2006-08-14 15:48:47 +00:00
|
|
|
AutoScreenMessage( SM_RoomInfoRetract )
|
|
|
|
|
AutoScreenMessage( SM_RoomInfoDeploy )
|
|
|
|
|
|
|
|
|
|
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):");
|
|
|
|
|
static LocalizedString ENTER_ROOM_REQPASSWORD ("ScreenNetRoom","Enter Room's Password:");
|
2004-11-16 23:12:58 +00:00
|
|
|
|
2006-01-15 20:46:15 +00:00
|
|
|
REGISTER_SCREEN_CLASS( ScreenNetRoom );
|
2005-02-23 06:29:05 +00:00
|
|
|
|
|
|
|
|
void ScreenNetRoom::Init()
|
|
|
|
|
{
|
2006-01-15 19:04:34 +00:00
|
|
|
GAMESTATE->FinishStage();
|
|
|
|
|
|
2005-02-23 06:29:05 +00:00
|
|
|
ScreenNetSelectBase::Init();
|
|
|
|
|
|
2007-02-17 13:45:11 +00:00
|
|
|
m_soundChangeSel.Load( THEME->GetPathS("ScreenNetRoom","change sel") );
|
2004-11-16 23:12:58 +00:00
|
|
|
|
2004-11-21 07:05:18 +00:00
|
|
|
m_iRoomPlace = 0;
|
|
|
|
|
|
2005-01-27 03:08:04 +00:00
|
|
|
m_sprTitleBG.Load( THEME->GetPathG( m_sName, "TitleBG" ) );
|
|
|
|
|
m_sprTitleBG.SetName( "TitleBG" );
|
|
|
|
|
m_sprTitleBG.SetWidth( TITLEBG_WIDTH );
|
|
|
|
|
m_sprTitleBG.SetHeight( TITLEBG_HEIGHT );
|
2007-02-19 09:30:07 +00:00
|
|
|
LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_sprTitleBG );
|
2005-01-27 03:08:04 +00:00
|
|
|
this->AddChild( &m_sprTitleBG);
|
2004-11-21 07:05:18 +00:00
|
|
|
|
|
|
|
|
m_textTitle.LoadFromFont( THEME->GetPathF(m_sName,"wheel") );
|
|
|
|
|
m_textTitle.SetShadowLength( 0 );
|
|
|
|
|
m_textTitle.SetName( "Title" );
|
|
|
|
|
m_textTitle.SetMaxWidth( TITLEBG_WIDTH );
|
2007-02-19 09:30:07 +00:00
|
|
|
LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_textTitle );
|
2004-11-21 07:05:18 +00:00
|
|
|
this->AddChild( &m_textTitle);
|
|
|
|
|
|
2005-05-31 07:34:18 +00:00
|
|
|
m_RoomWheel.SetName( "RoomWheel" );
|
2006-08-14 15:48:47 +00:00
|
|
|
m_RoomWheel.Load( "RoomWheel" );
|
2006-08-13 18:13:27 +00:00
|
|
|
m_RoomWheel.BeginScreen();
|
2007-02-19 09:30:07 +00:00
|
|
|
LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_RoomWheel );
|
2005-05-03 01:31:22 +00:00
|
|
|
this->AddChild( &m_RoomWheel );
|
2004-12-03 01:10:09 +00:00
|
|
|
|
2008-01-27 05:43:30 +00:00
|
|
|
//Since the room info meter does not start active, and it
|
|
|
|
|
//is activated by code elsewhere, it should not be put on
|
2008-03-23 22:06:30 +00:00
|
|
|
//screen to begin with
|
|
|
|
|
m_roomInfo.SetName( "RoomInfoDisplay" );
|
2006-08-14 15:48:47 +00:00
|
|
|
m_roomInfo.Load( "RoomInfoDisplay" );
|
|
|
|
|
m_roomInfo.SetDrawOrder( 1 );
|
2006-08-14 05:46:15 +00:00
|
|
|
this->AddChild( &m_roomInfo );
|
|
|
|
|
|
|
|
|
|
this->SortByDrawOrder();
|
2007-02-17 13:45:11 +00:00
|
|
|
NSMAN->ReportNSSOnOff( 7 );
|
2004-11-16 23:12:58 +00:00
|
|
|
}
|
|
|
|
|
|
2005-09-05 02:26:50 +00:00
|
|
|
void ScreenNetRoom::Input( const InputEventPlus &input )
|
2004-11-16 23:12:58 +00:00
|
|
|
{
|
2008-05-21 05:36:09 +00:00
|
|
|
if( (input.MenuI == GAME_BUTTON_LEFT || input.MenuI == GAME_BUTTON_RIGHT) && input.type == IET_RELEASE )
|
2007-02-17 13:45:11 +00:00
|
|
|
m_RoomWheel.Move( 0 );
|
2005-05-03 01:31:22 +00:00
|
|
|
|
2005-09-05 02:26:50 +00:00
|
|
|
ScreenNetSelectBase::Input( input );
|
2004-11-16 23:12:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenNetRoom::HandleScreenMessage( const ScreenMessage SM )
|
|
|
|
|
{
|
2005-03-23 08:48:38 +00:00
|
|
|
if( SM == SM_GoToPrevScreen )
|
2004-11-21 07:05:18 +00:00
|
|
|
{
|
|
|
|
|
SCREENMAN->SetNewScreen( THEME->GetMetric (m_sName, "PrevScreen") );
|
2005-03-23 08:48:38 +00:00
|
|
|
}
|
|
|
|
|
else if( SM == SM_GoToNextScreen )
|
|
|
|
|
{
|
2004-11-21 07:05:18 +00:00
|
|
|
SCREENMAN->SetNewScreen( THEME->GetMetric (m_sName, "NextScreen") );
|
2005-03-23 08:48:38 +00:00
|
|
|
}
|
2006-07-21 22:31:55 +00:00
|
|
|
else if( SM == SM_BackFromReqPass )
|
|
|
|
|
{
|
|
|
|
|
if ( !ScreenTextEntry::s_bCancelledLast )
|
|
|
|
|
{
|
|
|
|
|
NSMAN->m_SMOnlinePacket.ClearPacket();
|
|
|
|
|
NSMAN->m_SMOnlinePacket.Write1( 1 );
|
|
|
|
|
NSMAN->m_SMOnlinePacket.Write1( 1 ); //Type (enter a room)
|
|
|
|
|
NSMAN->m_SMOnlinePacket.WriteNT( m_sLastPickedRoom );
|
|
|
|
|
NSMAN->m_SMOnlinePacket.WriteNT( ScreenTextEntry::s_sLastAnswer );
|
|
|
|
|
NSMAN->SendSMOnline( );
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-03-23 08:48:38 +00:00
|
|
|
else if( SM == SM_SMOnlinePack )
|
|
|
|
|
{
|
2007-02-17 13:45:11 +00:00
|
|
|
switch( NSMAN->m_SMOnlinePacket.Read1() )
|
2005-03-23 08:48:38 +00:00
|
|
|
{
|
2006-01-21 17:45:52 +00:00
|
|
|
case 1:
|
2004-11-21 07:05:18 +00:00
|
|
|
switch ( NSMAN->m_SMOnlinePacket.Read1() )
|
|
|
|
|
{
|
|
|
|
|
case 0: //Room title Change
|
2007-02-17 13:45:11 +00:00
|
|
|
{
|
|
|
|
|
RString titleSub;
|
|
|
|
|
titleSub = NSMAN->m_SMOnlinePacket.ReadNT() + "\n";
|
|
|
|
|
titleSub += NSMAN->m_SMOnlinePacket.ReadNT();
|
|
|
|
|
m_textTitle.SetText( titleSub );
|
|
|
|
|
if ( NSMAN->m_SMOnlinePacket.Read1() != 0 )
|
2004-11-23 20:54:22 +00:00
|
|
|
{
|
2007-02-17 13:45:11 +00:00
|
|
|
RString SMOnlineSelectScreen = THEME->GetMetric( m_sName, "MusicSelectScreen" );
|
|
|
|
|
SCREENMAN->SetNewScreen( SMOnlineSelectScreen );
|
2004-11-23 20:54:22 +00:00
|
|
|
}
|
2007-02-17 13:45:11 +00:00
|
|
|
}
|
2004-11-21 07:05:18 +00:00
|
|
|
case 1: //Rooms list change
|
2007-02-17 13:45:11 +00:00
|
|
|
{
|
|
|
|
|
int numRooms = NSMAN->m_SMOnlinePacket.Read1();
|
|
|
|
|
m_Rooms.clear();
|
|
|
|
|
for( int i=0; i<numRooms; ++i )
|
2004-11-21 07:05:18 +00:00
|
|
|
{
|
2007-02-17 13:45:11 +00:00
|
|
|
RoomData tmpRoomData;
|
|
|
|
|
tmpRoomData.SetName( NSMAN->m_SMOnlinePacket.ReadNT() );
|
|
|
|
|
tmpRoomData.SetDescription( NSMAN->m_SMOnlinePacket.ReadNT() );
|
|
|
|
|
m_Rooms.push_back( tmpRoomData );
|
2004-11-21 07:05:18 +00:00
|
|
|
}
|
2007-02-17 13:45:11 +00:00
|
|
|
//Abide by protocol and read room status
|
|
|
|
|
for( int i=0; i<numRooms; ++i )
|
|
|
|
|
m_Rooms[i].SetState( NSMAN->m_SMOnlinePacket.Read1() );
|
|
|
|
|
|
|
|
|
|
for( int i=0; i<numRooms; ++i )
|
|
|
|
|
m_Rooms[i].SetFlags( NSMAN->m_SMOnlinePacket.Read1() );
|
|
|
|
|
|
|
|
|
|
if( m_iRoomPlace<0 )
|
|
|
|
|
m_iRoomPlace=0;
|
|
|
|
|
if( m_iRoomPlace >= (int) m_Rooms.size() )
|
|
|
|
|
m_iRoomPlace=m_Rooms.size()-1;
|
|
|
|
|
UpdateRoomsList();
|
|
|
|
|
}
|
2004-11-21 07:05:18 +00:00
|
|
|
}
|
2006-01-21 17:45:52 +00:00
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
RoomInfo info;
|
|
|
|
|
info.songTitle = NSMAN->m_SMOnlinePacket.ReadNT();
|
|
|
|
|
info.songSubTitle = NSMAN->m_SMOnlinePacket.ReadNT();
|
|
|
|
|
info.songArtist = NSMAN->m_SMOnlinePacket.ReadNT();
|
|
|
|
|
info.numPlayers = NSMAN->m_SMOnlinePacket.Read1();
|
|
|
|
|
info.maxPlayers = NSMAN->m_SMOnlinePacket.Read1();
|
2007-02-17 13:45:11 +00:00
|
|
|
info.players.resize( info.numPlayers );
|
|
|
|
|
for( int i = 0; i < info.numPlayers; ++i )
|
2006-01-21 17:45:52 +00:00
|
|
|
info.players[i] = NSMAN->m_SMOnlinePacket.ReadNT();
|
|
|
|
|
|
2007-02-17 13:45:11 +00:00
|
|
|
m_roomInfo.SetRoomInfo( info );
|
2006-01-21 17:45:52 +00:00
|
|
|
break;
|
2005-03-23 08:48:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ( SM == SM_BackFromRoomName )
|
|
|
|
|
{
|
2005-03-22 20:15:24 +00:00
|
|
|
if ( !ScreenTextEntry::s_bCancelledLast )
|
|
|
|
|
{
|
2004-12-03 01:10:09 +00:00
|
|
|
m_newRoomName = ScreenTextEntry::s_sLastAnswer;
|
2005-12-21 12:55:20 +00:00
|
|
|
ScreenTextEntry::TextEntry( SM_BackFromRoomDesc, ENTER_ROOM_DESCRIPTION, "", 255 );
|
2004-12-03 01:10:09 +00:00
|
|
|
}
|
2005-03-23 08:48:38 +00:00
|
|
|
}
|
|
|
|
|
else if( SM == SM_BackFromRoomDesc )
|
|
|
|
|
{
|
2005-03-22 20:15:24 +00:00
|
|
|
if ( !ScreenTextEntry::s_bCancelledLast )
|
|
|
|
|
{
|
2004-12-03 01:10:09 +00:00
|
|
|
m_newRoomDesc = ScreenTextEntry::s_sLastAnswer;
|
2006-07-21 18:53:23 +00:00
|
|
|
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);
|
2004-12-03 01:10:09 +00:00
|
|
|
}
|
2004-11-21 07:05:18 +00:00
|
|
|
}
|
2006-08-14 05:46:15 +00:00
|
|
|
else if ( SM == SM_RoomInfoRetract )
|
|
|
|
|
{
|
|
|
|
|
m_roomInfo.RetractInfoBox();
|
|
|
|
|
}
|
|
|
|
|
else if ( SM == SM_RoomInfoDeploy )
|
|
|
|
|
{
|
|
|
|
|
int i = m_RoomWheel.GetCurrentIndex() - m_RoomWheel.GetPerminateOffset();
|
2008-02-15 10:06:53 +00:00
|
|
|
const RoomWheelItemData* data = m_RoomWheel.GetItem(i);
|
2007-02-17 13:45:11 +00:00
|
|
|
if( data != NULL )
|
|
|
|
|
m_roomInfo.SetRoom( data );
|
2006-08-14 05:46:15 +00:00
|
|
|
}
|
|
|
|
|
|
2004-11-16 23:12:58 +00:00
|
|
|
ScreenNetSelectBase::HandleScreenMessage( SM );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenNetRoom::TweenOffScreen()
|
|
|
|
|
{
|
2004-11-21 07:05:18 +00:00
|
|
|
OFF_COMMAND( m_textTitle );
|
2005-01-27 03:08:04 +00:00
|
|
|
OFF_COMMAND( m_sprTitleBG );
|
2004-11-21 07:05:18 +00:00
|
|
|
|
2007-02-17 13:45:11 +00:00
|
|
|
NSMAN->ReportNSSOnOff( 6 );
|
2004-11-16 23:12:58 +00:00
|
|
|
}
|
|
|
|
|
|
2006-09-14 21:25:06 +00:00
|
|
|
void ScreenNetRoom::MenuStart( const InputEventPlus &input )
|
2004-11-16 23:12:58 +00:00
|
|
|
{
|
2005-05-08 18:53:03 +00:00
|
|
|
m_RoomWheel.Select();
|
2008-02-15 10:06:53 +00:00
|
|
|
RoomWheelItemData* rwd = dynamic_cast<RoomWheelItemData*>( m_RoomWheel.LastSelected() );
|
2007-02-17 13:45:11 +00:00
|
|
|
if( rwd )
|
2006-07-21 22:31:55 +00:00
|
|
|
{
|
2006-07-22 00:28:26 +00:00
|
|
|
if ( rwd->m_iFlags % 2 )
|
2006-07-21 22:31:55 +00:00
|
|
|
{
|
2006-07-22 00:28:26 +00:00
|
|
|
m_sLastPickedRoom = rwd->m_sText;
|
2006-07-21 22:31:55 +00:00
|
|
|
ScreenTextEntry::TextEntry( SM_BackFromReqPass, ENTER_ROOM_REQPASSWORD, "", 255 );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NSMAN->m_SMOnlinePacket.ClearPacket();
|
|
|
|
|
NSMAN->m_SMOnlinePacket.Write1( 1 );
|
|
|
|
|
NSMAN->m_SMOnlinePacket.Write1( 1 ); //Type (enter a room)
|
2006-07-22 00:28:26 +00:00
|
|
|
NSMAN->m_SMOnlinePacket.WriteNT( rwd->m_sText );
|
2006-07-21 22:31:55 +00:00
|
|
|
NSMAN->SendSMOnline( );
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-09-14 21:25:06 +00:00
|
|
|
ScreenNetSelectBase::MenuStart( input );
|
2004-11-16 23:12:58 +00:00
|
|
|
}
|
|
|
|
|
|
2006-09-14 21:25:06 +00:00
|
|
|
void ScreenNetRoom::MenuBack( const InputEventPlus &input )
|
2004-11-16 23:12:58 +00:00
|
|
|
{
|
2004-11-21 07:05:18 +00:00
|
|
|
TweenOffScreen();
|
|
|
|
|
|
2005-03-20 06:14:41 +00:00
|
|
|
Cancel( SM_GoToPrevScreen );
|
2004-11-21 07:05:18 +00:00
|
|
|
|
2006-09-14 21:25:06 +00:00
|
|
|
ScreenNetSelectBase::MenuBack( input );
|
2004-11-16 23:12:58 +00:00
|
|
|
}
|
|
|
|
|
|
2005-09-23 00:44:52 +00:00
|
|
|
void ScreenNetRoom::MenuLeft( const InputEventPlus &input )
|
2004-12-03 01:10:09 +00:00
|
|
|
{
|
2005-09-23 00:44:52 +00:00
|
|
|
if( input.type == IET_FIRST_PRESS )
|
2007-02-17 13:45:11 +00:00
|
|
|
m_RoomWheel.Move( -1 );
|
2005-09-19 19:08:14 +00:00
|
|
|
|
2006-09-14 21:25:06 +00:00
|
|
|
ScreenNetSelectBase::MenuLeft( input );
|
2004-12-03 01:10:09 +00:00
|
|
|
}
|
|
|
|
|
|
2005-09-23 00:44:52 +00:00
|
|
|
void ScreenNetRoom::MenuRight( const InputEventPlus &input )
|
2004-12-03 01:10:09 +00:00
|
|
|
{
|
2005-09-23 00:44:52 +00:00
|
|
|
if( input.type == IET_FIRST_PRESS )
|
2007-02-17 13:45:11 +00:00
|
|
|
m_RoomWheel.Move( 1 );
|
2005-05-08 18:53:03 +00:00
|
|
|
|
2006-09-14 21:25:06 +00:00
|
|
|
ScreenNetSelectBase::MenuRight( input );
|
2004-11-16 23:12:58 +00:00
|
|
|
}
|
|
|
|
|
|
2004-11-21 07:05:18 +00:00
|
|
|
void ScreenNetRoom::UpdateRoomsList()
|
|
|
|
|
{
|
2005-05-03 01:31:22 +00:00
|
|
|
int difference = 0;
|
2008-02-15 10:06:53 +00:00
|
|
|
RoomWheelItemData* itemData = NULL;
|
2005-05-03 01:31:22 +00:00
|
|
|
|
|
|
|
|
difference = m_RoomWheel.GetNumItems() - m_Rooms.size();
|
|
|
|
|
|
2007-02-17 13:45:11 +00:00
|
|
|
if( !m_RoomWheel.IsEmpty() )
|
2005-05-03 01:31:22 +00:00
|
|
|
{
|
2007-02-17 13:45:11 +00:00
|
|
|
if( difference > 0 )
|
|
|
|
|
for( int x = 0; x < difference; ++x )
|
|
|
|
|
m_RoomWheel.RemoveItem( m_RoomWheel.GetNumItems() - 1 );
|
2005-05-03 01:31:22 +00:00
|
|
|
else
|
|
|
|
|
{
|
2007-02-17 13:45:11 +00:00
|
|
|
difference = abs( difference );
|
|
|
|
|
for( int x = 0; x < difference; ++x )
|
2008-02-15 10:06:53 +00:00
|
|
|
m_RoomWheel.AddItem( new RoomWheelItemData(TYPE_GENERIC, "", "", RageColor(1,1,1,1)) );
|
2005-05-03 01:31:22 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2007-02-17 13:45:11 +00:00
|
|
|
for ( unsigned int x = 0; x < m_Rooms.size(); ++x)
|
2008-02-15 10:06:53 +00:00
|
|
|
m_RoomWheel.AddItem( new RoomWheelItemData(TYPE_GENERIC, "", "", RageColor(1,1,1,1)) );
|
2005-05-03 01:31:22 +00:00
|
|
|
}
|
|
|
|
|
|
2007-02-17 13:45:11 +00:00
|
|
|
for( unsigned int i = 0; i < m_Rooms.size(); ++i )
|
2005-05-03 01:31:22 +00:00
|
|
|
{
|
2007-02-17 13:45:11 +00:00
|
|
|
itemData = m_RoomWheel.GetItem( i );
|
2005-05-03 01:31:22 +00:00
|
|
|
|
|
|
|
|
itemData->m_sText = m_Rooms[i].Name();
|
|
|
|
|
itemData->m_sDesc = m_Rooms[i].Description();
|
2006-07-22 00:28:26 +00:00
|
|
|
itemData->m_iFlags = m_Rooms[i].GetFlags();
|
2005-05-03 01:31:22 +00:00
|
|
|
|
2007-02-17 13:45:11 +00:00
|
|
|
switch( m_Rooms[i].State() )
|
2005-05-03 01:31:22 +00:00
|
|
|
{
|
2005-01-28 23:59:34 +00:00
|
|
|
case 0:
|
2005-05-03 01:31:22 +00:00
|
|
|
itemData->m_color = THEME->GetMetricC( m_sName, "OpenRoomColor");
|
2005-01-28 23:59:34 +00:00
|
|
|
break;
|
|
|
|
|
case 2:
|
2005-05-03 01:31:22 +00:00
|
|
|
itemData->m_color = THEME->GetMetricC( m_sName, "InGameRoomColor");
|
2005-01-28 23:59:34 +00:00
|
|
|
break;
|
2005-01-29 01:31:20 +00:00
|
|
|
default:
|
2005-05-03 01:31:22 +00:00
|
|
|
itemData->m_color = THEME->GetMetricC( m_sName, "OpenRoomColor");
|
2005-01-29 01:31:20 +00:00
|
|
|
break;
|
2005-01-28 23:59:34 +00:00
|
|
|
}
|
2006-07-21 22:31:55 +00:00
|
|
|
|
|
|
|
|
if ( m_Rooms[i].GetFlags() % 2 )
|
|
|
|
|
itemData->m_color = THEME->GetMetricC( m_sName, "PasswdRoomColor");
|
2004-11-21 07:05:18 +00:00
|
|
|
}
|
2005-05-03 01:31:22 +00:00
|
|
|
|
|
|
|
|
m_RoomWheel.RebuildWheelItems();
|
2004-11-21 07:05:18 +00:00
|
|
|
}
|
|
|
|
|
|
2007-02-17 13:45:11 +00:00
|
|
|
void ScreenNetRoom::CreateNewRoom( const RString& rName, const RString& rDesc, const RString& rPass )
|
|
|
|
|
{
|
2004-12-03 01:10:09 +00:00
|
|
|
NSMAN->m_SMOnlinePacket.ClearPacket();
|
2007-02-17 13:45:11 +00:00
|
|
|
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 );
|
2006-07-21 18:53:23 +00:00
|
|
|
if ( !rPass.empty() )
|
2007-02-17 13:45:11 +00:00
|
|
|
NSMAN->m_SMOnlinePacket.WriteNT( rPass );
|
2004-12-03 01:10:09 +00:00
|
|
|
NSMAN->SendSMOnline( );
|
|
|
|
|
}
|
|
|
|
|
|
2004-11-16 23:12:58 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/*
|
2005-05-03 01:31:22 +00:00
|
|
|
* (c) 2004 Charles Lohr, Josh Allen
|
2004-11-26 20:02:01 +00:00
|
|
|
* (c) 2001-2004 Chris Danford
|
2004-11-16 23:12:58 +00:00
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the
|
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
|
|
|
|
* whom the Software is furnished to do so, provided that the above
|
|
|
|
|
* copyright notice(s) and this permission notice appear in all copies of
|
|
|
|
|
* the Software and that both the above copyright notice(s) and this
|
|
|
|
|
* permission notice appear in supporting documentation.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
|
|
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
|
|
|
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
|
|
|
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
|
|
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
|
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|