From 676903e65ca8c872510ee767ea781bd1c4f8be21 Mon Sep 17 00:00:00 2001 From: Ted John Date: Thu, 2 Feb 2017 21:31:36 +0000 Subject: [PATCH] Reduce false positive desync The staff list window modifies the sprites purely for local state causing a false positive desync warning to pop up in multiplayer. This now causes it to only happen if the map window is also open. This is also a performance improvement. #5164 --- src/openrct2/windows/staff_list.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/openrct2/windows/staff_list.c b/src/openrct2/windows/staff_list.c index 6713d6a1de..5f09ad4e97 100644 --- a/src/openrct2/windows/staff_list.c +++ b/src/openrct2/windows/staff_list.c @@ -316,15 +316,21 @@ void window_staff_list_update(rct_window *w) if (w->list_information_type >= 24) { w->list_information_type = 0; } else { - sint32 spriteIndex; - rct_peep *peep; widget_invalidate(w, WIDX_STAFF_LIST_HANDYMEN_TAB + _windowStaffListSelectedTab); - gWindowMapFlashingFlags |= (1 << 2); - FOR_ALL_STAFF(spriteIndex, peep) { - peep->flags &= ~(SPRITE_FLAGS_PEEP_FLASHING); - if (peep->staff_type == _windowStaffListSelectedTab) { - peep->flags |= SPRITE_FLAGS_PEEP_FLASHING; + // Enable highlighting of these staff members in map window + if (window_find_by_class(WC_MAP) != NULL) { + sint32 spriteIndex; + rct_peep * peep; + gWindowMapFlashingFlags |= (1 << 2); + FOR_ALL_STAFF(spriteIndex, peep) { + // TODO When possible, do not modify the peep state as it shows up as a + // multiplayer desynchronisation + peep->flags &= ~(SPRITE_FLAGS_PEEP_FLASHING); + + if (peep->staff_type == _windowStaffListSelectedTab) { + peep->flags |= SPRITE_FLAGS_PEEP_FLASHING; + } } } }