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

Describes the Room to be created by a CreateRoomRequest. More...

#include <RoomSettings.h>

Public Member Functions

 RoomSettings (std::string name)

Public Attributes

std::string name
 The name of the Room; must not be empty.
std::string password
 The password required to join the Room; empty means no password.
std::string groupId = entities::DEFAULT_ROOM_GROUP_ID
 The id of the Group to which the Room belongs.
bool isGame = false
 Whether the Room is a Game Room (and can host players and spectators).
int32_t maxUsers = 10
 The maximum number of users (players in a Game Room) allowed inside the Room.
int32_t maxSpectators = 0
 The maximum number of spectators allowed inside the Room; Game Rooms only.
int32_t maxVariables = 5
 The maximum number of Room Variables the Room can hold.
bool allowOwnerOnlyInvitation = true
 Whether only the Room's owner can invite other users to join it.
std::vector< entities::SFSRoomVariablevariables
 The Room Variables to set on the Room as it is created.
std::optional< RoomPermissionspermissions
 The Room's permissions; when unset the server applies its own default.
std::optional< RoomEventsevents
 The events the Room fires; when unset the server applies its own default.
std::optional< RoomExtensionextension
 The server side Extension to attach to the Room; when unset the Room has none.
std::optional< GameSettingsgameSettings
 The Game Room settings.
std::optional< MMOSettingsmmoSettings
 The MMORoom settings; when unset a regular Room is created.

Detailed Description

Describes the Room to be created by a CreateRoomRequest.

Only the name is mandatory; every other member carries the same default the Java and Swift APIs use. The defaults are always sent to the server, which has defaults of its own that don't always match (for example maxVariables defaults to 0 server side).

requests::RoomSettings settings { "lobby" };
settings.maxUsers = 40;
settings.variables.push_back(entities::SFSRoomVariable { "motd", std::string("welcome") });

requests::RoomPermissions perms;
perms.allowResizing = true;
settings.permissions = perms;

sfs.send(requests::CreateRoomRequest(settings));
See also
CreateRoomRequest

Constructor & Destructor Documentation

◆ RoomSettings()

sfs3::requests::RoomSettings::RoomSettings ( std::string name)
inline
Parameters
namethe name of the Room to create

Member Data Documentation

◆ gameSettings

std::optional<GameSettings> sfs3::requests::RoomSettings::gameSettings

The Game Room settings.

Required by CreateSFSGameRequest, which rejects settings without them; ignored by a plain CreateRoomRequest.

◆ mmoSettings

std::optional<MMOSettings> sfs3::requests::RoomSettings::mmoSettings

The MMORoom settings; when unset a regular Room is created.

The Room comes back from the server as an entities::MMORoom, carrying the area of interest and the map limits. Once joined, send a SetUserPositionRequest to take part in the proximity system and start receiving PROXIMITY_LIST_UPDATE events.


The documentation for this struct was generated from the following file:
  • requests/RoomSettings.h