Codechange: Use SQInteger for generic numbers in script_window

This commit is contained in:
glx22
2023-03-04 23:03:24 +01:00
committed by Loïc Guilloux
parent f752d96125
commit ca149447d7
2 changed files with 21 additions and 9 deletions

View File

@@ -15,7 +15,7 @@
${INCLUDES}
/**
* Class that handles window interaction. A Window in OpenTTD has two imporant
* Class that handles window interaction. A Window in OpenTTD has two important
* values. The WindowClass, and a Window number. The first indicates roughly
* which window it is. WC_TOWN_VIEW for example, is the view of a town.
* The Window number is a bit more complex, as it depends mostly on the
@@ -67,45 +67,49 @@ public:
* Special number values.
*/
enum NumberType {
NUMBER_ALL = 0xFFFFFFFF, ///< Value to select all windows of a class.
NUMBER_ALL = -1, ///< Value to select all windows of a class.
};
/**
* Special widget values.
*/
enum WidgetType {
WIDGET_ALL = 0xFF, ///< Value to select all widgets of a window.
WIDGET_ALL = -1, ///< Value to select all widgets of a window.
};
/**
* Close a window.
* @param window The class of the window to close.
* @param number The number of the window to close, or NUMBER_ALL to close all of this class.
* The value will be clamped to 0 .. MAX(int32) when value is not NUMBER_ALL.
* @pre !ScriptGame::IsMultiplayer().
*/
static void Close(WindowClass window, uint32 number);
static void Close(WindowClass window, SQInteger number);
/**
* Check if a window is open.
* @param window The class of the window to check for.
* @param number The number of the window to check for, or NUMBER_ALL to check for any in the class.
* The value will be clamped to 0 .. MAX(int32) when value is not NUMBER_ALL.
* @pre !ScriptGame::IsMultiplayer().
* @return True if the window is open.
*/
static bool IsOpen(WindowClass window, uint32 number);
static bool IsOpen(WindowClass window, SQInteger number);
/**
* Highlight a widget in a window.
* @param window The class of the window to highlight a widget in.
* @param number The number of the window to highlight a widget in.
* The value will be clamped to 0 .. MAX(int32) when value is not NUMBER_ALL.
* @param widget The widget in the window to highlight, or WIDGET_ALL (in combination with TC_INVALID) to disable all widget highlighting on this window.
* The value will be clamped to 0 .. MAX(uint8) when value is not WIDGET_ALL.
* @param colour The colour of the highlight, or TC_INVALID for disabling.
* @pre !ScriptGame::IsMultiplayer().
* @pre number != NUMBER_ALL.
* @pre colour < TC_END || (widget == WIDGET_ALL && colour == TC_INVALID).
* @pre IsOpen(window, number).
*/
static void Highlight(WindowClass window, uint32 number, uint8 widget, TextColour colour);
static void Highlight(WindowClass window, SQInteger number, SQInteger widget, TextColour colour);
// @enum .*Widgets ../../widgets/*_widget.h@ENUM_WIDGETS@
// @endenum