forked from Mirrors/openclonk
Fix a desync during runtime join (GH-58)
This is a workaround for a more complex engine-side issue. See #1953install-platforms
parent
fb87db1579
commit
c0047bdc53
|
@ -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)
|
||||
HUDcontroller->~ScheduleUpdateInventory();
|
||||
return _inherited(...);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue