OpenTTD Source: NewGRFClass< Tspec, Tid, Tmax > Struct Template Reference

OpenTTD Source 1.11.0-RC1

Public Member Functions | Static Public Member Functions | Data Fields | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
NewGRFClass< Tspec, Tid, Tmax > Struct Template Reference

Struct containing information relating to NewGRF classes for stations and airports. More...

`#include <newgrf_class.h>`

## Public Member Functions
void | Insert (Tspec *spec)
uint | GetSpecCount () const
| Get the number of allocated specs within the class.
uint | GetUISpecCount () const
| Get the number of potentially user-available specs within the class.
int | GetUIFromIndex (int index) const
int | GetIndexFromUI (int ui_index) const
const Tspec * | GetSpec (uint index) const
bool | IsUIAvailable (uint index) const
| Check whether the spec will be available to the user at some point in time.

## Static Public Member Functions
static void | Reset ()
static Tid | Allocate (uint32 global_id)
static void | Assign (Tspec *spec)
static uint | GetClassCount ()
static uint | GetUIClassCount ()
static Tid | GetUIClass (uint index)
static NewGRFClass * | Get (Tid cls_id)
| Get a particular class. More...
static const Tspec * | GetByGrf (uint32 grfid, byte local_id, int *index)

## Data Fields
uint32 | global_id
| Global ID for class, e.g. 'DFLT', 'WAYP', etc.
StringID | name
| Name of this class.

## Private Member Functions
void | ResetClass ()

## Static Private Member Functions
static void | InsertDefaults ()
| Initialise the defaults. More...

## Private Attributes
uint | count
| Number of specs in this class.
uint | ui_count
| Number of specs in this class potentially available to the user.
Tspec ** | spec
| Array of specifications.

## Static Private Attributes
static NewGRFClass< Tspec, Tid, Tmax > | classes [Tmax]
| The actual classes. More...

## Detailed Description

### template<typename Tspec, typename Tid, Tid Tmax>
struct NewGRFClass< Tspec, Tid, Tmax >

Struct containing information relating to NewGRF classes for stations and airports.

Definition at line 19 of file newgrf_class.h.

## Member Function Documentation

## ◆ Get()

template<typename Tspec , typename Tid , Tid Tmax>

NewGRFClass< Tspec, Tid, Tmax > * NewGRFClass< Tspec, Tid, Tmax >::Get | ( | Tid | cls_id | ) |
| static

Get a particular class.

Parameters

  cls_id | The id for the class.

Precondition
  cls_id < Tmax

Definition at line 103 of file newgrf_class_func.h.

Referenced by BuildAirportWindow::BuildAirportClassDropDown(), BuildObjectWindow::BuildObjectClassesAvailable(), BuildRailStationWindow::BuildStationClassesAvailable(), BuildObjectWindow::CanRestoreSelectedObject(), CheckFlatLandRailStation(), CmdBuildRailStation(), CmdBuildRailWaypoint(), BuildRailWaypointWindow::DrawWidget(), NewGRFClass< Tspec, Tid, Tmax >::InsertDefaults(), BuildAirportWindow::OnClick(), BuildObjectWindow::OnClick(), BuildRailWaypointWindow::OnClick(), BuildAirportWindow::OnDropdownSelect(), BuildAirportWindow::OnPaint(), BuildRailStationWindow::OnPaint(), BuildObjectWindow::OnPlaceObject(), BuildObjectWindow::SelectClassAndObject(), BuildAirportWindow::SelectFirstAvailableAirport(), BuildObjectWindow::SelectFirstAvailableObject(), BuildObjectWindow::SelectOtherClass(), BuildObjectWindow::SelectOtherObject(), BuildObjectWindow::SetStringParameters(), BuildAirportWindow::SetStringParameters(), BuildRailStationWindow::SetStringParameters(), ShowStationBuilder(), BuildObjectWindow::TagNameFilter(), BuildObjectWindow::UpdateButtons(), BuildObjectWindow::UpdateWidgetSize(), BuildAirportWindow::UpdateWidgetSize(), and BuildRailStationWindow::UpdateWidgetSize().

## ◆ InsertDefaults()

template<typename Tspec , typename Tid , Tid Tmax>

void NewGRFClass< Tspec, Tid, Tmax >::InsertDefaults
| staticprivate

Initialise the defaults.

Reset airport classes to their default state.

This includes initialising the defaults classes with an empty entry, for standard airports.

Definition at line 72 of file newgrf_airport.cpp.

References NewGRFClass< Tspec, Tid, Tmax >::Get(), and NewGRFClass< Tspec, Tid, Tmax >::name.

## Field Documentation

## ◆ classes

template<typename Tspec , typename Tid , Tid Tmax>

NewGRFClass< Tspec, Tid, Tmax > NewGRFClass< Tspec, Tid, Tmax >::classes
| staticprivate

The actual classes.

Instantiate the array.

Note
  We store pointers to members of this array in various places outside this class (e.g. to 'name' for GRF string resolving). Thus this must be a static array, and cannot be a self-resizing vector or similar.

Definition at line 30 of file newgrf_class.h.

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

- src/newgrf_class.h
- src/newgrf_airport.cpp
- src/newgrf_class_func.h
- src/newgrf_object.cpp
- src/newgrf_station.cpp