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_open();
|
||||||
void window_finances_research_open();
|
void window_finances_research_open();
|
||||||
void window_new_campaign_open(sint16 campaignType);
|
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_ride_list_open();
|
||||||
void window_track_place_open();
|
void window_track_place_open();
|
||||||
void window_new_ride_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;
|
return (rct_map_element*)esi;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
int ride_create_ride(ride_list_item listItem)
|
||||||
*
|
|
||||||
* rct2: 0x006B4800
|
|
||||||
*/
|
|
||||||
void ride_construct_new(ride_list_item listItem)
|
|
||||||
{
|
{
|
||||||
int eax, ebx, ecx, edx, esi, edi, ebp;
|
int eax, ebx, ecx, edx, esi, edi, ebp;
|
||||||
edx = *((uint16*)&listItem);
|
edx = *((uint16*)&listItem);
|
||||||
|
@ -450,27 +446,29 @@ void ride_construct_new(ride_list_item listItem)
|
||||||
|
|
||||||
esi = GAME_COMMAND_6;
|
esi = GAME_COMMAND_6;
|
||||||
game_do_command_p(esi, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
game_do_command_p(esi, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||||
if (ebx == 0x80000000) {
|
return ebx == 0x80000000 ? -1 : edi;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//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;
|
rct_window *w;
|
||||||
|
int rideIndex;
|
||||||
|
|
||||||
//TODO: replace with window_ride_main_open(eax)
|
rideIndex = ride_create_ride(listItem);
|
||||||
// window_ride_main_open(eax);
|
if (rideIndex == -1)
|
||||||
RCT2_CALLFUNC_X(0x006ACC28, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
return;
|
||||||
window_get_register(w);
|
|
||||||
|
|
||||||
ecx = w->classification;
|
// Open construction window
|
||||||
edx = 0x13;
|
// HACK In the original game this created a mouse up event. This has been
|
||||||
ebp = (int)w;
|
// replaced with a direct call to the function that gets called.
|
||||||
//TODO: replace with window_ride_main_mouseup() after ride-window_merge
|
// Eventually should be changed so the ride window does not need to be opened.
|
||||||
// window_ride_main_mouseup();
|
w = window_ride_main_open(rideIndex);
|
||||||
RCT2_CALLFUNC_X(0x006AF17E, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
window_ride_construct(w);
|
||||||
rct_window *ride_window = window_find_by_id(w->classification, w->number); //class here
|
window_close_by_id(WC_RIDE, rideIndex);
|
||||||
window_close(ride_window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1142,7 +1142,7 @@ rct_window *window_ride_open(int rideIndex)
|
||||||
*
|
*
|
||||||
* rct2: 0x006ACC28
|
* rct2: 0x006ACC28
|
||||||
*/
|
*/
|
||||||
void window_ride_main_open(int rideIndex)
|
rct_window *window_ride_main_open(int rideIndex)
|
||||||
{
|
{
|
||||||
rct_window *w;
|
rct_window *w;
|
||||||
|
|
||||||
|
@ -1173,6 +1173,8 @@ void window_ride_main_open(int rideIndex)
|
||||||
window_init_scroll_widgets(w);
|
window_init_scroll_widgets(w);
|
||||||
w->ride.view = 0;
|
w->ride.view = 0;
|
||||||
window_ride_init_viewport(w);
|
window_ride_init_viewport(w);
|
||||||
|
|
||||||
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1365,7 +1367,7 @@ static void window_ride_init_viewport(rct_window *w)
|
||||||
*
|
*
|
||||||
* rct2: 0x006B4971
|
* rct2: 0x006B4971
|
||||||
*/
|
*/
|
||||||
static void window_ride_construct(rct_window *w)
|
void window_ride_construct(rct_window *w)
|
||||||
{
|
{
|
||||||
int rideIndex = w->number;
|
int rideIndex = w->number;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue