OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

Public Member Functions | Protected Member Functions
NIHelper Class Reference

Helper class to wrap some functionality/queries in. More...

Inheritance diagram for NIHelper:

## Public Member Functions
virtual | ~NIHelper ()
| Silence a warning.
virtual bool | IsInspectable (uint index) const =0
| Is the item with the given index inspectable?
virtual uint | GetParent (uint index) const =0
| Get the parent "window_number" of a given instance.
virtual const void * | GetInstance (uint index) const =0
| Get the instance given an index.
virtual const void * | GetSpec (uint index) const =0
| Get (NewGRF) specs given an index.
virtual void | SetStringParameters (uint index) const =0
| Set the string parameters to write the right data for a STRINGn.
virtual uint32 | GetGRFID (uint index) const =0
| Get the GRFID of the file that includes this item.
virtual uint | Resolve (uint index, uint var, uint param, bool *avail) const =0
| Resolve (action2) variable for a given index.
virtual bool | PSAWithParameter () const
| Used to decide if the PSA needs a parameter or not.
virtual uint | GetPSASize (uint index, uint32 grfid) const
| Allows to know the size of the persistent storage.
virtual const int32 * | GetPSAFirstPosition (uint index, uint32 grfid) const
| Gets the first position of the array containing the persistent storage.

## Protected Member Functions
void | SetSimpleStringParameters (StringID string, uint32 index) const
| Helper to make setting the strings easier.
void | SetObjectAtStringParameters (StringID string, uint32 index, TileIndex tile) const
| Helper to make setting the strings easier for objects at a specific tile.

## Detailed Description

Helper class to wrap some functionality/queries in.

Definition at line 115 of file newgrf_debug_gui.cpp.

## Constructor & Destructor Documentation

virtual NIHelper::~NIHelper | ( |  | ) |
| inline virtual

Silence a warning.

Definition at line 118 of file newgrf_debug_gui.cpp.

## Member Function Documentation

virtual uint32 NIHelper::GetGRFID | ( | uint | index | ) | const
| pure virtual

Get the GRFID of the file that includes this item.

Parameters

  index | index to check.

Returns
  GRFID of the item. 0 means that the item is not inspectable.

virtual const void* NIHelper::GetInstance | ( | uint | index | ) | const
| pure virtual

Get the instance given an index.

Parameters

  index | the index to get the instance for.

Returns
  the instance.

virtual uint NIHelper::GetParent | ( | uint | index | ) | const
| pure virtual

Get the parent "window_number" of a given instance.

Parameters

  index | the instance to get the parent for.

Returns
  the parent's window_number or UINT32_MAX if there is none.

virtual const int32* NIHelper::GetPSAFirstPosition | ( | uint | index,
|  | uint32 | grfid
| ) |  | const
| inline virtual

Gets the first position of the array containing the persistent storage.

Parameters

  index | Index of the item.
  grfid | Parameter for the PSA. Only required for items with parameters.

Returns
  Pointer to the first position of the storage array or NULL if not present.

Definition at line 197 of file newgrf_debug_gui.cpp.

virtual uint NIHelper::GetPSASize | ( | uint | index,
|  | uint32 | grfid
| ) |  | const
| inline virtual

Allows to know the size of the persistent storage.

Parameters

  index | Index of the item.
  grfid | Parameter for the PSA. Only required for items with parameters.

Returns
  Size of the persistent storage in indices.

Definition at line 186 of file newgrf_debug_gui.cpp.

virtual const void* NIHelper::GetSpec | ( | uint | index | ) | const
| pure virtual

Get (NewGRF) specs given an index.

Parameters

  index | the index to get the specs for for.

Returns
  the specs.

virtual bool NIHelper::IsInspectable | ( | uint | index | ) | const
| pure virtual

Is the item with the given index inspectable?

Parameters

  index | the index to check.

Returns
  true iff the index is inspectable.

Referenced by IsNewGRFInspectable().

virtual bool NIHelper::PSAWithParameter | ( |  | ) | const
| inline virtual

Used to decide if the PSA needs a parameter or not.

Returns
  True iff this item has a PSA that requires a parameter.

Definition at line 175 of file newgrf_debug_gui.cpp.

virtual uint NIHelper::Resolve | ( | uint | index,
|  | uint | var,
|  | uint | param,
|  | bool * | avail
| ) |  | const
| pure virtual

Resolve (action2) variable for a given index.

Parameters

  index | The (instance) index to resolve the variable for.
  var | The variable to actually resolve.
  param | The varaction2 0x60+x parameter to pass.
  avail | Return whether the variable is available.

Returns
  The resolved variable's value.

void NIHelper::SetObjectAtStringParameters | ( | StringID | string,
|  | uint32 | index,
|  | TileIndex | tile
| ) |  | const
| inline protected

Helper to make setting the strings easier for objects at a specific tile.

Parameters

  string | the string to draw the object's name
  index | the (instance) index for the string.
  tile | the tile the object is at

Definition at line 221 of file newgrf_debug_gui.cpp.

References SetDParam().

void NIHelper::SetSimpleStringParameters | ( | StringID | string,
|  | uint32 | index
| ) |  | const
| inline protected

Helper to make setting the strings easier.

Parameters

  string | the string to actually draw.
  index | the (instance) index for the string.

Definition at line 208 of file newgrf_debug_gui.cpp.

References SetDParam().

virtual void NIHelper::SetStringParameters | ( | uint | index | ) | const
| pure virtual

Set the string parameters to write the right data for a STRINGn.

Parameters

  index | the index to get the string parameters for.

Referenced by NewGRFInspectWindow::SetStringParameters().

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

- src/newgrf_debug_gui.cpp