From 5e3df2241423109ac637dc6c13f5be4e84bc6e87 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Sun, 28 Jun 2015 13:31:46 +0100 Subject: [PATCH] Implemented map element remove. Small tidy of functions in game.c. --- src/game.c | 4 ++-- src/world/map.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/game.c b/src/game.c index cfd8ba82b1..d5b3ddfe3d 100644 --- a/src/game.c +++ b/src/game.c @@ -870,7 +870,7 @@ void rct2_exit_reason(rct_string_id title, rct_string_id body){ */ void rct2_exit() { - RCT2_CALLPROC_EBPSAFE(0x006E3879); + audio_close(); //Post quit message does not work in 0x6e3879 as its windows only. openrct2_finish(); } @@ -892,7 +892,7 @@ void game_load_or_quit_no_save_prompt() game_do_command(0, 1, 0, 1, GAME_COMMAND_LOAD_OR_QUIT, 0, 0); tool_cancel(); if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_5) { - RCT2_CALLPROC_EBPSAFE(0x0040705E); + // RCT2_CALLPROC_EBPSAFE(0x0040705E); Function not required resets cursor position. RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) &= ~INPUT_FLAG_5; } gGameSpeed = 1; diff --git a/src/world/map.c b/src/world/map.c index 602be3f4ee..4fa4596e64 100644 --- a/src/world/map.c +++ b/src/world/map.c @@ -2637,7 +2637,17 @@ int map_get_station(rct_map_element *mapElement) */ void map_element_remove(rct_map_element *mapElement) { - RCT2_CALLPROC_X(0x0068B280, 0, 0, 0, 0, (int)mapElement, 0, 0); + if (!map_element_is_last_for_tile(mapElement)){ + do{ + *mapElement = *(mapElement + 1); + } while (!map_element_is_last_for_tile(++mapElement)); + } + (mapElement - 1)->flags |= MAP_ELEMENT_FLAG_LAST_TILE; + mapElement->base_height = 0xFF; + + if ((mapElement + 1) == RCT2_GLOBAL(0x00140E9A4, rct_map_element*)){ + RCT2_GLOBAL(0x00140E9A4, rct_map_element*)--; + } } /**