mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix #1943: Placing Handyman/Security Guard/Mechanic In Multiplayer Causes Crash
Open staff window on multiplayer clients when hiring new staff instead of a random visitor.
This commit is contained in:
parent
b0aabbf748
commit
ec8d37eead
|
@ -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;
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)) {
|
||||
|
|
Loading…
Reference in New Issue