From 2900f38cc3278cd5650e4cceca1f6cf5cf16cb02 Mon Sep 17 00:00:00 2001 From: Ted John Date: Tue, 24 Jan 2017 12:48:46 +0000 Subject: [PATCH] Allow entertainer costume to be given to game command --- src/openrct2/network/network.h | 2 +- src/openrct2/peep/staff.c | 20 +++++++++++++++----- src/openrct2/windows/staff_list.c | 15 +++++++++++++++ 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/openrct2/network/network.h b/src/openrct2/network/network.h index e71dfdc918..7c98d0622f 100644 --- a/src/openrct2/network/network.h +++ b/src/openrct2/network/network.h @@ -54,7 +54,7 @@ extern "C" { // This define specifies which version of network stream current build uses. // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -#define NETWORK_STREAM_VERSION "30" +#define NETWORK_STREAM_VERSION "31" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION #ifdef __cplusplus diff --git a/src/openrct2/peep/staff.c b/src/openrct2/peep/staff.c index eb8b60b880..d7122ea225 100644 --- a/src/openrct2/peep/staff.c +++ b/src/openrct2/peep/staff.c @@ -163,12 +163,18 @@ static money32 staff_hire_new_staff_member(uint8 staff_type, uint8 flags, sint16 return MONEY32_UNDEFINED; } - if (staff_type != STAFF_TYPE_HANDYMAN && - staff_type != STAFF_TYPE_MECHANIC && - staff_type != STAFF_TYPE_SECURITY && - staff_type != STAFF_TYPE_ENTERTAINER) + // Staff type matches STAFF_TYPE enum, but ENTERTAINER onwards will match + // the ENTERTAINER_COSTUME enum + uint8 entertainerType = ENTERTAINER_COSTUME_PANDA; + if (staff_type >= STAFF_TYPE_ENTERTAINER) { - return MONEY32_UNDEFINED; + entertainerType = staff_type - STAFF_TYPE_ENTERTAINER; + if (entertainerType >= ENTERTAINER_COSTUME_COUNT) + { + // Invalid entertainer costume + return MONEY32_UNDEFINED; + } + staff_type = STAFF_TYPE_ENTERTAINER; } sint32 i; @@ -264,6 +270,10 @@ static money32 staff_hire_new_staff_member(uint8 staff_type, uint8 flags, sint16 }; uint8 sprite_type = spriteTypes[staff_type]; + if (staff_type == STAFF_TYPE_ENTERTAINER) + { + sprite_type = PEEP_SPRITE_TYPE_ENTERTAINER_PANDA + entertainerType; + } newPeep->name_string_idx = staffNames[staff_type]; newPeep->sprite_type = sprite_type; diff --git a/src/openrct2/windows/staff_list.c b/src/openrct2/windows/staff_list.c index 8a9516608a..95af821314 100644 --- a/src/openrct2/windows/staff_list.c +++ b/src/openrct2/windows/staff_list.c @@ -132,6 +132,8 @@ static uint16 _window_staff_list_selected_type_count = 0; static sint32 _windowStaffListHighlightedIndex; static sint32 _windowStaffListSelectedTab; +static uint8 window_staff_list_get_random_entertainer_costume(); + typedef struct staff_naming_convention { rct_string_id plural; @@ -217,8 +219,16 @@ static void window_staff_list_mouseup(rct_window *w, sint32 widgetIndex) window_close(w); break; case WIDX_STAFF_LIST_HIRE_BUTTON: + { + int staffType = _windowStaffListSelectedTab; + if (staffType == STAFF_TYPE_ENTERTAINER) + { + uint8 costume = window_staff_list_get_random_entertainer_costume(); + staffType += costume; + } hire_new_staff_member(_windowStaffListSelectedTab); break; + } case WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON: if (!tool_set(w, WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON, 12)) { show_gridlines(); @@ -693,3 +703,8 @@ void window_staff_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint32 } } } + +static uint8 window_staff_list_get_random_entertainer_costume() +{ + return ENTERTAINER_COSTUME_PANDA; +}