NetworkIDManager Class Reference

#include <NetworkIDManager.h>

List of all members.

Public Member Functions

void SetIsNetworkIDAuthority (bool isAuthority)
bool IsNetworkIDAuthority (void) const
 
Returns:
Returns what was passed to SetIsNetworkIDAuthority()

void SetExternalSystemAddress (SystemAddress systemAddress)
unsigned short GetSharedNetworkID (void)
void SetSharedNetworkID (unsigned short i)
void * GET_BASE_OBJECT_FROM_ID (NetworkID x)
void * GET_OBJECT_FROM_ID (NetworkID x)

Friends

class NetworkIDObject


Detailed Description

This class is simply used to generate a unique number for a group of instances of NetworkIDObject An instance of this class is required to use the ObjectID to pointer lookup system You should have one instance of this class per game instance. Call SetIsNetworkIDAuthority before using any functions of this class, or of NetworkIDObject

Member Function Documentation

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 set NetworkID::peerToPeerMode to true

void NetworkIDManager::SetExternalSystemAddress ( SystemAddress  systemAddress  ) 

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::GetExternalSystemAddress) one time, the first time you make a connection.

Precondition:
You must first call SetNetworkIDManager before using this function
Parameters:
[in] systemAddress Your external systemAddress

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.

Returns:
the HIGHEST Object Id currently used

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.

Parameters:
[in] i the highest number of NetworkIDObject reached.

void * NetworkIDManager::GET_BASE_OBJECT_FROM_ID ( NetworkID  x  ) 

If you use a parent, returns this instance rather than the parent object.

Precondition:
You must first call SetNetworkIDManager before using this function

void * NetworkIDManager::GET_OBJECT_FROM_ID ( NetworkID  x  ) 

Returns the parent object, or this instance if you don't use a parent.

Precondition:
You must first call SetNetworkIDManager before using this function


The documentation for this class was generated from the following files:
Generated on Mon Mar 31 21:15:53 2008 for RakNet by  doxygen 1.5.4