SmartFoxServer 2X C++ API
Sfs2X::Entities::SFSRoom Class Reference

The Room object represent a server Room. More...

#include <SFSRoom.h>

Inheritance diagram for Sfs2X::Entities::SFSRoom:
Sfs2X::Entities::MMORoom

Public Member Functions

boost::shared_ptr< string > Name ()
 The Room name More...
 
void Name (string value)
 The Room name More...
 
boost::shared_ptr< string > GroupId ()
 The Room Group. Each Room is assigned to its Group. More...
 
bool IsGame ()
 Determines if a Room is a Game Room More...
 
void IsGame (bool value)
 Determines if a Room is a Game Room More...
 
bool IsHidden ()
 Determines if the Room is hidden More...
 
void IsHidden (bool value)
 Determines if the Room is hidden More...
 
bool IsJoined ()
 Returns true if the Room is joined by the current User More...
 
void IsJoined (bool value)
 Returns true if the Room is joined by the current User More...
 
bool IsPasswordProtected ()
 Returns true if the Room requires a password for joining it More...
 
void IsPasswordProtected (bool value)
 Returns true if the Room requires a password for joining it More...
 
boost::shared_ptr< vector< boost::shared_ptr< RoomVariable > > > GetVariables ()
 Returns all the Room Variables More...
 
boost::shared_ptr< RoomVariable > GetVariable (string name)
 Get a Room Variable More...
 
long int UserCount ()
 Get the current number of users More...
 
void UserCount (long int value)
 Get the current number of users More...
 
long int MaxUsers ()
 Get the maximum number of users allowed for this Room More...
 
void MaxUsers (long int value)
 Get the maximum number of users allowed for this Room More...
 
long int Capacity ()
 Returns the max amount of users (both Users and Spectators) that can be contained in this room More...
 
long int SpectatorCount ()
 Get the number of spectators (only for Game Rooms) More...
 
void SpectatorCount (long int value)
 Get the number of spectators (only for Game Rooms) More...
 
boost::shared_ptr< UserGetUserByName (string name)
 Get a User from its name More...
 
boost::shared_ptr< UserGetUserById (long int id)
 Get a User from its ID More...
 
boost::shared_ptr< vector< boost::shared_ptr< User > > > UserList ()
 Get the full list of users in the Room More...
 
bool ContainsVariable (string name)
 Check for the presence of a Room Variable More...
 
bool ContainsUser (boost::shared_ptr< User > user)
 Checks if a User is joined in this Room More...
 

Detailed Description

The Room object represent a server Room.

The client API don't know about all Rooms on the server side but only about those that are joined and those in the Room Groups that were subscribed.

Subscribing to one or more Group allows the client to listen for Room events in specific "areas" of the Zone without having to know and download details for all Rooms available.

The RoomList is created after a succesful login in the SmartFox.RoomList object and it is kept updated at all times by the Server.

See also
SmartFox.RoomList, Requests.CreateRoomRequest, Requests.JoinRoomRequest, Requests.SubscribeRoomGroupRequest, Requests.UnsubscribeRoomGroupRequest, Requests.ChangeRoomNameRequest, Requests.ChangeRoomPasswordStateRequest, Requests.ChangeRoomCapacityRequest

Member Function Documentation

◆ Capacity()

long int Sfs2X::Entities::SFSRoom::Capacity ( )

Returns the max amount of users (both Users and Spectators) that can be contained in this room

◆ ContainsUser()

bool Sfs2X::Entities::SFSRoom::ContainsUser ( boost::shared_ptr< User user)

Checks if a User is joined in this Room

Parameters
userPointer to an User instance
Returns
true if the User exists in the Room

◆ ContainsVariable()

bool Sfs2X::Entities::SFSRoom::ContainsVariable ( string  name)

Check for the presence of a Room Variable

Parameters
nameA string pointer
Returns
true if the the Room Variable exists

◆ GetUserById()

boost::shared_ptr< User > Sfs2X::Entities::SFSRoom::GetUserById ( long int  id)

Get a User from its ID

Parameters
idA long integer
Returns
the User, or null if no User with that ID exists in the Room

◆ GetUserByName()

boost::shared_ptr< User > Sfs2X::Entities::SFSRoom::GetUserByName ( string  name)

Get a User from its name

Parameters
nameA string pointer
Returns
the User, or null if no User with that name exists in the Room

◆ GetVariable()

boost::shared_ptr< RoomVariable > Sfs2X::Entities::SFSRoom::GetVariable ( string  name)

Get a Room Variable

Parameters
namethe name of the variable
Returns
the Room Variable, or null if no variable exists with that name

◆ GetVariables()

boost::shared_ptr< vector< boost::shared_ptr< RoomVariable > > > Sfs2X::Entities::SFSRoom::GetVariables ( )

Returns all the Room Variables

Returns
A vector of RoomVariable pointers

◆ GroupId()

boost::shared_ptr< string > Sfs2X::Entities::SFSRoom::GroupId ( )

The Room Group. Each Room is assigned to its Group.

By default SmartFoxServer uses one single group called default

◆ IsGame() [1/2]

bool Sfs2X::Entities::SFSRoom::IsGame ( )

Determines if a Room is a Game Room

◆ IsGame() [2/2]

void Sfs2X::Entities::SFSRoom::IsGame ( bool  value)

Determines if a Room is a Game Room

◆ IsHidden() [1/2]

bool Sfs2X::Entities::SFSRoom::IsHidden ( )

Determines if the Room is hidden

◆ IsHidden() [2/2]

void Sfs2X::Entities::SFSRoom::IsHidden ( bool  value)

Determines if the Room is hidden

◆ IsJoined() [1/2]

bool Sfs2X::Entities::SFSRoom::IsJoined ( )

Returns true if the Room is joined by the current User

◆ IsJoined() [2/2]

void Sfs2X::Entities::SFSRoom::IsJoined ( bool  value)

Returns true if the Room is joined by the current User

◆ IsPasswordProtected() [1/2]

bool Sfs2X::Entities::SFSRoom::IsPasswordProtected ( )

Returns true if the Room requires a password for joining it

◆ IsPasswordProtected() [2/2]

void Sfs2X::Entities::SFSRoom::IsPasswordProtected ( bool  value)

Returns true if the Room requires a password for joining it

◆ MaxUsers() [1/2]

long int Sfs2X::Entities::SFSRoom::MaxUsers ( )

Get the maximum number of users allowed for this Room

◆ MaxUsers() [2/2]

void Sfs2X::Entities::SFSRoom::MaxUsers ( long int  value)

Get the maximum number of users allowed for this Room

◆ Name() [1/2]

boost::shared_ptr< string > Sfs2X::Entities::SFSRoom::Name ( )

The Room name

◆ Name() [2/2]

void Sfs2X::Entities::SFSRoom::Name ( string  value)

The Room name

◆ SpectatorCount() [1/2]

long int Sfs2X::Entities::SFSRoom::SpectatorCount ( )

Get the number of spectators (only for Game Rooms)

◆ SpectatorCount() [2/2]

void Sfs2X::Entities::SFSRoom::SpectatorCount ( long int  value)

Get the number of spectators (only for Game Rooms)

◆ UserCount() [1/2]

long int Sfs2X::Entities::SFSRoom::UserCount ( )

Get the current number of users

If the room is joined the user count is taken from the Room's UserManager otherwise we return the static counter (which will work only if you have activated the uCount updates)

◆ UserCount() [2/2]

void Sfs2X::Entities::SFSRoom::UserCount ( long int  value)

Get the current number of users

If the room is joined the user count is taken from the Room's UserManager otherwise we return the static counter (which will work only if you have activated the uCount updates)

◆ UserList()

boost::shared_ptr< vector< boost::shared_ptr< User > > > Sfs2X::Entities::SFSRoom::UserList ( )

Get the full list of users in the Room