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

Move object load error window to UI module

This commit is contained in:
Marijn van der Werf
2017-10-23 00:44:55 +02:00
parent 59df233669
commit 666809fb8b
6 changed files with 23 additions and 10 deletions

View File

@@ -211,6 +211,13 @@ public:
close_callback callback = intent->GetCloseCallbackExtra(INTENT_EXTRA_CALLBACK);
return window_network_status_open(message.c_str(), callback);
}
case WC_OBJECT_LOAD_ERROR:
{
std::string path = intent->GetStringExtra(INTENT_EXTRA_PATH);
const rct_object_entry * objects = (rct_object_entry *) intent->GetPointerExtra(INTENT_EXTRA_LIST);
size_t count = intent->GetUIntExtra(INTENT_EXTRA_LIST_COUNT);
window_object_load_error_open(const_cast<utf8 *>(path.c_str()), count, objects);
}
case WC_RIDE:
return window_ride_main_open(intent->GetSIntExtra(INTENT_EXTRA_RIDE_ID));
case WC_TRACK_DESIGN_PLACE:

View File

@@ -14,12 +14,13 @@
*****************************************************************************/
#pragma endregion
#include "../object/ObjectManager.h"
#include "../core/Memory.hpp"
#include <openrct2-ui/windows/Window.h>
#include "../interface/widget.h"
#include "../localisation/localisation.h"
#include "../platform/platform.h"
#include <openrct2/core/Memory.hpp>
#include <openrct2/interface/widget.h>
#include <openrct2/localisation/localisation.h>
#include <openrct2/object/ObjectManager.h>
#include <openrct2/platform/platform.h>
enum WINDOW_OBJECT_LOAD_ERROR_WIDGET_IDX {
WIDX_BACKGROUND,

View File

@@ -129,3 +129,5 @@ void window_network_status_close();
void window_text_input_key(rct_window * w, char keychar);
void window_text_input_open(rct_window * call_w, rct_widgetindex call_widget, rct_string_id title, rct_string_id description, rct_string_id existing_text, uintptr_t existing_args, sint32 maxLength);
void window_text_input_raw_open(rct_window * call_w, rct_widgetindex call_widget, rct_string_id title, rct_string_id description, utf8string existing_text, sint32 maxLength);
rct_window * window_object_load_error_open(utf8 * path, size_t numMissingObjects, const rct_object_entry * missingObjects);

View File

@@ -1148,9 +1148,12 @@ void handle_park_load_failure_with_title_opt(const ParkLoadResult * result, cons
}
// The path needs to be duplicated as it's a const here
// which the window function doesn't like
window_object_load_error_open(strndup(path, strnlen(path, MAX_PATH)),
ParkLoadResult_GetMissingObjectsCount(result),
ParkLoadResult_GetMissingObjects(result));
Intent * intent = intent_create(WC_OBJECT_LOAD_ERROR);
intent_set_string(intent, INTENT_EXTRA_PATH, strndup(path, strnlen(path, MAX_PATH)));
intent_set_pointer(intent, INTENT_EXTRA_LIST, (void *) ParkLoadResult_GetMissingObjects(result));
intent_set_uint(intent, INTENT_EXTRA_LIST_COUNT, (uint32) ParkLoadResult_GetMissingObjectsCount(result));
context_open_intent(intent);
intent_release(intent);
}
else if (ParkLoadResult_GetError(result) == PARK_LOAD_ERROR_UNSUPPORTED_RCTC_FLAG)
{

View File

@@ -726,8 +726,6 @@ void window_scenery_open();
void window_tile_inspector_open();
void window_tile_inspector_clear_clipboard();
rct_window * window_object_load_error_open(utf8 * path, size_t numMissingObjects, const rct_object_entry * missingObjects);
rct_window * window_editor_main_open();
void window_editor_bottom_toolbar_open();
void window_editor_object_selection_open();

View File

@@ -66,6 +66,8 @@ extern "C" {
INTENT_EXTRA_TILE_ELEMENT,
INTENT_EXTRA_VEHICLE,
INTENT_EXTRA_MESSAGE,
INTENT_EXTRA_LIST,
INTENT_EXTRA_LIST_COUNT,
};
enum {