SmartFoxServer 3 C++ Client API 3.1.0-beta
Client API for SmartFoxServer 3
Loading...
Searching...
No Matches
sfs3::requests::ChangeRoomCapacityRequest Class Reference

Changes the maximum number of users and/or spectators who can join a Room. More...

#include <ChangeRoomCapacityRequest.h>

Inheritance diagram for sfs3::requests::ChangeRoomCapacityRequest:
[legend]

Public Member Functions

 ChangeRoomCapacityRequest (std::shared_ptr< entities::Room > room, int32_t newMaxUsers, int32_t newMaxSpect)
 Creates a new ChangeRoomCapacityRequest.

Detailed Description

Changes the maximum number of users and/or spectators who can join a Room.

If the operation is successful, the roomCapacityChange event is dispatched to all the users who subscribed the Group to which the target Room belongs, including the requester user himself. If the user is not the creator (owner) of the Room the roomCapacityChangeError event is fired. An administrator or moderator can override this constraint (he is not requested to be the Room's owner).

In case the Room's capacity is reduced to a value less than the current number of users/spectators inside the Room, exceeding users are NOT disconnected.

If the Room was configured so that resizing is not allowed (see the RoomSettings.permissions parameter), the request is ignored and no error is fired.

Also note that some restrictions are applied to the passed values (i.e. a client can't set the max users to more than 200, or the max spectators to more than 32).

See also
event::SFSEvent::ROOM_CAPACITY_CHANGE
event::SFSEvent::ROOM_CAPACITY_CHANGE_ERROR
RoomSettings::permissions

Changes the maximum number of users, or spectators, that can join a Room.

On success a event::SFSEvent::ROOM_CAPACITY_CHANGE event reaches every user who subscribed the Group of the Room, the requester included. If the user is not the creator (owner) of the Room, a event::SFSEvent::ROOM_CAPACITY_CHANGE_ERROR event is fired instead. An administrator or a moderator does not have this limit.

If the new capacity is lower than the number of users or spectators already inside the Room, the users in excess are not disconnected.

If the Room was set up so that it cannot be resized (see the permissions setting in RoomSettings), the request is dropped and no error is fired. The server also puts limits on the values a client can ask for: at most 200 users and at most 32 spectators.

See also
event::SFSEvent::ROOM_CAPACITY_CHANGE
event::SFSEvent::ROOM_CAPACITY_CHANGE_ERROR
RoomSettings::permissions

Constructor & Destructor Documentation

◆ ChangeRoomCapacityRequest()

sfs3::requests::ChangeRoomCapacityRequest::ChangeRoomCapacityRequest ( std::shared_ptr< entities::Room > room,
int32_t newMaxUsers,
int32_t newMaxSpect )
inline

Creates a new ChangeRoomCapacityRequest.

Pass it to SmartFox::send for the request to be performed.

Parameters
roomThe Room whose capacity must change.
newMaxUsersThe new maximum number of users, or players, that can join the Room.
newMaxSpectThe new maximum number of spectators that can join the Room. Game Rooms only.
See also
SmartFox::send
entities::Room::getMaxUsers

The documentation for this class was generated from the following files:
  • requests/ChangeRoomCapacityRequest.h
  • requests/ChangeRoomCapacityRequest.cpp