NewGRFClass< Tspec, Tid, Tmax > Struct Template Reference

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

#include <newgrf_class.h>

Static Public Member Functions

static void Reset ()
 Reset the classes, i.e.
static void InsertDefaults ()
 Initialise the defaults.
static Tid Allocate (uint32 global_id)
 Allocate a class with a given global class ID.
static void SetName (Tid cls_id, StringID name)
 Set the name of a particular class.
static void Assign (Tspec *spec)
 Assign a spec to one of the classes.
static StringID GetName (Tid cls_id)
 Get the name of a particular class.
static uint GetCount ()
 Get the number of allocated classes.
static uint GetCount (Tid cls_id)
 Get the number of allocated specs within a particular class.
static const Tspec * Get (Tid cls_id, uint index)
 Get a spec from a particular class at a given index.
static const Tspec * GetByGrf (uint32 grfid, byte local_id, int *index)
 Retrieve a spec by GRF location.

Data Fields

uint32 global_id
 Global ID for class, e.g. 'DFLT', 'WAYP', etc.
StringID name
 Name of this class.
uint count
 Number of stations in this class.
Tspec ** spec
 Array of station specifications.

Static Public Attributes

static NewGRFClass< Tspec, Tid,
Tmax > 
classes [Tmax]
 The actual classes.

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 21 of file newgrf_class.h.


Member Function Documentation

template<typename Tspec, typename Tid, Tid Tmax>
static Tid NewGRFClass< Tspec, Tid, Tmax >::Allocate ( uint32  global_id  )  [static]

Allocate a class with a given global class ID.

Parameters:
cls_id The global class id, such as 'DFLT'.
Returns:
The (non global!) class ID for the class.
Note:
Upon allocating the same global class ID for a second time, this first allocation will be given.

Referenced by NewGRFClass< Tspec, Tid, Tmax >::InsertDefaults().

template<typename Tspec, typename Tid, Tid Tmax>
static void NewGRFClass< Tspec, Tid, Tmax >::Assign ( Tspec *  spec  )  [static]

Assign a spec to one of the classes.

Parameters:
spec The spec to assign.
Note:
The spec must have a valid class id set.

Referenced by BindAirportSpecs(), and ObjectOverrideManager::SetEntitySpec().

template<typename Tspec, typename Tid, Tid Tmax>
static const Tspec* NewGRFClass< Tspec, Tid, Tmax >::Get ( Tid  cls_id,
uint  index 
) [static]
template<typename Tspec, typename Tid, Tid Tmax>
static const Tspec* NewGRFClass< Tspec, Tid, Tmax >::GetByGrf ( uint32  grfid,
byte  local_id,
int *  index 
) [static]

Retrieve a spec by GRF location.

Parameters:
grfid GRF ID of spec.
local_id Index within GRF file of spec.
index Pointer to return the index of the spec in its class. If NULL then not used.
Returns:
The spec.

Referenced by AIRail::BuildNewGRFRailStation().

template<typename Tspec, typename Tid, Tid Tmax>
static uint NewGRFClass< Tspec, Tid, Tmax >::GetCount ( Tid  cls_id  )  [static]

Get the number of allocated specs within a particular class.

Parameters:
cls_id The class to get the size of.
Precondition:
cls_id < GetCount()
Returns:
The size of the class.
template<typename Tspec, typename Tid, Tid Tmax>
static uint NewGRFClass< Tspec, Tid, Tmax >::GetCount (  )  [static]
template<typename Tspec, typename Tid, Tid Tmax>
static StringID NewGRFClass< Tspec, Tid, Tmax >::GetName ( Tid  cls_id  )  [static]
template<typename Tspec , typename Tid , Tid Tmax>
void NewGRFClass< Tspec, Tid, Tmax >::InsertDefaults (  )  [inline, static]

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 27 of file newgrf_airport.cpp.

References NewGRFClass< Tspec, Tid, Tmax >::Allocate(), and NewGRFClass< Tspec, Tid, Tmax >::SetName().

template<typename Tspec, typename Tid, Tid Tmax>
static void NewGRFClass< Tspec, Tid, Tmax >::Reset (  )  [static]

Reset the classes, i.e.

clear everything.

Referenced by ResetNewGRFData().

template<typename Tspec, typename Tid, Tid Tmax>
static void NewGRFClass< Tspec, Tid, Tmax >::SetName ( Tid  cls_id,
StringID  name 
) [static]

Set the name of a particular class.

Parameters:
cls_id The id for the class.
Precondition:
index < GetCount(cls_id)
Parameters:
name The new name for the class.

Referenced by NewGRFClass< Tspec, Tid, Tmax >::InsertDefaults().


Field Documentation

template<typename Tspec, typename Tid, Tid Tmax>
NewGRFClass< Tspec, Tid, Tmax > NewGRFClass< Tspec, Tid, Tmax >::classes [inline, static]

The actual classes.

Instantiate the array.

Definition at line 28 of file newgrf_class.h.


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

Generated on Fri Dec 31 17:16:39 2010 for OpenTTD by  doxygen 1.6.1