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

Add plugin API for showing an error message (#11706)

This commit is contained in:
Ted John
2020-05-10 18:06:31 +01:00
committed by GitHub
parent 5288caec02
commit ec06a9ca4b
2 changed files with 13 additions and 0 deletions

View File

@@ -945,6 +945,13 @@ declare global {
closeWindows(classification: string, id?: number): void;
closeAllWindows(): void;
/**
* Show a red error box.
* @param title The title / first line of the box.
* @param message The message / second line of the box.
*/
showError(title: string, message: string): void;
/**
* Shows a text input prompt and calls the given callback when entered.
* @param desc The parameters for the text input window.

View File

@@ -181,6 +181,11 @@ namespace OpenRCT2::Scripting
return {};
}
void showError(const std::string& title, const std::string& message)
{
window_error_open(title, message);
}
void showTextInput(const DukValue& desc)
{
try
@@ -230,6 +235,7 @@ namespace OpenRCT2::Scripting
dukglue_register_method(ctx, &ScUi::closeWindows, "closeWindows");
dukglue_register_method(ctx, &ScUi::closeAllWindows, "closeAllWindows");
dukglue_register_method(ctx, &ScUi::getWindow, "getWindow");
dukglue_register_method(ctx, &ScUi::showError, "showError");
dukglue_register_method(ctx, &ScUi::showTextInput, "showTextInput");
dukglue_register_method(ctx, &ScUi::activateTool, "activateTool");
dukglue_register_method(ctx, &ScUi::registerMenuItem, "registerMenuItem");