fix invalid park stats information when paused, fixes #957

This commit is contained in:
IntelOrca 2015-03-25 11:14:31 +00:00
parent e68dfb652a
commit c6c796ab06
3 changed files with 31 additions and 25 deletions

View File

@ -128,27 +128,7 @@ rct_widget *window_get_scroll_widget(rct_window *w, int scrollIndex)
return NULL;
}
static void RCT2_CALLPROC_WE_UPDATE(int address, rct_window* w)
{
#ifdef _MSC_VER
__asm {
push address
push w
mov esi, w
call[esp + 4]
add esp, 8
}
#else
__asm__ ( "\
push %[address]\n\
mov eax, %[w] \n\
push eax \n\
mov esi, %[w] \n\
call [esp+4] \n\
add esp, 8 \n\
" : [address] "+m" (address), [w] "+m" (w) : : "eax", "esi" );
#endif
}
/**
*
* rct2: 0x006ED7B0
@ -160,7 +140,7 @@ void window_dispatch_update_all()
RCT2_GLOBAL(0x01423604, sint32)++;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_NOT_SHOWN_TICKS, sint16)++;
for (w = RCT2_LAST_WINDOW; w >= g_window_list; w--)
RCT2_CALLPROC_WE_UPDATE(w->event_handlers[WE_UPDATE], w);
window_event_update_call(w);
RCT2_CALLPROC_EBPSAFE(0x006EE411); // handle_text_input
}
@ -1691,6 +1671,30 @@ void window_event_invalidate_call(rct_window* w)
RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0);
}
void window_event_update_call(rct_window *w)
{
int address = w->event_handlers[WE_UPDATE];
#ifdef _MSC_VER
__asm {
push address
push w
mov esi, w
call[esp + 4]
add esp, 8
}
#else
__asm__ ( "\
push %[address]\n\
mov eax, %[w] \n\
push eax \n\
mov esi, %[w] \n\
call [esp+4] \n\
add esp, 8 \n\
" : [address] "+m" (address), [w] "+m" (w) : : "eax", "esi" );
#endif
}
/**
* rct2: New function not from rct2
* Bubbles an item one position up in the window list.

View File

@ -579,6 +579,7 @@ void window_event_mouse_up_call(rct_window* w, int widgetIndex);
void window_event_resize_call(rct_window* w);
void window_event_mouse_down_call(rct_window* w, int widgetIndex);
void window_event_invalidate_call(rct_window* w);
void window_event_update_call(rct_window *w);
void sub_6EA73F();

View File

@ -1568,7 +1568,7 @@ static void window_park_stats_paint()
y += 10;
// Draw number of rides / attractions
if (w->list_information_type != -1) {
if (w->list_information_type != (uint16)-1) {
RCT2_GLOBAL(0x013CE952, uint32) = w->list_information_type;
gfx_draw_string_left(dpi, STR_NUMBER_OF_RIDES_LABEL, (void*)0x013CE952, 0, x, y);
}
@ -1941,8 +1941,9 @@ static void window_park_set_page(rct_window *w, int page)
window_park_set_disabled_tabs(w);
window_invalidate(w);
RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], 0, 0, 0, 0, (int)w, 0, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0);
window_event_resize_call(w);
window_event_invalidate_call(w);
window_event_update_call(w);
if (listen != 0 && w->viewport != NULL)
w->viewport->flags |= VIEWPORT_FLAG_SOUND_ON;
}