fix rank replication
This commit is contained in:
parent
82fca1bfbc
commit
5f4e2fec5d
@ -334,8 +334,9 @@ function DrawPlayerEntry( Canvas C, int Index, float YOffset, float Height, floa
|
|||||||
KFPRI = KFPRIArray[Index];
|
KFPRI = KFPRIArray[Index];
|
||||||
|
|
||||||
HasRank = false;
|
HasRank = false;
|
||||||
|
|
||||||
PlayerInfoIndex = RankRelations.Find('UID', KFPRI.UniqueId);
|
PlayerInfoIndex = RankRelations.Find('UID', KFPRI.UniqueId);
|
||||||
if (PlayerInfoIndex != INDEX_NONE )
|
if (PlayerInfoIndex != INDEX_NONE && RankRelations[PlayerInfoIndex].RankID != INDEX_NONE)
|
||||||
{
|
{
|
||||||
PlayerRankIndex = CustomRanks.Find('ID', RankRelations[PlayerInfoIndex].RankID);
|
PlayerRankIndex = CustomRanks.Find('ID', RankRelations[PlayerInfoIndex].RankID);
|
||||||
if (PlayerRankIndex != INDEX_NONE)
|
if (PlayerRankIndex != INDEX_NONE)
|
||||||
|
@ -202,23 +202,27 @@ private function AddPlayer(Controller C)
|
|||||||
RepClientNew.RepInfo.Settings = Settings;
|
RepClientNew.RepInfo.Settings = Settings;
|
||||||
RepClientNew.RepInfo.RankRelation.UID = KFPC.PlayerReplicationInfo.UniqueId;
|
RepClientNew.RepInfo.RankRelation.UID = KFPC.PlayerReplicationInfo.UniqueId;
|
||||||
RepClientNew.RepInfo.RankRelation.RankID = UIDRankRelationsPlayers.Find('UID', RepClientNew.RepInfo.RankRelation.UID);
|
RepClientNew.RepInfo.RankRelation.RankID = UIDRankRelationsPlayers.Find('UID', RepClientNew.RepInfo.RankRelation.UID);
|
||||||
UIDRankRelationsActive.AddItem(RepClientNew.RepInfo.RankRelation);
|
|
||||||
|
|
||||||
RepClients.AddItem(RepClientNew);
|
RepClients.AddItem(RepClientNew);
|
||||||
|
|
||||||
foreach UIDRankRelationsActive(Relation) // For this player
|
foreach UIDRankRelationsActive(Relation)
|
||||||
RepClientNew.RepInfo.AddRankRelation(Relation);
|
RepClientNew.RepInfo.AddRankRelation(Relation);
|
||||||
|
|
||||||
RepClientNew.RepInfo.StartFirstTimeReplication();
|
RepClientNew.RepInfo.StartFirstTimeReplication();
|
||||||
|
|
||||||
foreach RepClients(RepClient) // For other players
|
if (RepClientNew.RepInfo.RankRelation.RankID != INDEX_NONE)
|
||||||
RepClient.RepInfo.AddRankRelation(Relation);
|
{
|
||||||
|
UIDRankRelationsActive.AddItem(RepClientNew.RepInfo.RankRelation);
|
||||||
|
foreach RepClients(RepClient)
|
||||||
|
RepClient.RepInfo.AddRankRelation(RepClientNew.RepInfo.RankRelation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function RemovePlayer(Controller C)
|
private function RemovePlayer(Controller C)
|
||||||
{
|
{
|
||||||
local KFPlayerController KFPC;
|
local KFPlayerController KFPC;
|
||||||
local int Index;
|
local int Index, i;
|
||||||
|
local UniqueNetId UID;
|
||||||
|
|
||||||
`callstack();
|
`callstack();
|
||||||
|
|
||||||
@ -226,8 +230,12 @@ private function RemovePlayer(Controller C)
|
|||||||
if (KFPC == None)
|
if (KFPC == None)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// UID = KFPC.PlayerReplicationInfo.UniqueId;
|
UID = KFPC.PlayerReplicationInfo.UniqueId;
|
||||||
// Remove Rank Relation here
|
Index = UIDRankRelationsActive.Find('UID', UID);
|
||||||
|
if (Index != INDEX_NONE)
|
||||||
|
for (i = 0; i < UIDRankRelationsActive.Length; ++i)
|
||||||
|
if (Index != i)
|
||||||
|
RepClients[i].RepInfo.RemoveRankRelation(UIDRankRelationsActive[Index]);
|
||||||
|
|
||||||
Index = RepClients.Find('KFPC', KFPC);
|
Index = RepClients.Find('KFPC', KFPC);
|
||||||
if (Index == INDEX_NONE)
|
if (Index == INDEX_NONE)
|
||||||
@ -239,20 +247,6 @@ private function RemovePlayer(Controller C)
|
|||||||
RepClients.Remove(Index, 1);
|
RepClients.Remove(Index, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
private function RemoveRankRelationByUID(UniqueNetId UID)
|
|
||||||
{
|
|
||||||
local int Index;
|
|
||||||
Index = UIDRankRelationsActive.Find('UID', UID);
|
|
||||||
if (Index != INDEX_NONE)
|
|
||||||
{
|
|
||||||
Relation = UIDRankRelationsActive[Index];
|
|
||||||
for (i = 0; i < UIDRankRelationsActive.Length; ++i)
|
|
||||||
RepClients[Index].RepInfo.RemoveRankRelation(Relation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public function UpdatePlayerRank(UIDRankRelation Rel)
|
public function UpdatePlayerRank(UIDRankRelation Rel)
|
||||||
{
|
{
|
||||||
local SClient RepClient;
|
local SClient RepClient;
|
||||||
@ -261,9 +255,10 @@ public function UpdatePlayerRank(UIDRankRelation Rel)
|
|||||||
`callstack();
|
`callstack();
|
||||||
|
|
||||||
Index = UIDRankRelationsActive.Find('UID', Rel.UID);
|
Index = UIDRankRelationsActive.Find('UID', Rel.UID);
|
||||||
|
|
||||||
if (Index != INDEX_NONE)
|
if (Index != INDEX_NONE)
|
||||||
UIDRankRelationsActive[Index] = Rel;
|
UIDRankRelationsActive[Index] = Rel;
|
||||||
|
else
|
||||||
|
UIDRankRelationsActive.AddItem(Rel);
|
||||||
|
|
||||||
foreach RepClients(RepClient)
|
foreach RepClients(RepClient)
|
||||||
RepClient.RepInfo.UpdateRankRelation(Rel);
|
RepClient.RepInfo.UpdateRankRelation(Rel);
|
||||||
|
@ -227,6 +227,8 @@ private reliable client function ClientUpdateRankRelation(UIDRankRelation Rel)
|
|||||||
|
|
||||||
if (Index != INDEX_NONE)
|
if (Index != INDEX_NONE)
|
||||||
RankRelations[Index] = Rel;
|
RankRelations[Index] = Rel;
|
||||||
|
else
|
||||||
|
RankRelations.AddItem(Rel);
|
||||||
|
|
||||||
ClientApplyRankRelations();
|
ClientApplyRankRelations();
|
||||||
}
|
}
|
||||||
@ -237,8 +239,7 @@ defaultproperties
|
|||||||
bOnlyRelevantToOwner = true;
|
bOnlyRelevantToOwner = true;
|
||||||
Role = ROLE_Authority;
|
Role = ROLE_Authority;
|
||||||
RemoteRole = ROLE_SimulatedProxy;
|
RemoteRole = ROLE_SimulatedProxy;
|
||||||
// This is needed, otherwise the client-to-server RPC fails
|
bSkipActorPropertyReplication = false; // This is needed, otherwise the client-to-server RPC fails
|
||||||
bSkipActorPropertyReplication = false;
|
|
||||||
|
|
||||||
CustomRanksRepProgress = 0;
|
CustomRanksRepProgress = 0;
|
||||||
SteamGroupsRepProgress = 0;
|
SteamGroupsRepProgress = 0;
|
||||||
|
@ -55,12 +55,22 @@ struct RankRelation
|
|||||||
{
|
{
|
||||||
var string ObjectID;
|
var string ObjectID;
|
||||||
var int RankID;
|
var int RankID;
|
||||||
|
|
||||||
|
StructDefaultProperties
|
||||||
|
{
|
||||||
|
RankID=-999
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct UIDRankRelation
|
struct UIDRankRelation
|
||||||
{
|
{
|
||||||
var UniqueNetId UID;
|
var UniqueNetId UID;
|
||||||
var int RankID;
|
var int RankID;
|
||||||
|
|
||||||
|
StructDefaultProperties
|
||||||
|
{
|
||||||
|
RankID=-999
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SCESettingsAdmin
|
struct SCESettingsAdmin
|
||||||
|
Loading…
Reference in New Issue
Block a user