diff --git a/QSB/Events/QSBEvent.cs b/QSB/Events/QSBEvent.cs index b01be631..30e377d9 100644 --- a/QSB/Events/QSBEvent.cs +++ b/QSB/Events/QSBEvent.cs @@ -65,7 +65,7 @@ namespace QSB.Events { _eventHandler.SendToHost(message); } - else if (message.OnlySendToSpecific) + else if (message.ForId != uint.MaxValue) { _eventHandler.SendTo(message.ForId, message); } diff --git a/QSB/Messaging/PlayerMessage.cs b/QSB/Messaging/PlayerMessage.cs index 634bb776..b14eb553 100644 --- a/QSB/Messaging/PlayerMessage.cs +++ b/QSB/Messaging/PlayerMessage.cs @@ -16,20 +16,17 @@ namespace QSB.Messaging public uint AboutId { get; set; } /// - /// If true, only send this message to the host of the current session + /// If true, only send this message to the host of the current session /// (OnReceiveLocal/Remote is not called on any other client) /// public bool OnlySendToHost { get; set; } /// - /// If true, only send this message to ForId + /// The Player ID that this message is for. + /// By default, this is uint.MaxValue, + /// which means this is ignored and the message is sent to all clients /// - public bool OnlySendToSpecific { get; set; } - - /// - /// The Player ID that this message is for - /// - public uint ForId { get; set; } + public uint ForId { get; set; } = uint.MaxValue; public override void Deserialize(QNetworkReader reader) { @@ -38,11 +35,7 @@ namespace QSB.Messaging OnlySendToHost = reader.ReadBoolean(); if (!OnlySendToHost) { - OnlySendToSpecific = reader.ReadBoolean(); - if (OnlySendToSpecific) - { - ForId = reader.ReadUInt32(); - } + reader.ReadUInt32(); } } @@ -53,11 +46,7 @@ namespace QSB.Messaging writer.Write(OnlySendToHost); if (!OnlySendToHost) { - writer.Write(OnlySendToSpecific); - if (OnlySendToSpecific) - { - writer.Write(ForId); - } + writer.Write(ForId); } } }