1
0
forked from mirrors/0ad

Use early return when there is no message

(cherry picked from commit c32a747873)
Signed-off-by: Itms <itms@wildfiregames.com>
This commit is contained in:
phosit
2024-12-31 13:13:20 +01:00
committed by Itms
parent da87b72e6a
commit a4d1aebb74
@@ -515,13 +515,15 @@ Player.prototype.SetState = function(newState, message)
Engine.PostMessage(this.entity, won ? MT_PlayerWon : MT_PlayerDefeated,
{ "playerId": this.playerID });
if (message)
Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface).PushNotification({
"type": won ? "won" : "defeat",
"players": [this.playerID],
"allies": [this.playerID],
"message": message
});
if (!message)
return;
Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface).PushNotification({
"type": won ? "won" : "defeat",
"players": [this.playerID],
"allies": [this.playerID],
"message": message
});
};
Player.prototype.GetFormations = function()