From bcbff9c861c9be02a1bce969fb4099778a323f68 Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Sun, 3 Jul 2022 00:52:09 +0700 Subject: [PATCH] Empty trader lists are no longer reported --- sources/Commands/ACommandTrader_Announcer.uc | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sources/Commands/ACommandTrader_Announcer.uc b/sources/Commands/ACommandTrader_Announcer.uc index f1a5833..005391e 100644 --- a/sources/Commands/ACommandTrader_Announcer.uc +++ b/sources/Commands/ACommandTrader_Announcer.uc @@ -181,6 +181,9 @@ public final function AnnounceTradersOpened(ListBuilder traderList) tradersOpened.toSelfPublic = _.text.MakeTemplate_S( "%%instigator%% {$TextPositive opened} following traders: %1"); } + if (traderList.IsEmpty()) { + return; + } traderListAsText = traderList.GetMutable(); templates = MakeArray(tradersOpened); for (i = 0; i < templates.length; i += 1) { @@ -204,6 +207,9 @@ public final function AnnounceTradersClosed(ListBuilder traderList) tradersClosed.toSelfPublic = _.text.MakeTemplate_S( "%%instigator%% {$TextNegative closed} following traders: %1"); } + if (traderList.IsEmpty()) { + return; + } traderListAsText = traderList.GetMutable(); templates = MakeArray(tradersClosed); for (i = 0; i < templates.length; i += 1) { @@ -290,6 +296,9 @@ public final function AnnounceBootedPlayers(ListBuilder traderList) "%%instigator%% {$TextNegative booted} players from following" @ "traders: %1"); } + if (traderList.IsEmpty()) { + return; + } traderListAsText = traderList.GetMutable(); templates = MakeArray(bootedPlayers); for (i = 0; i < templates.length; i += 1) { @@ -313,6 +322,9 @@ public final function AnnounceEnabledTraders(ListBuilder traderList) enabledTraders.toSelfPublic = _.text.MakeTemplate_S( "%%instigator%% {$TextPositive enabled} following traders: %1"); } + if (traderList.IsEmpty()) { + return; + } traderListAsText = traderList.GetMutable(); templates = MakeArray(enabledTraders); for (i = 0; i < templates.length; i += 1) { @@ -336,6 +348,9 @@ public final function AnnounceDisabledTraders(ListBuilder traderList) disabledTraders.toSelfPublic = _.text.MakeTemplate_S( "%%instigator%% {$TextNegative disabled} following traders: %1"); } + if (traderList.IsEmpty()) { + return; + } traderListAsText = traderList.GetMutable(); templates = MakeArray(disabledTraders); for (i = 0; i < templates.length; i += 1) { @@ -360,6 +375,9 @@ public final function AnnounceAutoOpenTraders(ListBuilder traderList) "%%instigator%% made following traders {$TextPositive automatically" @ "openable}: %1"); } + if (traderList.IsEmpty()) { + return; + } traderListAsText = traderList.GetMutable(); templates = MakeArray(autoOpenTraders); for (i = 0; i < templates.length; i += 1) { @@ -385,6 +403,9 @@ public final function AnnounceDoNotAutoOpenTraders(ListBuilder traderList) "%%instigator%% made following traders {$TextNegative no longer}" @ "automatically openable: %1"); } + if (traderList.IsEmpty()) { + return; + } traderListAsText = traderList.GetMutable(); templates = MakeArray(doNotAutoOpenTraders); for (i = 0; i < templates.length; i += 1) {