Skip to content
Browse files
Fix a desync during runtime join (GH-58)
This is a workaround for a more complex engine-side issue. See #1953
  • Loading branch information
lluchs committed Nov 5, 2017
1 parent fb87db1 commit c0047bdc5305640602082d9eb7e320c31700a67c
Showing with 6 additions and 2 deletions.
  1. +6 −2 planet/Objects.ocd/Libraries.ocd/HUDAdapter.ocd/Script.c
@@ -26,8 +26,12 @@ public func IsHUDAdapter()
private func GetHUDController()
var plr = GetOwner();
if (GetPlayerType(plr) != C4PT_User) return nil;
// During runtime join, plr isn't a valid player in the joining client yet
// when this function is called from OnSynchronized(). This code previously
// checked player validity before returning a cached HUD object which would
// cause a desync.
if (HUDcontroller) return HUDcontroller;
if (GetPlayerType(plr) != C4PT_User) return nil;
var controllerDef = Library_HUDController->GetGUIControllerID();
HUDcontroller = FindObject(Find_ID(controllerDef), Find_Owner(plr));
if (!HUDcontroller)
@@ -231,4 +235,4 @@ public func ControlContents()
if (HUDcontroller)
return _inherited(...);

0 comments on commit c0047bd

Please sign in to comment.