# 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 uint | Resolve (uint index, uint var, uint param, bool *avail) const
| Resolve (action2) variable for a given index.
## Protected Member Functions
virtual void | Resolve (ResolverObject *ro, uint index) const
| Actually execute the real resolving for a given (instance) index.
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 103 of file newgrf_debug_gui.cpp.

## Constructor & Destructor Documentation

virtual NIHelper::~NIHelper | ( |  | ) | `[inline, virtual]`

Silence a warning.

Definition at line 106 of file newgrf_debug_gui.cpp.

## Member Function Documentation

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.

Implemented in NIHVehicle, NIHStation, NIHHouse, NIHIndustryTile, NIHIndustry, NIHObject, NIHRailType, NIHAirportTile, and NIHTown.

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.

Implemented in NIHVehicle, NIHStation, NIHHouse, NIHIndustryTile, NIHIndustry, NIHObject, NIHRailType, NIHAirportTile, and NIHTown.

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.

Implemented in NIHVehicle, NIHStation, NIHHouse, NIHIndustryTile, NIHIndustry, NIHObject, NIHRailType, NIHAirportTile, and NIHTown.

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.

Implemented in NIHVehicle, NIHStation, NIHHouse, NIHIndustryTile, NIHIndustry, NIHObject, NIHRailType, NIHAirportTile, and NIHTown.

Referenced by IsNewGRFInspectable().

virtual void NIHelper::Resolve | ( | ResolverObject * | ro,
|  | uint | index |
| ) |  |  | const`[inline, protected, virtual]`

Actually execute the real resolving for a given (instance) index.

Parameters:

  | ro | The resolver object to fill with everything needed to be able to resolve a variable.
  | index | The (instance) index of the to-be-resolved variable.

Reimplemented in NIHVehicle, NIHStation, NIHHouse, NIHIndustryTile, NIHIndustry, NIHObject, NIHRailType, and NIHAirportTile.

Definition at line 165 of file newgrf_debug_gui.cpp.

virtual uint NIHelper::Resolve | ( | uint | index,
|  | uint | var,
|  | uint | param,
|  | bool * | avail |
| ) |  |  | const`[inline, 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.

Reimplemented in NIHTown.

Definition at line 150 of file newgrf_debug_gui.cpp.

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 185 of file newgrf_debug_gui.cpp.

References SetDParam().

Referenced by NIHAirportTile::SetStringParameters(), NIHRailType::SetStringParameters(), NIHObject::SetStringParameters(), NIHIndustryTile::SetStringParameters(), NIHHouse::SetStringParameters(), and NIHStation::SetStringParameters().

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 172 of file newgrf_debug_gui.cpp.

References SetDParam().

Referenced by NIHTown::SetStringParameters(), NIHIndustry::SetStringParameters(), and NIHVehicle::SetStringParameters().

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.

Implemented in NIHVehicle, NIHStation, NIHHouse, NIHIndustryTile, NIHIndustry, NIHObject, NIHRailType, NIHAirportTile, and NIHTown.

Referenced by NewGRFInspectWindow::SetStringParameters().

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

- src/newgrf_debug_gui.cpp