Allow entertainer costume to be given to game command

This commit is contained in:
Ted John 2017-01-24 12:48:46 +00:00
parent c9ab0d11b3
commit 2900f38cc3
3 changed files with 31 additions and 6 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;
}