From 70543fe970cfc46707c13aeefffa754bfbe2472d Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Sun, 3 Jul 2022 02:26:06 +0700 Subject: [PATCH] Fix trading time pause output Trading time output announcement didn't actually check whether any changes took place. Now it does. --- sources/Commands/ACommandTrader.uc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sources/Commands/ACommandTrader.uc b/sources/Commands/ACommandTrader.uc index 638ba0b..4db63c3 100644 --- a/sources/Commands/ACommandTrader.uc +++ b/sources/Commands/ACommandTrader.uc @@ -178,24 +178,33 @@ protected function ListTradersFor(EPlayer target) protected function HandleTraderTime(CallData result) { + local bool oldIsPaused, newIsPaused; local int countDownValue; local Text parameter; local Parser parser; parameter = result.parameters.GetText(T(TTRADER_TIME)); if (parameter.Compare(T(TPAUSE), SCASE_INSENSITIVE)) { - if (!_.kf.trading.IsCountDownPaused()) { + oldIsPaused = _.kf.trading.IsCountDownPaused(); + if (!oldIsPaused) { + _.kf.trading.SetCountdownPause(true); + } + newIsPaused = _.kf.trading.IsCountDownPaused(); + if (oldIsPaused != newIsPaused) { announcer.AnnouncePausedTime(); } - _.kf.trading.SetCountdownPause(true); return; } else if (parameter.Compare(T(TUNPAUSE), SCASE_INSENSITIVE)) { - if (_.kf.trading.IsCountDownPaused()) { + oldIsPaused = _.kf.trading.IsCountDownPaused(); + if (oldIsPaused) { + _.kf.trading.SetCountdownPause(false); + } + newIsPaused = _.kf.trading.IsCountDownPaused(); + if (oldIsPaused != newIsPaused) { announcer.AnnounceUnpausedTime(); } - _.kf.trading.SetCountdownPause(false); return; } parser = _.text.Parse(parameter);