#include <FCMHost.h>
List of all members.
|
Public Member Functions |
| FCMHost () |
| Constructor.
|
virtual | ~FCMHost () |
| Destructor.
|
void | AddParticipant (RakNetGUID guid, FCMHostGroupID groupId=0) |
void | RemoveParticipantFromAllGroups (RakNetGUID guid) |
bool | RemoveParticipant (RakNetGUID guid, FCMHostGroupID groupId=0) |
void | SetAutoAddNewConnections (bool autoAdd, FCMHostGroupID groupId=0) |
FCMHostState | GetHostState (FCMHostGroupID groupId=0) |
bool | HasHost (FCMHostGroupID groupId=0) |
RakNetGUID | GetHost (FCMHostGroupID groupId=0) |
void | SetHostPriority (int priority, FCMHostGroupID groupId=0) |
void | GetParticipants (DataStructures::List< RakNetGUID > &participants, FCMHostGroupID groupId=0) |
| Get all participants in a group.
|
void | Clear (void) |
| Reset the system, clearing all data.
|
virtual PluginReceiveResult | OnReceive (Packet *packet) |
virtual void | OnShutdown (void) |
| Called when RakPeer is shutdown.
|
virtual void | OnClosedConnection (SystemAddress systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason) |
virtual void | OnNewConnection (SystemAddress systemAddress, RakNetGUID rakNetGUID, bool isIncoming) |
Detailed Description
- Precondition:
- A fully connected mesh is required among the participants - e.g. all participants must eventually connect to all other participants. Otherwise the algorithm will not return the same host among all systems.
- Note:
- ID_FCM_HOST_CHANGED is returned to RakPeerInterface::Receive() every time the host changes.
Member Function Documentation
void FCMHost::AddParticipant |
( |
RakNetGUID |
guid, |
|
|
FCMHostGroupID |
groupId = 0 | |
|
) |
| | |
Add a connected system to the list of systems to manage host tracking
- Parameters:
-
[in] | guid | The system to add |
[in] | groupId | Which group to assign this system to. Groups are used if you want to manage more than one list at a time. Use 0 if you don't care. |
RakNetGUID FCMHost::GetHost |
( |
FCMHostGroupID |
groupId = 0 |
) |
|
Get the current host. Only meaningful when GetHostState is FCMHS_WE_ARE_HOST or FCMHS_REMOTE_SYSTEM_IS_HOST
- Parameters:
-
[in] | groupId | Which group we are referring to. |
- Returns:
- The Guid of the host
FCMHostState FCMHost::GetHostState |
( |
FCMHostGroupID |
groupId = 0 |
) |
|
Get the current state of the system for determing the host
- Parameters:
-
[in] | groupId | Which group we are referring to. |
bool FCMHost::HasHost |
( |
FCMHostGroupID |
groupId = 0 |
) |
|
Returns if we are connected to other systems, and one of those systems (possibly ourselves) is a host If we are not connected to other systems, then our own system is always the host, and in a sense the host is undetermined This function could also be named HasValidHost, or IsHostDetermined
- Parameters:
-
[in] | groupId | Which group we are referring to. |
- Returns:
- true If there is a networked host
void FCMHost::OnClosedConnection |
( |
SystemAddress |
systemAddress, |
|
|
RakNetGUID |
rakNetGUID, |
|
|
PI2_LostConnectionReason |
lostConnectionReason | |
|
) |
| | [virtual] |
Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system
- Parameters:
-
[in] | systemAddress | The system whose connection was closed |
[in] | rakNetGuid | The guid of the specified system |
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection |
Reimplemented from PluginInterface2.
Called when we got a new connection
- Parameters:
-
[in] | systemAddress | Address of the new connection |
[in] | rakNetGuid | The guid of the specified system |
[in] | isIncoming | If true, this is ID_NEW_INCOMING_CONNECTION, or the equivalent |
Reimplemented from PluginInterface2.
PluginReceiveResult FCMHost::OnReceive |
( |
Packet * |
packet |
) |
[virtual] |
OnReceive is called for every packet.
- Parameters:
-
[in] | packet | the packet that is being returned to the user |
- Returns:
- True to allow the game and other plugins to get this message, false to absorb it
Reimplemented from PluginInterface2.
bool FCMHost::RemoveParticipant |
( |
RakNetGUID |
guid, |
|
|
FCMHostGroupID |
groupId = 0 | |
|
) |
| | |
Remove a participant added with AddParticipant(), or automatically added with SetAutoAddNewConnections()
- Parameters:
-
[in] | guid | The system to remove |
[in] | groupId | Which group to remove this system from. Groups are used if you want to manage more than one list at a time. Use 0 if you don't care. |
- Returns:
- True if done, false if not
void FCMHost::RemoveParticipantFromAllGroups |
( |
RakNetGUID |
guid |
) |
|
void FCMHost::SetAutoAddNewConnections |
( |
bool |
autoAdd, |
|
|
FCMHostGroupID |
groupId = 0 | |
|
) |
| | |
If set to true, all subsequent new connections will be added to groupId. Defaults to false
- Parameters:
-
[in] | autoAdd | If true, removes the need to call AddParticipant() on ID_NEW_INCOMING_CONNECTION or ID_CONNECTION_REQUEST_ACCEPTED Which group to automatically add systems to. Unused parameter if autoAdd is false |
void FCMHost::SetHostPriority |
( |
int |
priority, |
|
|
FCMHostGroupID |
groupId = 0 | |
|
) |
| | |
While calculating the host, priority gives a boost to which system will be host If two systems have the same priority, the system with the lower GUID will be host. priority defaults to 0 This won't change the host after the fact, only before adding that system with AddParticipant
- Parameters:
-
[in] | priority | The priority level to set. Just a number for comparison, set to whatever you want. |
[in] | groupId | Which group we are referring to. |
The documentation for this class was generated from the following files:
- C:/RakNet/Source/FCMHost.h
- C:/RakNet/Source/FCMHost.cpp