1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 11:33:03 +01:00

Prevent going out of bounds when listing 'peep' entertainers (#22114)

* Prevent going out of bounds for 'peep' entertainers

* Show 'edited' entertainers as peeps in staff list
This commit is contained in:
Aaron van Geffen
2024-05-28 17:55:16 +02:00
committed by GitHub
parent 01319ff352
commit f703413dca
2 changed files with 12 additions and 2 deletions

View File

@@ -822,14 +822,22 @@ static Widget _staffOptionsWidgets[] = {
switch (staff->AssignedStaffType)
{
case StaffType::Entertainer:
{
widgets[WIDX_CHECKBOX_1].type = WindowWidgetType::Empty;
widgets[WIDX_CHECKBOX_2].type = WindowWidgetType::Empty;
widgets[WIDX_CHECKBOX_3].type = WindowWidgetType::Empty;
widgets[WIDX_CHECKBOX_4].type = WindowWidgetType::Empty;
widgets[WIDX_COSTUME_BOX].type = WindowWidgetType::DropdownMenu;
widgets[WIDX_COSTUME_BTN].type = WindowWidgetType::Button;
widgets[WIDX_COSTUME_BOX].text = StaffCostumeNames[EnumValue(staff->SpriteType) - 4];
// TODO: retrieve string from object instead
auto costumeType = EnumValue(staff->SpriteType) - EnumValue(PeepSpriteType::EntertainerPanda);
if (costumeType >= 0)
widgets[WIDX_COSTUME_BOX].text = StaffCostumeNames[costumeType];
else
widgets[WIDX_COSTUME_BOX].text = STR_UNKNOWN_OBJECT_TYPE;
break;
}
case StaffType::Handyman:
widgets[WIDX_CHECKBOX_1].type = WindowWidgetType::Checkbox;
widgets[WIDX_CHECKBOX_1].text = STR_STAFF_OPTION_SWEEP_FOOTPATHS;

View File

@@ -729,7 +729,6 @@ static Widget _staffListWidgets[] = {
{
switch (type)
{
default:
case PeepSpriteType::EntertainerPanda:
return SPR_STAFF_COSTUME_PANDA;
case PeepSpriteType::EntertainerTiger:
@@ -752,6 +751,9 @@ static Widget _staffListWidgets[] = {
return SPR_STAFF_COSTUME_SHERIFF;
case PeepSpriteType::EntertainerPirate:
return SPR_STAFF_COSTUME_PIRATE;
case PeepSpriteType::Normal:
default:
return SPR_PEEP_SMALL_FACE_HAPPY;
}
}
};