mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 10:21:57 -05:00
Send refresh guest list intent on peep removal Also added protection to guest list to prevent accessing invalid peeps
This commit is contained in:
parent
b0a3fd82d9
commit
132b2e5966
3 changed files with 16 additions and 6 deletions
|
@ -42,6 +42,7 @@
|
|||
- Fix: [#11953] Incorrect banner text shade colour on wall text.
|
||||
- Fix: [#12062] Inconsistent lift hill sprites on Flying Coaster while inverted (original bug).
|
||||
- Fix: [#12068] Incorrect Entrance/Exit location on track design preview. Incorrect track design previews with track that contain diagonal track elements.
|
||||
- Fix: [#12071] Crash in Guest List when a guest dies.
|
||||
- Fix: [#12093] Staff window tab animation was no longer updating.
|
||||
- Fix: [#12123] Long server descriptions are not cut off properly.
|
||||
- Fix: [#12211] Map Generator shows incorrect map sizes (e.g. "150 x 0").
|
||||
|
|
|
@ -582,7 +582,11 @@ static void window_guest_list_scrollmousedown(rct_window* w, int32_t scrollIndex
|
|||
{
|
||||
if (i == 0)
|
||||
{
|
||||
window_guest_open(GET_PEEP(spriteIndex));
|
||||
auto guest = GetEntity<Guest>(spriteIndex);
|
||||
if (guest != nullptr)
|
||||
{
|
||||
window_guest_open(guest);
|
||||
}
|
||||
break;
|
||||
}
|
||||
i--;
|
||||
|
@ -771,7 +775,11 @@ static void window_guest_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi,
|
|||
}
|
||||
|
||||
// Guest name
|
||||
auto peep = GET_PEEP(spriteIndex);
|
||||
auto peep = GetEntity<Guest>(spriteIndex);
|
||||
if (peep == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
auto ft = Formatter::Common();
|
||||
peep->FormatNameTo(ft);
|
||||
gfx_draw_string_left_clipped(dpi, format, gCommonFormatArgs, COLOUR_BLACK, { 0, y }, 113);
|
||||
|
|
|
@ -812,16 +812,14 @@ void peep_sprite_remove(Peep* peep)
|
|||
|
||||
window_close_by_number(WC_FIRE_PROMPT, peep->sprite_identifier);
|
||||
|
||||
// Needed for invalidations after sprite removal
|
||||
bool wasGuest = peep->AssignedPeepType == PEEP_TYPE_GUEST;
|
||||
if (peep->AssignedPeepType == PEEP_TYPE_GUEST)
|
||||
{
|
||||
window_invalidate_by_class(WC_GUEST_LIST);
|
||||
|
||||
news_item_disable_news(NEWS_ITEM_PEEP_ON_RIDE, peep->sprite_index);
|
||||
}
|
||||
else
|
||||
{
|
||||
window_invalidate_by_class(WC_STAFF_LIST);
|
||||
|
||||
gStaffModes[peep->StaffId] = 0;
|
||||
peep->AssignedPeepType = PEEP_TYPE_INVALID;
|
||||
staff_update_greyed_patrol_areas();
|
||||
|
@ -830,6 +828,9 @@ void peep_sprite_remove(Peep* peep)
|
|||
news_item_disable_news(NEWS_ITEM_PEEP, peep->sprite_index);
|
||||
}
|
||||
sprite_remove(peep);
|
||||
|
||||
auto intent = Intent(wasGuest ? INTENT_ACTION_REFRESH_GUEST_LIST : INTENT_ACTION_REFRESH_STAFF_LIST);
|
||||
context_broadcast_intent(&intent);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue