diff --git a/src/game.c b/src/game.c index 4de4948727..3c4d6f3f48 100644 --- a/src/game.c +++ b/src/game.c @@ -82,6 +82,7 @@ GAME_COMMAND_CALLBACK_POINTER* game_command_callback_table[] = { game_command_callback_ride_remove_track_piece, game_command_callback_place_banner, game_command_callback_place_ride_entrance_or_exit, + game_command_callback_hire_new_staff_member, }; int game_command_playerid = -1; diff --git a/src/peep/staff.c b/src/peep/staff.c index 72b73a99b1..c8e87feb97 100644 --- a/src/peep/staff.c +++ b/src/peep/staff.c @@ -327,6 +327,21 @@ void game_command_hire_new_staff_member(int* eax, int* ebx, int* ecx, int* edx, edi); } +void game_command_callback_hire_new_staff_member(int eax, int ebx, int ecx, int edx, int esi, int edi, int ebp) +{ + int sprite_index = edi; + if (sprite_index == SPRITE_INDEX_NULL) + { + rct_window *window = window_find_by_class(WC_STAFF_LIST); + window_invalidate(window); + } + else + { + rct_peep *peep = &get_sprite(sprite_index)->peep; + window_staff_open(peep); + } +} + /** rct2: 0x00982134 */ static const bool peep_slow_walking_types[] = { false, // PEEP_SPRITE_TYPE_NORMAL @@ -484,6 +499,7 @@ uint16 hire_new_staff_member(uint8 staffType) eax = 0x8000; ebx = staffType << 8 | GAME_COMMAND_FLAG_APPLY; + game_command_callback = game_command_callback_hire_new_staff_member; int result = game_do_command_p(GAME_COMMAND_HIRE_NEW_STAFF_MEMBER, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp); if (result == MONEY32_UNDEFINED) diff --git a/src/peep/staff.h b/src/peep/staff.h index 5c06ed4fd3..f6d64c9119 100644 --- a/src/peep/staff.h +++ b/src/peep/staff.h @@ -69,6 +69,7 @@ extern colour_t gStaffSecurityColour; void game_command_update_staff_colour(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp); void game_command_hire_new_staff_member(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp); +void game_command_callback_hire_new_staff_member(int eax, int ebx, int ecx, int edx, int esi, int edi, int ebp); void game_command_set_staff_order(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp); void game_command_set_staff_patrol(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp); void game_command_fire_staff_member(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp); diff --git a/src/windows/staff_list.c b/src/windows/staff_list.c index d202680296..17928f6d4b 100644 --- a/src/windows/staff_list.c +++ b/src/windows/staff_list.c @@ -211,22 +211,12 @@ void window_staff_list_close(rct_window *w) */ static void window_staff_list_mouseup(rct_window *w, int widgetIndex) { - uint16 newStaffId; - switch (widgetIndex) { case WIDX_STAFF_LIST_CLOSE: window_close(w); break; case WIDX_STAFF_LIST_HIRE_BUTTON: - newStaffId = hire_new_staff_member(_windowStaffListSelectedTab); - - if (newStaffId == 0xFFFF) { - rct_window* window = window_find_by_class(WC_STAFF_LIST); - window_invalidate(window); - } else { - window_staff_open(&get_sprite(newStaffId)->peep); - } - + 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)) {