OpenTTD Source 20250205-master-gfd85ab1e2c
WindowNumber Struct Reference

Number to differentiate different windows of the same class. More...

#include <window_type.h>

Public Member Functions

 WindowNumber (int32_t value)
 
 WindowNumber (ConvertibleThroughBase auto value)
 
 operator int32_t () const
 
template<typename T >
requires (std::is_enum_v<T> || std::is_class_v<T>)
 operator T () const
 

Private Attributes

int32_t value = 0
 

Detailed Description

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 752 of file window_type.h.

Constructor & Destructor Documentation

◆ WindowNumber() [1/2]

WindowNumber::WindowNumber ( int32_t  value)
inline

Definition at line 757 of file window_type.h.

◆ WindowNumber() [2/2]

WindowNumber::WindowNumber ( ConvertibleThroughBase auto  value)
inline

Definition at line 758 of file window_type.h.

Member Function Documentation

◆ operator int32_t()

WindowNumber::operator int32_t ( ) const
inline

Definition at line 761 of file window_type.h.

◆ operator T()

template<typename T >
requires (std::is_enum_v<T> || std::is_class_v<T>)
WindowNumber::operator T ( ) const
inline

Definition at line 765 of file window_type.h.

Field Documentation

◆ value

int32_t WindowNumber::value = 0
private

Definition at line 754 of file window_type.h.


The documentation for this struct was generated from the following file: