mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-22 06:23:04 +01:00
Merge pull request #2218 from duncanspumpkin/corrupt
Corrupt Element Inserter
This commit is contained in:
@@ -3902,6 +3902,8 @@ STR_5560 :{SMALLFONT}{BLACK}Sets the inspection time to 'Every 10 minutes' on
|
||||
STR_5561 :Failed to load language file
|
||||
STR_5562 :WARNING!
|
||||
STR_5563 :This feature is currently unstable, take extra caution.
|
||||
STR_5564 :Insert Corrupt Element
|
||||
STR_5565 :{SMALLFONT}{BLACK}Inserts a corrupt map element at top of tile. This will hide any element above the corrupt element.
|
||||
|
||||
#####################
|
||||
# Rides/attractions #
|
||||
|
||||
@@ -2151,6 +2151,9 @@ enum {
|
||||
STR_WARNING_IN_CAPS = 5562,
|
||||
STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE = 5563,
|
||||
|
||||
STR_INSERT_CORRUPT = 5564,
|
||||
STR_INSERT_CORRUPT_TIP = 5565,
|
||||
|
||||
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
|
||||
STR_COUNT = 32768
|
||||
};
|
||||
|
||||
@@ -1184,7 +1184,7 @@ void window_guest_overview_tool_down(rct_window* w, int widgetIndex, int x, int
|
||||
window_error_open(0x785,-1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!map_can_construct_at(tile_x, tile_y, dest_z / 8, (dest_z / 8) + 1, 15)){
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) != 0x3A5 ){
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) != 0x49B){
|
||||
|
||||
@@ -31,6 +31,7 @@ enum WINDOW_TILE_INSPECTOR_WIDGET_IDX {
|
||||
WIDX_BACKGROUND,
|
||||
WIDX_TITLE,
|
||||
WIDX_CLOSE,
|
||||
WIDX_CORRUPT,
|
||||
WIDX_CONTENT_PANEL,
|
||||
WIDX_SCROLL
|
||||
};
|
||||
@@ -44,6 +45,7 @@ rct_widget window_tile_inspector_widgets[] = {
|
||||
{ WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, 0x0FFFFFFFF, STR_NONE }, // panel / background
|
||||
{ WWT_CAPTION, 0, 1, WW - 2, 1, 14, STR_TILE_INSPECTOR_TITLE, STR_WINDOW_TITLE_TIP }, // title bar
|
||||
{ WWT_CLOSEBOX, 0, WW - 13, WW - 3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // close x button
|
||||
{ WWT_CLOSEBOX, 1, WW - 150, WW - 3, 18, 39, STR_INSERT_CORRUPT, STR_INSERT_CORRUPT_TIP },
|
||||
{ WWT_RESIZE, 1, 0, WW - 1, 43, WH - 1, 0x0FFFFFFFF, STR_NONE }, // content panel
|
||||
{ WWT_SCROLL, 1, 3, WW - 3, 65, WH - 30, 2, STR_NONE }, // scroll area
|
||||
{ WIDGETS_END },
|
||||
@@ -116,6 +118,7 @@ void window_tile_inspector_open()
|
||||
);
|
||||
window->widgets = window_tile_inspector_widgets;
|
||||
window->enabled_widgets = (1 << WIDX_CLOSE);
|
||||
window->disabled_widgets = (1 << WIDX_CORRUPT);
|
||||
|
||||
window_init_scroll_widgets(window);
|
||||
window->colours[0] = 7;
|
||||
@@ -137,12 +140,29 @@ static void window_tile_inspector_close(rct_window *w)
|
||||
tool_cancel();
|
||||
}
|
||||
|
||||
void corrupt_element(int x, int y) {
|
||||
rct_map_element* mapElement;
|
||||
mapElement = map_get_first_element_at(x, y);
|
||||
|
||||
while (!map_element_is_last_for_tile(mapElement++));
|
||||
mapElement--;
|
||||
|
||||
mapElement = map_element_insert(x, y, mapElement->base_height, 0);
|
||||
mapElement->type = (8 << 2);
|
||||
}
|
||||
|
||||
static void window_tile_inspector_mouseup(rct_window *w, int widgetIndex)
|
||||
{
|
||||
switch (widgetIndex) {
|
||||
case WIDX_CLOSE:
|
||||
window_close(w);
|
||||
break;
|
||||
case WIDX_CORRUPT:
|
||||
corrupt_element(window_tile_inspector_tile_x, window_tile_inspector_tile_y);
|
||||
window_tile_inspector_item_count++;
|
||||
w->scrolls[0].v_top = 0;
|
||||
window_invalidate(w);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,6 +229,9 @@ static void window_tile_inspector_tool_down(rct_window* w, int widgetIndex, int
|
||||
|
||||
window_tile_inspector_item_count = numItems;
|
||||
|
||||
w->enabled_widgets |= (1 << WIDX_CORRUPT);
|
||||
w->disabled_widgets &= ~(1ULL << WIDX_CORRUPT);
|
||||
|
||||
w->scrolls[0].v_top = 0;
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user