From 8167c24526b1d357fb621c5dce66b49a5ec9101d Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Sun, 28 Jun 2015 13:53:24 +0100 Subject: [PATCH] Implemented sub_68B044 some sort of check to make sure there is space for new element. If there isn't then it will try reorganise the elements to make room. --- src/addresses.h | 1 + src/world/map.c | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/addresses.h b/src/addresses.h index 224a5966f4..c9311354d7 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -354,6 +354,7 @@ #define RCT2_ADDRESS_SCENARIO_SRAND_0 0x00F663B0 #define RCT2_ADDRESS_SCENARIO_SRAND_1 0x00F663B4 #define RCT2_ADDRESS_MAP_ELEMENTS 0x00F663B8 +#define RCT2_ADDRESS_MAP_ELEMENTS_END 0x010E53B8 #define RCT2_ADDRESS_SPRITE_LIST 0x010E63BC #define RCT2_ADDRESS_SPRITES_NEXT_INDEX 0x013573BC diff --git a/src/world/map.c b/src/world/map.c index 4fa4596e64..1f6fe730d6 100644 --- a/src/world/map.c +++ b/src/world/map.c @@ -2744,7 +2744,23 @@ void map_reorganise_elements() */ int sub_68B044() { - return (RCT2_CALLPROC_X(0x0068B044, 0, 0, 0, 0, 0, 0, 0) & 0x100) == 0; + if (RCT2_GLOBAL(0x00140E9A4, rct_map_element*) <= RCT2_ADDRESS(RCT2_ADDRESS_MAP_ELEMENTS_END, rct_map_element)) + return 1; + + for (int i = 1000; i != 0; --i) + sub_68B089(); + + if (RCT2_GLOBAL(0x00140E9A4, rct_map_element*) <= RCT2_ADDRESS(RCT2_ADDRESS_MAP_ELEMENTS_END, rct_map_element)) + return 1; + + map_reorganise_elements(); + + if (RCT2_GLOBAL(0x00140E9A4, rct_map_element*) <= RCT2_ADDRESS(RCT2_ADDRESS_MAP_ELEMENTS_END, rct_map_element)) + return 1; + else{ + RCT2_GLOBAL(0x00141E9AC, rct_string_id) = 894; + return 0; + } } /**