A member of one or more teams.
More...
#include <TeamManager.h>
A member of one or more teams.
Contains data and operations on data to manage which team your game's team members are on. Best used as a composite member of your "User" or "Player" class(es). When using with ReplicaManager3, call TM_TeamMember::ReferenceTeamMember() in Replica3::DeserializeConstruction() and TM_TeamMember::DeserializeConstruction() in Replica3::PostDeserializeConstruction() There is otherwise no need to manually serialize the class, as operations are networked internally.
bool RakNet::TM_TeamMember::CancelTeamRequest |
( |
TM_Team * |
specificTeamToCancel | ) |
|
Cancels a request to join a specific team.
Useful if you got ID_TEAM_BALANCER_REQUESTED_TEAM_FULL or ID_TEAM_BALANCER_REQUESTED_TEAM_LOCKED and changed your mind about joining the team.
- Note
- This is not guaranteed to work due to latency. To clarify, If the host switches your team at the same time you call CancelRequestTeam() you may still get ID_TEAM_BALANCER_TEAM_ASSIGNED for the team you tried to cancel.
- Parameters
-
[in] | specificTeamToCancel | Which team to no longer join. Use 0 for all. |
- Returns
- false On invalid or unnecessary operation. Otherwise returns true
bool RakNet::TM_TeamMember::DeserializeConstruction |
( |
TeamManager * |
teamManager, |
|
|
BitStream * |
constructionBitstream |
|
) |
| |
Deserializes the current state of this object.
See SerializeConstruction for more details()
- Note
- DeserializeConstruction also calls ReferenceTeamMember on the passed teamManager instance, there is no need to do so yourself
- Parameters
-
TM_Team* RakNet::TM_TeamMember::GetCurrentTeam |
( |
void |
| ) |
const |
- Returns
- Get the first team we are on, or 0 if we are not on a team.
TM_Team* RakNet::TM_TeamMember::GetCurrentTeamByIndex |
( |
unsigned int |
index | ) |
|
unsigned int RakNet::TM_TeamMember::GetCurrentTeamCount |
( |
void |
| ) |
const |
- Returns
- How many teams we are on
- Parameters
-
[out] | Get | all teams we are on, as a list |
For each team member, when you get ID_TEAM_BALANCER_TEAM_ASSIGNED for that member, the team list is saved. Use this function to get that list, for example to determine which teams we just left or joined
- Parameters
-
[out] | _teams | The previous list of teams we were on |
NetworkID RakNet::TM_TeamMember::GetNetworkID |
( |
void |
| ) |
const |
NoTeamId RakNet::TM_TeamMember::GetNoTeamId |
( |
void |
| ) |
const |
- Returns
- If not on a team, returns the current NoTeamId value
void* RakNet::TM_TeamMember::GetOwner |
( |
void |
| ) |
const |
Returns pending calls to RequestTeam() when using TeamSelection::JOIN_SPECIFIC_TEAM.
- Parameters
-
[out] | All | pending requested teams |
TeamSelection RakNet::TM_TeamMember::GetRequestedTeam |
( |
void |
| ) |
const |
unsigned int RakNet::TM_TeamMember::GetRequestedTeamCount |
( |
void |
| ) |
const |
unsigned int RakNet::TM_TeamMember::GetRequestedTeamIndex |
( |
TM_Team * |
team | ) |
const |
Returns the index of team in the requested teams list.
- Parameters
-
[in] | The | team we are checking |
- Returns
- -1 if we did not requested to join this team. Otherwise the index.
TM_World* RakNet::TM_TeamMember::GetTM_World |
( |
void |
| ) |
const |
bool RakNet::TM_TeamMember::HasRequestedTeam |
( |
TM_Team * |
team | ) |
const |
Returns if the specified team is in the list of pending requested teams.
- Parameters
-
[in] | The | team we are checking |
- Returns
- Did we request to join this specific team?
bool RakNet::TM_TeamMember::IsOnTeam |
( |
TM_Team * |
team | ) |
const |
- Parameters
-
[in] | The | team we are checking |
- Returns
- Are we on this team?
bool RakNet::TM_TeamMember::LeaveAllTeams |
( |
NoTeamId |
noTeamSubcategory | ) |
|
Leave all teams Leaves all teams you are on, and sets noTeamSubcategory.
- Note
- This is the same as and just calls RequestTeam(TeamSelection::NoTeam(noTeamSubcategory));
- Returns
- false On invalid or unnecessary operation. Otherwise returns true
bool RakNet::TM_TeamMember::LeaveTeam |
( |
TM_Team * |
team, |
|
|
NoTeamId |
_noTeamSubcategory |
|
) |
| |
Leave a team.
Leaves a team that you are on. Always succeeds provided you are on that team Generates ID_TEAM_BALANCER_TEAM_ASSIGNED on all systems on success. If you leave the last team you are on, noTeamSubcategory is set as well.
- Parameters
-
[in] | team | Which team to leave |
[in] | _noTeamSubcategory | If the team member has been removed from all teams, which subcategory of NoTeamId to set them to |
- Returns
- false On invalid or unnecessary operation. Otherwise returns true
bool RakNet::TM_TeamMember::RequestTeam |
( |
TeamSelection |
teamSelection | ) |
|
Request to join any team, a specific team, or to leave all teams.
Function will return false on invalid operations, such as joining a team you are already on. Will also fail with TeamSelection::JOIN_ANY_AVAILABLE_TEAM if you are currently on a team. On success, every system will get ID_TEAM_BALANCER_TEAM_ASSIGNED. Use TeamManager::DecomposeTeamAssigned() to get details of which team member the message refers to. On failure, all systems will get ID_TEAM_BALANCER_REQUESTED_TEAM_FULL or ID_TEAM_BALANCER_REQUESTED_TEAM_LOCKED. Use TeamManager::DecomposeTeamFull() and TeamManager::DecomposeTeamLocked() to get details of which team member the message refers to.
- Note
- Joining a specific team with this function may result in being on more than one team at once, even if you call the function while locally only on one team. If your game depends on only being on one team at a team, use RequestTeamSwitch() instead with the parameter teamToLeave set to 0
- Parameters
-
- Returns
- false On invalid or unnecessary operation. Otherwise returns true
bool RakNet::TM_TeamMember::RequestTeamSwitch |
( |
TM_Team * |
teamToJoin, |
|
|
TM_Team * |
teamToLeave |
|
) |
| |
Similar to RequestTeam with TeamSelection::SpecificTeam(), but leave a team simultaneously when the desired team is joinable.
- Parameters
-
[in] | teamToJoin | Which team to join |
[in] | teamToLeave | If 0, means leave all current teams. Otherwise, leave the specified team. |
- Returns
- false On invalid or unnecessary operation. Otherwise returns true
void RakNet::TM_TeamMember::SerializeConstruction |
( |
BitStream * |
constructionBitstream | ) |
|
Serializes the current state of this object.
To replicate a TM_TeamMember on another system, first instantiate the object using your own code, or a system such as ReplicaManager3. Next, call SerializeConstruction() from whichever system owns the team member Last, call DeserializeConstruction() on the newly created TM_TeamMember
- Note
- You must instantiate and deserialize all TM_Team instances that the team member refers to before calling DesrializeConstruction(). ReplicaManager3::PostSerializeConstruction() and ReplicaManager3::PostDeserializeConstruction() will ensure this.
- Parameters
-
[out] | constructionBitstream | This object serialized to a BitStream |
void RakNet::TM_TeamMember::SetOwner |
( |
void * |
o | ) |
|
- Parameters
-
[in] | o | Stores a void* for your own use. If using composition, this is useful to store a pointer to the containing object. |
The documentation for this class was generated from the following file: