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; 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: 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{