From 62bdd8a0ab99d2b8c475dedd6b606025d764b90b Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Tue, 9 Jun 2015 17:14:57 +0100 Subject: [PATCH 1/3] Fix options disabled_widgets There was a bug that caused the first widget on each page to appear disabled due to not being reset when changing page / invalidating. Fixes #1275 --- src/windows/options.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/windows/options.c b/src/windows/options.c index 25c2c85a19..676ea86fa2 100644 --- a/src/windows/options.c +++ b/src/windows/options.c @@ -966,6 +966,7 @@ static void window_options_invalidate() window_init_scroll_widgets(w); } window_options_set_pressed_tab(w); + w->disabled_widgets = 0; switch (w->page) { case WINDOW_OPTIONS_PAGE_DISPLAY: From 5184564e84d46e00aa0354c258dea0499a205f57 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Tue, 9 Jun 2015 17:35:16 +0100 Subject: [PATCH 2/3] Fixed crash when entrance/exits have been moved by 8cars Code defaults to 0 direction if the entrance/exit was not found. Fixes #1258. --- src/peep/peep.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/peep/peep.c b/src/peep/peep.c index 6bd095f73c..af548a298f 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -911,10 +911,11 @@ static void peep_go_to_ride_entrance(rct_peep* peep, rct_ride* ride){ int x = ride->entrances[peep->current_ride_station] & 0xFF; int y = ride->entrances[peep->current_ride_station] >> 8; int z = ride->station_heights[peep->current_ride_station]; - + rct_map_element* map_element = ride_get_station_exit_element(ride, x, y, z); - uint8 direction = map_element->type & MAP_ELEMENT_DIRECTION_MASK; + uint8 direction = !map_element ? 0 : map_element->type & MAP_ELEMENT_DIRECTION_MASK; + x *= 32; y *= 32; x += 16; @@ -1234,7 +1235,7 @@ void peep_update_ride_sub_state_1(rct_peep* peep){ rct_map_element* map_element = ride_get_station_exit_element(ride, x, y, z); - uint8 direction_entrance = map_element->type & MAP_ELEMENT_DIRECTION_MASK; + uint8 direction_entrance = !map_element ? 0 : map_element->type & MAP_ELEMENT_DIRECTION_MASK; x = ride->station_starts[peep->current_ride_station] & 0xFF; y = ride->station_starts[peep->current_ride_station] >> 8; @@ -1414,7 +1415,7 @@ static void peep_update_ride_sub_state_2_rejoin_queue(rct_peep* peep, rct_ride* rct_map_element* map_element = ride_get_station_exit_element(ride, x, y, z); - uint8 direction_entrance = map_element->type & MAP_ELEMENT_DIRECTION_MASK; + uint8 direction_entrance = !map_element ? 0 : map_element->type & MAP_ELEMENT_DIRECTION_MASK; x *= 32; y *= 32; From 322d45a5dd16042559b4e252c96395f5b8a1a97b Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Tue, 9 Jun 2015 18:16:27 +0100 Subject: [PATCH 3/3] Prevent invalid sprite coordinates from breaking sprite list. Fixes @Gymnasiast 's issues in sandbox --- src/world/sprite.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/world/sprite.c b/src/world/sprite.c index fb253b5745..ede41f10d8 100644 --- a/src/world/sprite.c +++ b/src/world/sprite.c @@ -827,6 +827,9 @@ void sprite_misc_update_all() * dx: z */ void sprite_move(sint16 x, sint16 y, sint16 z, rct_sprite* sprite){ + if (x < 0 || y < 0 || x > 0x1FFF || y > 0x1FFF) + x = 0x8000; + int new_position = x; if (x == (sint16)0x8000)new_position = 0x10000; else{