#include <NetworkIDManager.h>
Public Member Functions | |
void | SetIsNetworkIDAuthority (bool isAuthority) |
bool | IsNetworkIDAuthority (void) const |
void | SetExternalSystemAddress (SystemAddress systemAddress) |
void | SetGuid (RakNetGUID g) |
unsigned short | GetSharedNetworkID (void) |
void | SetSharedNetworkID (unsigned short i) |
NetworkIDObject * | GET_BASE_OBJECT_FROM_ID (NetworkID x) |
void * | GET_OBJECT_FROM_ID (NetworkID x) |
template<class returnType > | |
returnType | GET_OBJECT_FROM_ID (NetworkID x) |
Protected Attributes | |
DataStructures::AVLBalancedBinarySearchTree < NetworkIDNode > | IDTree |
This AVL tree holds the pointer to NetworkID mappings. | |
Friends | |
class | NetworkIDObject |
NetworkIDObject* NetworkIDManager::GET_BASE_OBJECT_FROM_ID | ( | NetworkID | x | ) |
If you use a parent, returns this instance rather than the parent object.
returnType NetworkIDManager::GET_OBJECT_FROM_ID | ( | NetworkID | x | ) | [inline] |
Returns the parent object, or this instance if you don't use a parent. Supports NetworkIDObject anywhere in the inheritance hierarchy
void* NetworkIDManager::GET_OBJECT_FROM_ID | ( | NetworkID | x | ) |
Returns the parent object, or this instance if you don't use a parent.
unsigned short NetworkIDManager::GetSharedNetworkID | ( | void | ) |
These function is only meant to be used when saving games as you should save the HIGHEST value staticItemID has achieved upon save and reload it upon load. Save AFTER you've created all the items derived from this class you are going to create.
bool NetworkIDManager::IsNetworkIDAuthority | ( | void | ) | const |
void NetworkIDManager::SetExternalSystemAddress | ( | SystemAddress | systemAddress | ) |
[in] | systemAddress | Your external systemAddress |
void NetworkIDManager::SetGuid | ( | RakNetGUID | g | ) |
Necessary for peer to peer, as NetworkIDs are then composed of your external player Id (doesn't matter which, as long as unique) plus the usual object ID number. Get this from RakPeer::GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS) one time, the first time you make a connection.
void NetworkIDManager::SetIsNetworkIDAuthority | ( | bool | isAuthority | ) |
For every group of systems, one system needs to be responsible for creating unique IDs for all objects created on all systems. This way, systems can send that id in packets to refer to objects (you can't send pointers because the memory allocations may be different). In a client/server environment, the system that creates unique IDs would be the server. If you are using peer to peer or other situations where you don't have a single system to assign ids, set this to true, and be sure NETWORK_ID_SUPPORTS_PEER_TO_PEER is defined in RakNetDefines.h
void NetworkIDManager::SetSharedNetworkID | ( | unsigned short | i | ) |
These function is only meant to be used when loading games. Load BEFORE you create any new objects that are not SetIDed based on the save data.
[in] | i | the highest number of NetworkIDObject reached. |