From e7a2907a9ba85ba696249fc43cf45a0d44d4b3ca Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Wed, 31 May 2017 19:00:59 +0100 Subject: [PATCH] Consolidate window invalidations in UpdateScheduledDispatch() --- src/schdispatch_cmd.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/schdispatch_cmd.cpp b/src/schdispatch_cmd.cpp index 073725c23c..3852335a27 100644 --- a/src/schdispatch_cmd.cpp +++ b/src/schdispatch_cmd.cpp @@ -303,13 +303,14 @@ void OrderList::RemoveScheduledDispatch(uint32 offset) */ void OrderList::UpdateScheduledDispatch() { + bool update_windows = false; /* Most of the time this loop does not runs. It makes sure start date in in past */ while (this->GetScheduledDispatchStartTick() > _scaled_date_ticks) { this->scheduled_dispatch_last_dispatch += this->GetScheduledDispatchDuration(); SchdispatchConvertToFullDateFract( this->GetScheduledDispatchStartTick() - this->GetScheduledDispatchDuration(), &this->scheduled_dispatch_start_date, &this->scheduled_dispatch_start_full_date_fract); - InvalidateWindowClassesData(WC_SCHDISPATCH_SLOTS, VIWD_MODIFY_ORDERS); + update_windows = true; } /* Most of the time this loop runs once. It makes sure the start date is as close to current time as possible. */ while (this->GetScheduledDispatchStartTick() + this->GetScheduledDispatchDuration() <= _scaled_date_ticks) { @@ -317,8 +318,9 @@ void OrderList::UpdateScheduledDispatch() SchdispatchConvertToFullDateFract( this->GetScheduledDispatchStartTick() + this->GetScheduledDispatchDuration(), &this->scheduled_dispatch_start_date, &this->scheduled_dispatch_start_full_date_fract); - InvalidateWindowClassesData(WC_SCHDISPATCH_SLOTS, VIWD_MODIFY_ORDERS); + update_windows = true; } + if (update_windows) InvalidateWindowClassesData(WC_SCHDISPATCH_SLOTS, VIWD_MODIFY_ORDERS); } /**