#include <TeamManager.h>
Public Member Functions | |
bool | RequestTeam (TeamSelection teamSelection) |
Request to join any team, a specific team, or to leave all teams. | |
bool | RequestTeamSwitch (TM_Team *teamToJoin, TM_Team *teamToLeave) |
Similar to RequestTeam with TeamSelection::SpecificTeam(), but leave a team simultaneously when the desired team is joinable. | |
TeamSelection | GetRequestedTeam (void) const |
Returns the first requested team in the list of requested teams, if you have a requested team at all. | |
void | GetRequestedSpecificTeams (DataStructures::List< TM_Team * > &requestedTeams) const |
Returns pending calls to RequestTeam() when using TeamSelection::JOIN_SPECIFIC_TEAM. | |
bool | HasRequestedTeam (TM_Team *team) const |
Returns if the specified team is in the list of pending requested teams. | |
unsigned int | GetRequestedTeamIndex (TM_Team *team) const |
Returns the index of team in the requested teams list. | |
unsigned int | GetRequestedTeamCount (void) const |
bool | CancelTeamRequest (TM_Team *specificTeamToCancel) |
Cancels a request to join a specific team. | |
bool | LeaveTeam (TM_Team *team, NoTeamId _noTeamSubcategory) |
Leave a team. | |
bool | LeaveAllTeams (NoTeamId noTeamSubcategory) |
Leave all teams Leaves all teams you are on, and sets noTeamSubcategory. | |
TM_Team * | GetCurrentTeam (void) const |
unsigned int | GetCurrentTeamCount (void) const |
TM_Team * | GetCurrentTeamByIndex (unsigned int index) |
void | GetCurrentTeams (DataStructures::List< TM_Team * > &_teams) const |
void | GetLastTeams (DataStructures::List< TM_Team * > &_teams) const |
bool | IsOnTeam (TM_Team *team) const |
NetworkID | GetNetworkID (void) const |
TM_World * | GetTM_World (void) const |
void | SerializeConstruction (BitStream *constructionBitstream) |
Serializes the current state of this object. | |
bool | DeserializeConstruction (TeamManager *teamManager, BitStream *constructionBitstream) |
Deserializes the current state of this object. | |
void | SetOwner (void *o) |
void * | GetOwner (void) const |
NoTeamId | GetNoTeamId (void) const |
unsigned int | GetWorldIndex (void) const |
Return world->GetTeamMemberIndex(this). |
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.
[in] | specificTeamToCancel | Which team to no longer join. Use 0 for all. |
bool RakNet::TM_TeamMember::DeserializeConstruction | ( | TeamManager * | teamManager, | |
BitStream * | constructionBitstream | |||
) |
Deserializes the current state of this object.
See SerializeConstruction for more details()
[in] | teamManager | TeamManager instance |
[in] | constructionBitstream | This object serialized to a BitStream |
TM_Team* RakNet::TM_TeamMember::GetCurrentTeam | ( | void | ) | const |
TM_Team* RakNet::TM_TeamMember::GetCurrentTeamByIndex | ( | unsigned int | index | ) |
unsigned int RakNet::TM_TeamMember::GetCurrentTeamCount | ( | void | ) | const |
void RakNet::TM_TeamMember::GetCurrentTeams | ( | DataStructures::List< TM_Team * > & | _teams | ) | const |
[out] | Get | all teams we are on, as a list |
void RakNet::TM_TeamMember::GetLastTeams | ( | DataStructures::List< TM_Team * > & | _teams | ) | const |
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
[out] | _teams | The previous list of teams we were on |
NetworkID RakNet::TM_TeamMember::GetNetworkID | ( | void | ) | const |
NoTeamId RakNet::TM_TeamMember::GetNoTeamId | ( | void | ) | const |
void* RakNet::TM_TeamMember::GetOwner | ( | void | ) | const |
void RakNet::TM_TeamMember::GetRequestedSpecificTeams | ( | DataStructures::List< TM_Team * > & | requestedTeams | ) | const |
Returns pending calls to RequestTeam() when using TeamSelection::JOIN_SPECIFIC_TEAM.
[out] | All | pending requested teams |
TeamSelection RakNet::TM_TeamMember::GetRequestedTeam | ( | void | ) | const |
Returns the first requested team in the list of requested teams, if you have a requested team at all.
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.
[in] | The | team we are checking |
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.
[in] | The | team we are checking |
bool RakNet::TM_TeamMember::IsOnTeam | ( | TM_Team * | team | ) | const |
[in] | The | team we are checking |
bool RakNet::TM_TeamMember::LeaveAllTeams | ( | NoTeamId | noTeamSubcategory | ) |
Leave all teams Leaves all teams you are on, and sets 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.
[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 |
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.
[in] | TeamSelection::AnyAvailable(),TeamSelection::SpecificTeam(),or | TeamSelection::NoTeam() |
Similar to RequestTeam with TeamSelection::SpecificTeam(), but leave a team simultaneously when the desired team is joinable.
[in] | teamToJoin | Which team to join |
[in] | teamToLeave | If 0, means leave all current teams. Otherwise, leave the specified team. |
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
[out] | constructionBitstream | This object serialized to a BitStream |
void RakNet::TM_TeamMember::SetOwner | ( | void * | o | ) |
[in] | o | Stores a void* for your own use. If using composition, this is useful to store a pointer to the containing object. |