|
OpenTTD Source 20260421-master-gc2fbc6fdeb
|
Number to differentiate different windows of the same class. More...
#include <window_type.h>
Public Member Functions | |
| WindowNumber ()=default | |
| Create a WindowNumber 0. | |
| WindowNumber (int32_t value) | |
| Create a WindowNumber with the given value. | |
| WindowNumber (ConvertibleThroughBase auto value) | |
| Create a WindowNumber with the given value. | |
| template<typename T> | |
| WindowNumber (T value) | |
| Create a WindowNumber with the given value. | |
| operator int32_t () const | |
| Automatically convert to int32_t. | |
| template<typename T> | |
| operator T () const | |
| Automatically convert to any other type that might be requested. | |
| constexpr bool | operator== (const std::integral auto &rhs) const |
| Compare the right hand side against our window number. | |
| constexpr bool | operator== (const ConvertibleThroughBase auto &rhs) const |
| Compare the right hand side against our window number. | |
| template<typename T> | |
| constexpr bool | operator== (const T &rhs) const |
| Compare the right hand side against our window number. | |
Private Attributes | |
| int32_t | value = 0 |
| The identifier of the window. | |
Number to differentiate different windows of the same class.
This number generally implicitly passes some information, e.g. the TileIndex or Company associated with the window. To ease this use, the window number is lenient with what it accepts and broad with what it returns.
Anything that converts into a number and ConvertibleThroughBase types will be accepted. When it's being used it returns int32_t or any other type when that's specifically requested, e.g. VehicleType type = window_number or GetEngineListHeight(window_number) in which the returned value will be a VehicleType.
Definition at line 761 of file window_type.h.
|
inline |
Create a WindowNumber with the given value.
| value | The new window number. |
Definition at line 772 of file window_type.h.
References value.
|
inline |
Create a WindowNumber with the given value.
| value | The new window number. |
Definition at line 774 of file window_type.h.
References value.
Create a WindowNumber with the given value.
| value | The new window number. |
Definition at line 777 of file window_type.h.
References T, to_underlying(), and value.
|
inline |
Automatically convert to int32_t.
Definition at line 783 of file window_type.h.
References value.
Automatically convert to any other type that might be requested.
Definition at line 790 of file window_type.h.
|
inlineconstexpr |
Compare the right hand side against our window number.
| rhs | The other value to compare to. |
true iff the underlying window number matches the underlying value. Definition at line 799 of file window_type.h.
|
inlineconstexpr |
Compare the right hand side against our window number.
| rhs | The other value to compare to. |
true iff the underlying window number matches the underlying value. Definition at line 797 of file window_type.h.
Compare the right hand side against our window number.
| rhs | The other value to compare to. |
true iff the underlying window number matches the underlying value. Definition at line 802 of file window_type.h.
References T, and to_underlying().
|
private |
The identifier of the window.
Definition at line 763 of file window_type.h.
Referenced by operator int32_t(), operator T(), WindowNumber(), WindowNumber(), and WindowNumber().