mirror of https://github.com/OpenRCT2/OpenRCT2.git
fix #525, creating a ride crashes when footpath window is open
This commit is contained in:
parent
6fe1bace20
commit
268e7530c2
|
@ -490,7 +490,8 @@ void window_park_rating_open();
|
|||
void window_finances_open();
|
||||
void window_finances_research_open();
|
||||
void window_new_campaign_open(sint16 campaignType);
|
||||
void window_ride_main_open(int rideIndex);
|
||||
rct_window *window_ride_main_open(int rideIndex);
|
||||
void window_ride_construct(rct_window *w);
|
||||
void window_ride_list_open();
|
||||
void window_track_place_open();
|
||||
void window_new_ride_open();
|
||||
|
|
|
@ -432,11 +432,7 @@ rct_map_element *ride_find_track_gap(rct_map_element *startTrackElement, int *ou
|
|||
return (rct_map_element*)esi;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006B4800
|
||||
*/
|
||||
void ride_construct_new(ride_list_item listItem)
|
||||
int ride_create_ride(ride_list_item listItem)
|
||||
{
|
||||
int eax, ebx, ecx, edx, esi, edi, ebp;
|
||||
edx = *((uint16*)&listItem);
|
||||
|
@ -450,27 +446,29 @@ void ride_construct_new(ride_list_item listItem)
|
|||
|
||||
esi = GAME_COMMAND_6;
|
||||
game_do_command_p(esi, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
if (ebx == 0x80000000) {
|
||||
return;
|
||||
}
|
||||
return ebx == 0x80000000 ? -1 : edi;
|
||||
}
|
||||
|
||||
//Looks like edi became the ride index after the command.
|
||||
eax = edi;
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006B4800
|
||||
*/
|
||||
void ride_construct_new(ride_list_item listItem)
|
||||
{
|
||||
rct_window *w;
|
||||
int rideIndex;
|
||||
|
||||
//TODO: replace with window_ride_main_open(eax)
|
||||
// window_ride_main_open(eax);
|
||||
RCT2_CALLFUNC_X(0x006ACC28, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
window_get_register(w);
|
||||
rideIndex = ride_create_ride(listItem);
|
||||
if (rideIndex == -1)
|
||||
return;
|
||||
|
||||
ecx = w->classification;
|
||||
edx = 0x13;
|
||||
ebp = (int)w;
|
||||
//TODO: replace with window_ride_main_mouseup() after ride-window_merge
|
||||
// window_ride_main_mouseup();
|
||||
RCT2_CALLFUNC_X(0x006AF17E, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
rct_window *ride_window = window_find_by_id(w->classification, w->number); //class here
|
||||
window_close(ride_window);
|
||||
// Open construction window
|
||||
// HACK In the original game this created a mouse up event. This has been
|
||||
// replaced with a direct call to the function that gets called.
|
||||
// Eventually should be changed so the ride window does not need to be opened.
|
||||
w = window_ride_main_open(rideIndex);
|
||||
window_ride_construct(w);
|
||||
window_close_by_id(WC_RIDE, rideIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1142,7 +1142,7 @@ rct_window *window_ride_open(int rideIndex)
|
|||
*
|
||||
* rct2: 0x006ACC28
|
||||
*/
|
||||
void window_ride_main_open(int rideIndex)
|
||||
rct_window *window_ride_main_open(int rideIndex)
|
||||
{
|
||||
rct_window *w;
|
||||
|
||||
|
@ -1173,6 +1173,8 @@ void window_ride_main_open(int rideIndex)
|
|||
window_init_scroll_widgets(w);
|
||||
w->ride.view = 0;
|
||||
window_ride_init_viewport(w);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1365,7 +1367,7 @@ static void window_ride_init_viewport(rct_window *w)
|
|||
*
|
||||
* rct2: 0x006B4971
|
||||
*/
|
||||
static void window_ride_construct(rct_window *w)
|
||||
void window_ride_construct(rct_window *w)
|
||||
{
|
||||
int rideIndex = w->number;
|
||||
|
||||
|
|
Loading…
Reference in New Issue