OpenTTD AI API: AINewGRF Class Reference

OpenTTD AI API 12.2

Static Public Member Functions
AINewGRF Class Reference

Class that handles all NewGRF related functions. More...

Inheritance diagram for AINewGRF:

## Static Public Member Functions
static bool | IsLoaded (uint32 grfid)
| Check if a NewGRF with a given grfid is loaded. More...
static uint32 | GetVersion (uint32 grfid)
| Get the version of a loaded NewGRF. More...
static char * | GetName (uint32 grfid)
| Get the name of a loaded NewGRF. More...

## Detailed Description

Class that handles all NewGRF related functions.

## Member Function Documentation

## ◆ GetName()

static char* AINewGRF::GetName | ( | uint32 | grfid | ) |
| static

Get the name of a loaded NewGRF.

Parameters

  grfid | The NewGRF to query.

Precondition
  AINewGRF::IsLoaded(grfid).

Returns
  The name of the NewGRF or nullptr if no name is defined.

## ◆ GetVersion()

static uint32 AINewGRF::GetVersion | ( | uint32 | grfid | ) |
| static

Get the version of a loaded NewGRF.

Parameters

  grfid | The NewGRF to query.

Precondition
  AINewGRF::IsLoaded(grfid).

Returns
  Version of the NewGRF or 0 if the NewGRF specifies no version.

## ◆ IsLoaded()

static bool AINewGRF::IsLoaded | ( | uint32 | grfid | ) |
| static

Check if a NewGRF with a given grfid is loaded.

Parameters

  grfid | The grfid to check.

Returns
  True if and only if a NewGRF with the given grfid is loaded in the game.