1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 08:12:53 +01:00

Add button to reload object

This commit is contained in:
Michael Steenbeek
2024-02-11 21:45:31 +01:00
committed by GitHub
parent 6626208695
commit 70b9d0ca47
5 changed files with 27 additions and 2 deletions

View File

@@ -3715,6 +3715,7 @@ STR_6609 :Track block not found
STR_6610 :Path element not found
STR_6611 :Wall element not found
STR_6612 :Banner element not found
STR_6613 :Reload object
#############
# Scenarios #

View File

@@ -1,5 +1,6 @@
0.4.9 (in development)
------------------------------------------------------------------------
- Feature: [#21376] Add option to reload an object (for object developers).
- Improved: [#21356] Resize the title bar when moving between displays with different scaling factors on Windows systems.
- Fix: [#18963] Research table in parks from Loopy Landscapes is imported incorrectly.
- Fix: [#20907] RCT1/AA scenarios use the 4-across train for the Inverted Roller Coaster.

View File

@@ -183,6 +183,7 @@ enum WINDOW_EDITOR_OBJECT_SELECTION_WIDGET_IDX
WIDX_FILTER_RIDE_TAB_STALL,
WIDX_LIST_SORT_TYPE,
WIDX_LIST_SORT_RIDE,
WIDX_RELOAD_OBJECT,
WIDX_TAB_1,
};
@@ -211,7 +212,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
MakeTab ({189, 47}, STR_SHOPS_STALLS_TIP ),
MakeWidget({ 4, 80}, {145, 14}, WindowWidgetType::TableHeader, WindowColour::Secondary ),
MakeWidget({149, 80}, {143, 14}, WindowWidgetType::TableHeader, WindowColour::Secondary ),
MakeWidget({700, 50}, { 24, 24}, WindowWidgetType::ImgBtn, WindowColour::Primary, SPR_G2_RELOAD, STR_RELOAD_OBJECT_TIP ),
MakeTab ({ 3, 17}, STR_STRING_DEFINED_TOOLTIP ),
// Copied object type times...
@@ -449,6 +450,19 @@ public:
}
VisibleListRefresh();
break;
case WIDX_RELOAD_OBJECT:
if (_loadedObject != nullptr)
{
auto descriptor = _loadedObject->GetDescriptor();
auto& objectManager = OpenRCT2::GetContext()->GetObjectManager();
auto entryIndex = objectManager.GetLoadedObjectEntryIndex(descriptor);
if (entryIndex != OBJECT_ENTRY_INDEX_NULL)
{
objectManager.UnloadObjects({ descriptor });
objectManager.LoadObject(descriptor, entryIndex);
}
}
break;
default:
if (widgetIndex >= WIDX_TAB_1
&& static_cast<size_t>(widgetIndex) < WIDX_TAB_1 + std::size(ObjectSelectionPages))
@@ -833,6 +847,8 @@ public:
widgets[WIDX_INSTALL_TRACK].right = width - 9;
widgets[WIDX_FILTER_DROPDOWN].left = width - 250;
widgets[WIDX_FILTER_DROPDOWN].right = width - 137;
widgets[WIDX_RELOAD_OBJECT].left = width - 9 - 24;
widgets[WIDX_RELOAD_OBJECT].right = width - 9;
// Set pressed widgets
pressed_widgets |= 1uLL << WIDX_PREVIEW;
@@ -883,6 +899,11 @@ public:
}
}
if (gConfigGeneral.DebuggingTools)
widgets[WIDX_RELOAD_OBJECT].type = WindowWidgetType::ImgBtn;
else
widgets[WIDX_RELOAD_OBJECT].type = WindowWidgetType::Empty;
if (gScreenFlags & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TRACK_DESIGNER))
{
widgets[WIDX_ADVANCED].type = WindowWidgetType::Empty;

View File

@@ -359,7 +359,7 @@ enum WindowDetail
#define WC_TRACK_DESIGN_LIST__WIDX_ROTATE 8
#define WC_TRACK_DESIGN_PLACE__WIDX_ROTATE 3
#define WC_MAP__WIDX_ROTATE_90 24
#define WC_EDITOR_OBJECT_SELECTION__WIDX_TAB_1 21
#define WC_EDITOR_OBJECT_SELECTION__WIDX_TAB_1 22
#define WC_STAFF__WIDX_PICKUP 9
#define WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE 13
#define WC_TILE_INSPECTOR__WIDX_BUTTON_COPY 16

View File

@@ -4024,6 +4024,8 @@ enum : uint16_t
STR_ERR_WALL_ELEMENT_NOT_FOUND = 6611,
STR_ERR_BANNER_ELEMENT_NOT_FOUND = 6612,
STR_RELOAD_OBJECT_TIP = 6613,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
/* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings
};