I love the smell of UnrealEd crashing in the morning. – tarquin

Legacy:LinkedReplicationInfo

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
UT2004 :: Object >> Actor >> Info >> ReplicationInfo >> LinkedReplicationInfo (Package: Engine)

This class allows mod authors to replicate additional information about a player to all clients in a network game by subclassing it and attaching it to a PlayerReplicationInfo.

Properties[edit]

LinkedReplicationInfo NextReplicationInfo
Link to the next replication info. This is used to build a list when there are multiple mods that want to add info about a player.

Usage[edit]

Neither LinkedReplicationInfo nor PlayerReplicationInfo provide methods for maintaining the linked list, so mod authors will have to do that themselves. Both the PlayerReplicationInfo.CustomReplicationInfo and LinkedReplicationInfo.NextReplicationInfo variables are only replicated to clients if bNetInitial, which means that the LinkedReplicationInfo must be added serversidely before replication starts or it might not be linked on the client. Also, LinkedReplicationInfos should never be destroyed because changes in the linked list do not propagate to the clients. You may be able to carefully repair the list in a simulated Destroyed() function, though.

Some potentially useful (but untested) functions:

class MyLinkedRI extends LinkedReplicationInfo;
 
// should be called right after the PlayerReplicationInfo was spawned
static function MyLinkedRI SpawnFor(PlayerReplicationInfo OwnerPRI)
{
  local LinkedReplicationInfo LinkedRI;
 
  // check for existing linked RI
  LinkedRI = FindFor(OwnerPRI);
  if ( LinkedRI != None )
    return MyLinkedRI(LinkedRI);
 
  // spawn a new one
  if ( OwnerPRI != None && OwnerPRI.Owner != None ) {
    LinkedRI = OwnerPRI.Spawn(default.Class, OwnerPRI.Owner);
    LinkedRI.NextReplicationInfo = OwnerPRI.CustomReplicationInfo;
    OwnerPRI.CustomReplicationInfo = LinkedRI;
  }
  return MyLinkedRI(LinkedRI);
}
 
// use this function to find your existing linked RI
static function MyLinkedRI FindFor(PlayerReplicationInfo OwnerPRI)
{
  local LinkedReplicationInfo LinkedRI;
 
  if ( OwnerPRI == None )
    return None;
 
  for (LinkedRI = OwnerPRI.CustomReplicationInfo; LinkedRI != None; LinkedRI = LinkedRI.NextReplicationInfo)
    if ( MyLinkedRI(LinkedRI) != None )
      return MyLinkedRI(LinkedRI);
 
  return None;
}