mirror of https://github.com/OpenRCT2/OpenRCT2.git
fix pickup commands to work with hiring staff
This commit is contained in:
parent
db3aa2b656
commit
541ae91d67
|
@ -1228,7 +1228,7 @@ void Network::RemoveClient(std::unique_ptr<NetworkConnection>& connection)
|
|||
rct_peep* pickup_peep = network_get_pickup_peep(connection_player->id);
|
||||
if(pickup_peep) {
|
||||
game_command_playerid = connection_player->id;
|
||||
game_do_command(0, GAME_COMMAND_FLAG_APPLY, 1, 0, pickup_peep->type == PEEP_TYPE_GUEST ? GAME_COMMAND_PICKUP_GUEST : GAME_COMMAND_PICKUP_STAFF, 0, 0);
|
||||
game_do_command(0, GAME_COMMAND_FLAG_APPLY, 1, 0, pickup_peep->type == PEEP_TYPE_GUEST ? GAME_COMMAND_PICKUP_GUEST : GAME_COMMAND_PICKUP_STAFF, network_get_pickup_peep_old_x(connection_player->id), 0);
|
||||
}
|
||||
gNetwork.Server_Send_EVENT_PLAYER_DISCONNECTED((char*)connection_player->name.c_str(), connection->GetLastDisconnectReason());
|
||||
}
|
||||
|
|
|
@ -1868,7 +1868,7 @@ void peep_pickup_abort(rct_peep* peep, int old_x)
|
|||
|
||||
if (peep->x != (sint16)SPRITE_LOCATION_NULL){
|
||||
peep_decrement_num_riders(peep);
|
||||
peep->state = 0;
|
||||
peep->state = PEEP_STATE_FALLING;
|
||||
peep_window_state_update(peep);
|
||||
peep->action = 0xFF;
|
||||
peep->special_sprite = 0;
|
||||
|
@ -1945,10 +1945,9 @@ bool peep_pickup_place(rct_peep* peep, int x, int y, bool apply)
|
|||
|
||||
bool peep_pickup_command(int peepnum, int x, int y, int action, bool apply)
|
||||
{
|
||||
rct_peep* peep;
|
||||
rct_peep* peep = GET_PEEP(peepnum);
|
||||
switch (action) {
|
||||
case 0: // pickup
|
||||
peep = GET_PEEP(peepnum);
|
||||
if (!peep) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1960,19 +1959,22 @@ bool peep_pickup_command(int peepnum, int x, int y, int action, bool apply)
|
|||
return false;
|
||||
}
|
||||
if (apply) {
|
||||
peep_pickup(peep);
|
||||
network_set_pickup_peep(game_command_playerid, peep);
|
||||
network_set_pickup_peep_old_x(game_command_playerid, peep->x);
|
||||
peep_pickup(peep);
|
||||
}
|
||||
break;
|
||||
case 1: // cancel
|
||||
if (apply) {
|
||||
peep_pickup_abort(network_get_pickup_peep(game_command_playerid), network_get_pickup_peep_old_x(game_command_playerid));
|
||||
peep_pickup_abort(network_get_pickup_peep(game_command_playerid), x);
|
||||
network_set_pickup_peep(game_command_playerid, 0);
|
||||
}
|
||||
break;
|
||||
case 2: // place
|
||||
if (!peep_pickup_place(network_get_pickup_peep(game_command_playerid), x, y, apply)) {
|
||||
if (network_get_pickup_peep(game_command_playerid) != peep) {
|
||||
return false;
|
||||
}
|
||||
if (!peep_pickup_place(peep, x, y, apply)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -269,7 +269,8 @@ static money32 staff_hire_new_staff_member(uint8 staff_type, uint8 flags, sint16
|
|||
newPeep->sprite_height_negative = spriteBounds->sprite_height_negative;
|
||||
newPeep->sprite_height_positive = spriteBounds->sprite_height_positive;
|
||||
|
||||
if (gConfigGeneral.auto_staff_placement != ((SDL_GetModState() & KMOD_SHIFT) != 0)) {
|
||||
// gConfigGeneral.auto_staff_placement is client specific so we need to force this
|
||||
if (network_get_mode() == NETWORK_MODE_NONE && gConfigGeneral.auto_staff_placement != ((SDL_GetModState() & KMOD_SHIFT) != 0)) {
|
||||
staff_autoposition_new_staff_member(newPeep);
|
||||
} else {
|
||||
newPeep->state = PEEP_STATE_PICKED;
|
||||
|
|
|
@ -601,11 +601,6 @@ void game_command_callback_pickup_guest(int eax, int ebx, int ecx, int edx, int
|
|||
if (w) {
|
||||
tool_set(w, WIDX_PICKUP, 7);
|
||||
}
|
||||
else
|
||||
{
|
||||
tool_cancel();
|
||||
gPickupPeepImage = UINT32_MAX;
|
||||
}
|
||||
}break;
|
||||
case 2:
|
||||
if (ebx == 0) {
|
||||
|
@ -640,6 +635,7 @@ void window_guest_overview_mouse_up(rct_window *w, int widgetIndex)
|
|||
if (!peep_can_be_picked_up(peep)) {
|
||||
return;
|
||||
}
|
||||
w->picked_peep_old_x = peep->x;
|
||||
game_command_callback = game_command_callback_pickup_guest;
|
||||
game_do_command(w->number, GAME_COMMAND_FLAG_APPLY, 0, 0, GAME_COMMAND_PICKUP_GUEST, 0, 0);
|
||||
break;
|
||||
|
@ -1218,7 +1214,7 @@ void window_guest_overview_tool_down(rct_window* w, int widgetIndex, int x, int
|
|||
return;
|
||||
|
||||
game_command_callback = game_command_callback_pickup_guest;
|
||||
game_do_command(0, GAME_COMMAND_FLAG_APPLY, 2, 0, GAME_COMMAND_PICKUP_GUEST, x, y);
|
||||
game_do_command(w->number, GAME_COMMAND_FLAG_APPLY, 2, 0, GAME_COMMAND_PICKUP_GUEST, x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1230,7 +1226,7 @@ void window_guest_overview_tool_abort(rct_window *w, int widgetIndex)
|
|||
if (widgetIndex != WIDX_PICKUP)
|
||||
return;
|
||||
|
||||
game_do_command(0, GAME_COMMAND_FLAG_APPLY, 1, 0, GAME_COMMAND_PICKUP_GUEST, 0, 0);
|
||||
game_do_command(w->number, GAME_COMMAND_FLAG_APPLY, 1, 0, GAME_COMMAND_PICKUP_GUEST, w->picked_peep_old_x, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -442,11 +442,6 @@ void game_command_callback_pickup_staff(int eax, int ebx, int ecx, int edx, int
|
|||
if (w) {
|
||||
tool_set(w, WIDX_PICKUP, 7);
|
||||
}
|
||||
else
|
||||
{
|
||||
tool_cancel();
|
||||
gPickupPeepImage = UINT32_MAX;
|
||||
}
|
||||
}break;
|
||||
case 2:
|
||||
if (ebx == 0) {
|
||||
|
@ -478,8 +473,15 @@ void window_staff_overview_mouseup(rct_window *w, int widgetIndex)
|
|||
window_scroll_to_viewport(w);
|
||||
break;
|
||||
case WIDX_PICKUP:
|
||||
{
|
||||
// this is called in callback when hiring staff, setting nestlevel to 0 so that command is sent separately
|
||||
int oldNestLevel = gGameCommandNestLevel;
|
||||
gGameCommandNestLevel = 0;
|
||||
game_command_callback = game_command_callback_pickup_staff;
|
||||
w->picked_peep_old_x = peep->x;
|
||||
game_do_command(w->number, GAME_COMMAND_FLAG_APPLY, 0, 0, GAME_COMMAND_PICKUP_STAFF, 0, 0);
|
||||
gGameCommandNestLevel = oldNestLevel;
|
||||
}
|
||||
break;
|
||||
case WIDX_FIRE:
|
||||
window_staff_fire_prompt_open(peep);
|
||||
|
@ -1157,7 +1159,7 @@ void window_staff_overview_tool_down(rct_window* w, int widgetIndex, int x, int
|
|||
{
|
||||
if (widgetIndex == WIDX_PICKUP) {
|
||||
game_command_callback = game_command_callback_pickup_staff;
|
||||
game_do_command(0, GAME_COMMAND_FLAG_APPLY, 2, 0, GAME_COMMAND_PICKUP_STAFF, x, y);
|
||||
game_do_command(w->number, GAME_COMMAND_FLAG_APPLY, 2, 0, GAME_COMMAND_PICKUP_STAFF, x, y);
|
||||
}
|
||||
else if (widgetIndex == WIDX_PATROL){
|
||||
int dest_x, dest_y;
|
||||
|
@ -1176,7 +1178,7 @@ void window_staff_overview_tool_down(rct_window* w, int widgetIndex, int x, int
|
|||
void window_staff_overview_tool_abort(rct_window *w, int widgetIndex)
|
||||
{
|
||||
if (widgetIndex == WIDX_PICKUP) {
|
||||
game_do_command(w->number, GAME_COMMAND_FLAG_APPLY, 1, w->picked_peep_old_x, GAME_COMMAND_PICKUP_STAFF, 0, 0);
|
||||
game_do_command(w->number, GAME_COMMAND_FLAG_APPLY, 1, 0, GAME_COMMAND_PICKUP_STAFF, w->picked_peep_old_x, 0);
|
||||
}
|
||||
else if (widgetIndex == WIDX_PATROL){
|
||||
hide_gridlines();
|
||||
|
|
Loading…
Reference in New Issue